|
|
How would I get an event for a key-stroke like ALT+SHIFT+CTRL+L even while the capture isn't on my program? Many programs (such as ICQ) do things like this.
|
|
|
|
|
Look up the RegisterHotKey() API.
|
|
|
|
|
I have a program which will generate Images of different objects on the screen.If you choose a menu item (RSC,Folder for example) you are promted to enter a few parametrs related to the object.(Length,Width,Depth and flute)
Since all of the objects need the same info I want to use one single dialog.However Each object manipulates the info in different ways..With a single dialog and hence a single
"Render" button how can I determine Which object the dialog was called for in my OnRender Function...Is what Im trying to do possible???It has to be this is C++ ).
Any suggestions or hints would be greatly appreciated...
Thanks for the time
J.Prisco
|
|
|
|
|
Make a base class for all the objects.
Put a member variable in it to represent the current ype.
Make an enumeration for all your types.
Derive all your 'object' classes from this base type.
Use the value of the 'type' data item to let your OnRender code know what was selected.
The diaog can also use that 'type' variable to know what controls to display to user, or else how to limit the data ranges where user might be entering numbers.
You could do the saem thing with C structures, always make the first element of the object structures this type.
Then if you have a pointer to some of this memory, you can cast the pointer to this 'type' variable and access the data structure's object type.
|
|
|
|
|
Although this sounds good Im still not to clear on how this is done..Thanks for the hint Ill investigate it further..
|
|
|
|
|
I assume that you have one menu item for each object that you want to display. I also assume that each kind of display object is being abstracted as a class and all these classes have a common base class. In the menu handler for each of these menu items, you would probably instantiate an object of the dialog class and call its DoModal(). You can pass a 'C++ object' of the appropriate object to be displayed to the dialog's constructor. In the dialog's OnRender() method, you can call the Render() method of these objects, provided the Render() method of the base class is virtual.
|
|
|
|
|
Well I made my initial post when I first discovered the problem .At my fist observation it really seemed to be quite a problem..After a little though I figured a way to do what I needed but in fact What I was planning wasnt even necisarry at all.Once I began coding the app I found the problem was no problem at all...For each menu item handler
I use DoModal and upon its return I assign the corresponding objects variables...Although a little inneficient it works just fine..
Thanks for the help I really appreciate all the help I can get and Ill probably need more help with this app which is probably a little too ambitious for me at this point.
|
|
|
|
|
Hi,
I have been trying to set the fontsize and fontface of a label control. Does anyone know how to do this in ATL? I am usnig the stock property "FONT", but I just can't get it to work. I have just about all the other properties doing what I want them to do, but font is really giving me a hard time.
Thanks
|
|
|
|
|
Hi,
There is a very nice step-by-step instructions in the MSDN article "FILE: Using Fonts in ATL Controls with NiceText.exe" Article ID: Q166472. I've used it about a year ago and it worked fine.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
I am doing some stand-alone apps for handheld scanners. I need to know just exactly what different options the New Project wizard performs.
Does someone know of a document that precisely describes each option and what it produces? (Win32 App, MFC Wizard App, etc.) The help does little or nothing for me here!
I have always used a standard windows MFC app and haven't explored all of the different options.
David Leikis
Thiokol Propulsion systems
|
|
|
|
|
|
Justin, I posted your code on a BBS I read, and someone responded that it gives the expected output using gcc. So chalk it up to a VC bug, I guess.
Something else that's weird - if you try to set breakpoints on the A() and B() constructors, it will only let you break at one of them. VC will say there's no code at the line the other constructor is on. *shrug*
|
|
|
|
|
Justin, I found this MS KB article that acknowledges that this is a bug in VC. The workaround is to throw a dummy template parameter in the function, i.e.:
template<typename T> void func ( T* dummy = NULL )
|
|
|
|
|
|
Is anyone familiar with programming the Rich Ink control for a WinCE 2.11 device? If not, do you have any suggestions for implementing signature capture. Thanks.
|
|
|
|
|
I am trying to move a combo box to a new location when a specific event happens. The code I currently have is:
CComboBox* state;
// box is initialized, blah blah blah
// then, later I have
state->MoveWindow(x, y, WIDTH_INC, HEIGHT_INC, TRUE);
This causes the following error:
The instruction "0x5f436c36" referenced memory at "0xcdcdcded". The memory could not be "read".
Using the debugger to step through the program, I've discovered in the MoveWindow function, it asserts at
ASSERT(::IsWindow(m_hWnd))
Any ideas what's happening?
Thanks,
Stephanie
|
|
|
|
|
Probably you called the MoveWindow function too early. I.e. before the controls are actually created.
If I recall correctly, they are created before/after the CDialog::OnInitDialog event.
|
|
|
|
|
Here's the sequence:
The user fills in some edit fields and pushes an Allocate button. The CComboBox is created and displayed.
Everything is good at this point. I can select different items from the drop down box and everything. If
the user has selected the Allocate button more than once, there could be several of the CComboBoxes.
When the user selects a Deallocate button, the CComboBox is removed the remaining boxes need to be
moved up (they're displayed vertically). This is when MoveWindow gets called and crashes.
Does this makes sense? The CComboBox has definately been created because I can select items from it.
Do you have any other suggestions?
Thanks,
Stephanie
|
|
|
|
|
Sounds like you may be goiong in a loop somewhere to move other boxes up, so don't you think you might be trying to move the one that is already gone, possibly?
|
|
|
|
|
I thought of that also, so I put in
if (state)
AfxMessageBox("Box is good");
else
AfxMessageBox("Box is bad");
I got the Box is good message, so I think the box is still there. Is this an accurate test to see if the box
exists? Any other ideas?
Thanks again,
Stephanie
|
|
|
|
|
|
Hi Stephanie,
Testing a pointer to a MFC object is not enough, it could be not associated to a Windows object anymore.
To see if the combobox exists, you should call ::IsWindow() just like the debug assertion.
I think you have to believe that
Maybe, a code snippet that shows how you destroy the control and then reference it could be more helpful.
I also think you are using the deleted object at some point.
Cheers,
Paolo
|
|
|
|
|
No one noticed the value of the pointer! 0xCDCDCDED screams "uninitialized data". When a stack variable is allocated, it's filled with 0xCD so you can see that the variable hasn't been initialized yet. So Stephanie, wherever your MoveWindow() call is, you're calling it through an uninitialized pointer.
|
|
|
|
|
Actually, I had noticed that, especially since I had just encountered a CWnd pointer like that in my program and I put in special logic to test for 0xcdcdcdcd. I was being methodical about the problem so that is why I started out by asking what is "state"? Your answer is also good, since it seems that your answer did not require a reply. I do not know what I was thinking, but I guess I needed more information before I could help. Perhaps I just got distracted by confusion about the rest of the question and forgot to mention about the 0xcdcdcdcd stuff, so it is good you caught it.
|
|
|
|