|
iCount is a member variable of type int and it's initialized as iCount = 0 in the OnInitDialog initialization code.
I thought the function was entered when a WM_KEYDOWN message is sent?
|
|
|
|
|
I presume you put a break point in the method, ran debug and pressed a few keys and this did not work.
I would therefore suggest, that the message handler is not associated with the window that has focus. For example, (and I'm not saying your doing exactly this, but if you were to associate the message handler with a button on a dialog and the dialog had focus, the handler would not recieve any messages from any key clicks)
Tom
|
|
|
|
|
Ok, thanks for your reply.
What would be the best method to solve this problem?
Also, what I would like to do (in the final application) is to have combinations of buttons pressed. How can this be handled in a dialog app? What I did when I had it as a console app was that I used GetAsyncKeyState() but this doesn't seem to work in the dialog.
Thanks!
|
|
|
|
|
OK, the most important technique key to solving a problem like this is the use of Spy++. Start up your app and see what messages(WM_KEYDOWN) are going to what windows.
Once you know where the messages are going it's just a matter of attaching a handler to those windows.
In your case, I strongly suspect, most of the calls are going to the dialog box itself.
However, if they're not, there's no harm in putting the handlers all in the same file and in each one calling a master handler to get them all in the same place.
Regarding capturing key combinations, check out the nFlags parameter.
Mainly though it's a matter of check the VK_ codes and keeping count of when other keys are down. EG.
VK_CONTROL(WM_KEYDOWN) B(WM_KEYDOWN) B(WM_KEYUP) VK_CONTROL(WM_KEYUP) is control B.
Hope this is what your looking for
Tom
|
|
|
|
|
Thanks a lot. I'll check into it...
|
|
|
|
|
Hi there,
I have an application interfacing two other application one windows base and another one Linux base and my application receives messages from the Linux base app. and sends that to the windows base one and vise versa, the messages from Linux base app. in ASCII hex and I change it to XML string and send it to the windows base app. and also get in XML string from that and convert it to HEX for the Linux base app.
The problem is that after a while I get the Debug Assertion Failed dbgdel.cpp Line 42
Message and my application crashes.
Any idea would be appreciated.
Thanks
|
|
|
|
|
That's because you used ++ instead of + in line 21, making the counter in line 42 overflow.
Insert a comment line on line 41, this should fix it, or bring the problem to line 43.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
|
Thanks for the tip but I am not sure what you mean by making overflow in line 42 ( what class?) this the first time I see dbgdel.cpp unless it is a Windows class (Library)(I do not have such class name in my app.).
Thanks,
|
|
|
|
|
nahitan wrote: after a while I get the Debug Assertion Failed dbgdel.cpp Line 42
Assertions in delete are probably from your code trashing memory it doesn't own.
You'll need to debug your code and find all the places you are overunning the end of allocated
memory. If that doesn't work, blame Linux.
|
|
|
|
|
Mark Salsbery wrote: ...blame Linux.
Why not just save time and do that first?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks
|
|
|
|
|
Hi there,
I have an application interfacing two other application one windows base and another one Linux base and my application receives messages from the Linux base app. and sends that to the windows base one and vise versa, the messages from Linux base app. in ASCII hex and I change it to XML string and send it to the windows base app. and also get in XML string from that and convert it to HEX for the Linux base app.
The problem is that after a while I get the Debug Assertion Failed dbgdel.cpp Line 42
Message and my application crashes.
Any idea would be appreciated.
Thanks
|
|
|
|
|
nahitan wrote: Any idea would be appreciated.
Have you considered looking at line 42 of dbgdel.cpp to see why the assertion is firing?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
In addition to what David said, you can still use your debugger to narrow the problem (it's much faster to get information from your debugger than through a forum for these kind of problems).
|
|
|
|
|
for example, when we click Start, windows will redraw Start button and draw Start menu
is it possible to detect and get position of it?
|
|
|
|
|
Yes it is possible, but there are a lot of factors that go into building an update region.
The two main apis are GetUpdateRgn() and GetClipRgn() . But for something like the Start menu, the only way to get the region would be through hooks since regions are only really used within the process.
|
|
|
|
|
I have a rebar control which I have located at the bottom of my window. When a band is removed from the rebar it relocates to the top of the window and cannot be moved. I've tried all the standard calls for moving a window but to no avail. No idea why it relocates in the first place. Anyone seen this before?
|
|
|
|
|
More info: I had been trapping the Delete Band message in the parent and then calling MoveWindow from there. I moved the MoveWindow call to the derived CReBar class and this appears to be solving the problem. Still no explanation for why the ReBar relocates after removing a band.
|
|
|
|
|
using C++ can i upgrade my frimwire of my MP3 player and add some codecs which make it able to play .RM Real Media files
Thank you very much !!
|
|
|
|
|
|
Maximilien wrote: l o l
I'm not seeing what's so funny, but your letters look somewhat like a TIE fighter.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I prefer finding it funny than sad.
|
|
|
|
|
Hi all,
I have this string, that would look something like this:
ZA123654PCNAME
I want to break the string apart like this:
ZA123654 (Please note that this piece is not constant)
PCNAME
I have tried to get the secondnd part (by doing the following: below), but how can I get the first part, this is if I'm doing it correctly..
<br />
if(strncmp((char *)strstr(Request,(char*)"PCNAME"),(char *)"PCNAME",6)==0)<br />
Thanx in advance
-- modified at 8:57 Thursday 9th November, 2006
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
On which 'parameters' do you split the string ? I mean, how do you know which is the first part of the string and which is the last part of the string ? Are all the strings the same size ? If not, is there a delimiter character ? Or what ? By looking at your code, it seems that the last part is always PCNAME and is always 6 char long.
So, you can then compute the lenght of the first part:
int Len = strlen(Request) - 6;
Then, you can copy up to Len characters of your string in a buffer:
strncpy(szBuff,Request,Len);
If that's not the case, please provide more information about how you want to split the string.
|
|
|
|