postmessage in a callback function
-
Anyone have any idea why when I call PostMessage in a callback function, it works just fine on W2K and WinXP, but doesn't work on Win98SE? On all of the above O/S's, it makes it to the callback just fine, and the PostMessage() succeeds, but on Win98, it never makes it to function which handles the message. Any ideas? Thanks! Marcus Spitzmiller "Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
-
Anyone have any idea why when I call PostMessage in a callback function, it works just fine on W2K and WinXP, but doesn't work on Win98SE? On all of the above O/S's, it makes it to the callback just fine, and the PostMessage() succeeds, but on Win98, it never makes it to function which handles the message. Any ideas? Thanks! Marcus Spitzmiller "Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
Are you sure the HWND you are posting to is valid and correct. Have you tried running Spy++ to see if the posted message is being received by the window in question. You might just be lucky that it is working on XP etc. You didn't mention what the callback is (yours / windows) but that shouldn't make any difference, unless there is some specific Windows Callback where PostMessage can't be used, but I doubt it. I've never encountered a problem where PostMessage() didn't do what I expected and I use it quite a bit. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
-
Are you sure the HWND you are posting to is valid and correct. Have you tried running Spy++ to see if the posted message is being received by the window in question. You might just be lucky that it is working on XP etc. You didn't mention what the callback is (yours / windows) but that shouldn't make any difference, unless there is some specific Windows Callback where PostMessage can't be used, but I doubt it. I've never encountered a problem where PostMessage() didn't do what I expected and I use it quite a bit. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
Hi Neville - Well, I've been able to use Spy++ on XP to see that the HWND is indeed correct and the CWnd derived class that I'm posting to is indeed receiving the message (WM_USER + 1). On Win98, i've been able to verify that PostMessage is posting to the correct HWND, however, I can't verify that the CWnd derived class is receiving the message, because I can't get spy++ to run on Windows 98! :doh: Any ideas how to do that? Or do you know of a different tool I can use to check that? By the way, the callback is waveOutProc, which should have no problem using PostMessage within the callback. Thanks for the help! Marcus Spitzmiller "Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
-
Hi Neville - Well, I've been able to use Spy++ on XP to see that the HWND is indeed correct and the CWnd derived class that I'm posting to is indeed receiving the message (WM_USER + 1). On Win98, i've been able to verify that PostMessage is posting to the correct HWND, however, I can't verify that the CWnd derived class is receiving the message, because I can't get spy++ to run on Windows 98! :doh: Any ideas how to do that? Or do you know of a different tool I can use to check that? By the way, the callback is waveOutProc, which should have no problem using PostMessage within the callback. Thanks for the help! Marcus Spitzmiller "Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
Hi Marcus, I haven't used W98 in some time but don't recall having problems running Spy++. You could try Winspector Spy http://www.windows-spy.com/[^] You could add a PreTranslateMessage() into the target CWnd then in that look for your WM_USER+1. Also not that WM_USER messages aren't recommended and instead you should use WM_APP. See the article http://www.codeproject.com/dialog/messagemgmt.asp[^] If the callback isn't in the main app thread you shouldn't be using CWnd*'s. Post a reply if you need more info on this or look for more J. Newcomer articles on threads. Hope that helps. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
-
Hi Marcus, I haven't used W98 in some time but don't recall having problems running Spy++. You could try Winspector Spy http://www.windows-spy.com/[^] You could add a PreTranslateMessage() into the target CWnd then in that look for your WM_USER+1. Also not that WM_USER messages aren't recommended and instead you should use WM_APP. See the article http://www.codeproject.com/dialog/messagemgmt.asp[^] If the callback isn't in the main app thread you shouldn't be using CWnd*'s. Post a reply if you need more info on this or look for more J. Newcomer articles on threads. Hope that helps. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
Thanks very much! - I wasn't aware of the WM_USER thing. After changing it to WM_APP, everything is working fine! Thanks again for the help, and thanks for the links!! :) Marcus Spitzmiller "Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
-
Thanks very much! - I wasn't aware of the WM_USER thing. After changing it to WM_APP, everything is working fine! Thanks again for the help, and thanks for the links!! :) Marcus Spitzmiller "Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
Happy to be of help. You can have the rest of the year off now.:-D Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"