|
Further notes...
Maybe amazing is the wrong word, but there is a grey area here.
The optimizer removes the code because the var result is never used. It could be argued that the compiler is wrong to overlook the side effect of the expression one / null, but that side effect is not a c++ exception - its a processor trap which the OS decides to pass on to the program - trapping these with catch(...) is murky ground.
Interesting - when you modify the code to make use of result, causing the compiler to compile the assignment, you get a warning C4723: potential divide by 0. So, while it may not be core C++, the compiler does know of the possible side effects of the expression.
Building with warning level 4 provides more clues, but stops short of the warning that would be most informative - i.e. that the code has been removed.
It does give an ureachable code warning for the catch(...), but it gives that for the case where the assignment is used and compiled as well. Makes sense, since no C++ exception is thrown.
I guess the simplest solution is to give in and reference result somewhere in the try block. Better might be to avoid this type of code and test null before attempting the divison.
|
|
|
|
|
I used in a programm the ButtonST Class from Codeproject...
this button class uses the SetCapture method to draw the
button ( win98 style ). now i initiated in the program that
the user must press a accerelator key ( F1 till F11 ) to
switch to another view.... Its an SDI application developed
under Visual C++ 6.0 ( no SP ). The acckey calls a function
OnKeyF1Pressed()... but when the mouse is over a buttonST
OnKeyF1Pressed won't be called..... I think there's a
problem with the buttonST ( esspecially with SetCapture ).
I tried to called RemoveCapture() when the button is drawed
but that isn't very fine because the buttonst isn't drawn
completely but the view is switched.
hope that someone will help me
BEST REGARDS
ingo eberhardt
SEC
|
|
|
|
|
I am looking for a resource editor component (Freware, Shareware or
commercial) that allows users dynamically select controls from a palette,
draw them on a layer, position them and manage their properties. The
mechanism should be Visio® like.
Thanks
|
|
|
|
|
Hello,
I'm trying to find the best way to use the common tooltip control but with the possibility to have diferent fonts like bold, normal and italic in it.
My first idea was to try the custom draw support of the tooltip control but that does not enable you to have different fonts in one and the same tooltip.
Ok, I thought lets try it with owner draw, but the thing is I'm not sure if that is possible or supported with the tooltip common control.
Is there anyone out there who can give me an explanation how to do this the best way? Is owner drawing supported by the tooltip common control?
My aim is to support an editor for a house made language with the "Parameter Info" feature like the one in VC++, so whenever the next possible argument is entered the tooltip should show the next argument highlighted like with a bold font, simple but...
Andreas.
|
|
|
|
|
I haven't tried this myself, but I would think you could owner-draw the entire tooltip when the NM_CUSTOMDRAW message arrives. The NMCUSTOMDRAW struct has a RECT member that tells you the RECT of the control.
|
|
|
|
|
If you decide to go the path of a owner drawn control then you are welcome to use my Extended Tooltip as a base. It only allows a single font, but maybe there is scope to extend it to provide RTF capabilites within the tooltip window that would provide what you want. A lot of work, I guess - but it would be cool
|
|
|
|
|
I am writing an application for a customer and they have selected that F10 and it's variations (Ctl, Alt, Shift) bring up different windows.
Now I know that F10 is a System key used for Menu's and such, but I have tried WM_SYSCOMMAND and WM_SYSKEYDOWN to no avail. Here is my code for OnSysCommand:
void CMyDialog::OnSysCommand(UINT nID, LPARAM lParam)
{
if (nID == SC_KEYMENU)
{
UINT nKey = VK_F10;
OnFunctionKey(&nKey);
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
This works fine...but it works whether the user presses F10 or just Alt, which I don't want. So the basic question is
"Has anybody used F10 for something other than a menu initializer?"
Thanks
Chris Mancini
|
|
|
|
|
Hi
I did this using
OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
..
if (VK_F10 == nChar)
..
and it works fine.
Use ::GetKeyState to find out about Alt, Ctrl and so on
|
|
|
|
|
How to make a replication through ODBC in MS Access?
|
|
|
|
|
I have a problem with DevStudio Sp3 running under Win2K. The attach to process dialog doesn't show any processes! Does anyone else have such a problem?
Jignesh
|
|
|
|
|
Found the problem..
See http://support.microsoft.com/support/kb/articles/Q235/4/34.ASP
|
|
|
|
|
One more developers web site is almost ready. Here is discussion board
www.mindcracker.com/forum
|
|
|
|
|
Let's say - for a setup-like application; you could pack an unpacker program and the compressed data in an unique file, for easier download. That's easy enough - just "adding" the compressed data at the end of the unpacker exe file.
But .. under Windows NT, you can open an exe file at runtime, using the standard CFile class, read it, and save in a temporary location part of the file; this method doesn't work under Win9x though.
Anybody knows a better way that works under every MS OSes ?
Thanks!
|
|
|
|
|
I am implementing a listview for a touch screen application. I have placed a CSpinButtonCtrl next to the listview to make it easy to scroll, without having to fiddle with the scroll bar. The question is, how do you PERMANENTLY remove the vertical scroll bars from the listview, without settings the no-scroll option in the dialog template editor.
|
|
|
|
|
hi
i... jeims
help me T_T
|
|
|
|
|
Does anybody know, how to play AVI-Files during an application ?
I would like to it with DirectShow, but i would have to Download the whole DirectX SDK (128Mb !!!).
Does anybody know, where i could download only the DirectShow SDK, or any other solution, how to play AVI-Files ?
|
|
|
|
|
Ahh you're making the same mistake I did!!
DirectShow is NOT part of the DirectX toolkit. MS for some unknown reason decided to move it to the DirectX Media SDK which is spearate! I only learn't this after a 128M download! I does actually say this on the web site, but it is not very clear at all. (Us lot over here in England put it download to our lack of ability to read American!)
Anyway why use DirectX? Try a CAnimateCtrl....
|
|
|
|
|
Isn't there any way to create a button(or adding to a menu) in a COM clients dialog through a function of the COM server(dll)
|
|
|
|
|
Isn't there any way to create a button(or adding to a menu) on a server dialog through a function of a COM server(dll)
|
|
|
|
|
Hi,
in my app. i have this code:
The first part loads 2 bitmaps, 1 normal and one inverted one (used as a mask by windows):
HANDLE m_hImage;
HANDLE m_hNegImage;
m_hImage = LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_NORMAL), IMAGE_BITMAP, 0, 0, 0 );
m_hNegImage = LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB__INV), IMAGE_BITMAP, 0, 0, 0 );
Next i create a cursor with the info given:
ICONINFO info;
HCURSOR m_hCursor;
info.fIcon = FALSE; // means it's a cursor
info.xHotspot = 11;
info.yHotspot = 0;
info.hbmColor = (HBITMAP) m_hImage;
info.hbmMask = (HBITMAP) m_hNegImage;
m_hCursor = CreateIconIndirect(&info);
Next i override my OnSetCursor code to do my own implementation:
SetCursor(hCursor)
This code works absolutely fine under WinNT 4.0 but not under Win98. I imagine Win98 can't handle the size (rather big) of my own cursors. Anyway, all the functions return fine and work ok except it displays the standard cursor and not my own creation.
Does anybody have a clue on how i can still use my own images (and thus cursors) in my application under Win98?
Thanks
|
|
|
|
|
How I can get the list of availablis data members of the A class and their type, if there is an object or pointer on the object of the A class? (with C++ means only, w/o programming with assembler)
It is said, it is impossible.
Whether so it?
Thanks.
|
|
|
|
|
How can i display a ctrl in the dropdown window of a combo? for example a button?
or a checklist box?
|
|
|
|
|
Make the Combo box Owner Draw and derive a new class from Ccombobox and the control which u want to add
u also have to override various function (consult MSDN)
|
|
|
|
|
Hi,
I'm using a WebBrowser control inside a CView class. I've
used the ClassWizard to encapsulate the control's functionality,
but although I've used SetWidth() and SetHeight() to set
the right values, I can't get rid of the vertical scrollbar
on the right. SetResizeable(FALSE) returns a funny message,
and none of the CWnd scrollbar functions seem to have any
effect.
Any help will be greatly appreciated.
|
|
|
|
|
This can be done with the IDocHostUIHandler interface that you must implement in your container (CView derived class). Look at GetHostInfo and returning with docHostUIFlagSCROLL_NO flag set.
In ATL support for this interface is built in. You can look at the implementation of CAxHostWindow for an example implementation. A description of some of this can be found in ATL Internals.
|
|
|
|