Click here to Skip to main content
15,908,775 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Hibernate event on WinXP ? Pin
Graham Bradshaw24-May-04 13:37
Graham Bradshaw24-May-04 13:37 
GeneralReading .PSD file Pin
nachilau24-May-04 8:27
nachilau24-May-04 8:27 
GeneralRe: Reading .PSD file Pin
David Crow24-May-04 8:31
David Crow24-May-04 8:31 
Generalmenu next to images Pin
Member 466743724-May-04 6:54
Member 466743724-May-04 6:54 
GeneralGetMessage Hook and App Crashing Pin
User 1278224-May-04 6:50
User 1278224-May-04 6:50 
GeneralRe: GetMessage Hook and App Crashing Pin
jmkhael24-May-04 7:04
jmkhael24-May-04 7:04 
GeneralRe: GetMessage Hook and App Crashing Pin
User 1278224-May-04 7:57
User 1278224-May-04 7:57 
GeneralRe: GetMessage Hook and App Crashing Pin
Ryan Binns24-May-04 18:37
Ryan Binns24-May-04 18:37 
Aaron Stubbendieck wrote:
I have an MFC application that creates a WH_GETMESSAGE with a callback function in an external non-MFC DLL. It specifically monitors mouse and keyboard events. Event notifications are sent to my app with PostMessage from inside the DLL callback function.

Uh oh. That there is an infinite loop waiting to happen. Your app calls GetMessage(), which triggers your hook, which posts a message to your app, which calls GetMessage() to read it, which triggers your hook, which posts a message to your app...

See where that's gonna end up going? Smile | :)

You'll have to find some other way of notifying your app - look at shared memory or some other inter-process communication; messages won't work in this case.

I can't really explain why some cases didn't cause the crash, although it may be due to the "feature" of WH_GETMESSAGE hooks where messages retrieved via GetMessage() are processed by the hook, but messages retrieved with PeekMessage() are not. I never really understood why this was the case, but it's possible PeekMessage() may be being used for some of those cases.

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRe: GetMessage Hook and App Crashing Pin
User 1278224-May-04 18:50
User 1278224-May-04 18:50 
Generalconverting TCHAR to LPVOID Pin
pnpfriend24-May-04 6:25
pnpfriend24-May-04 6:25 
GeneralRe: converting TCHAR to LPVOID Pin
jmkhael24-May-04 6:46
jmkhael24-May-04 6:46 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 6:57
pnpfriend24-May-04 6:57 
GeneralRe: converting TCHAR to LPVOID Pin
jmkhael24-May-04 7:00
jmkhael24-May-04 7:00 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 8:26
pnpfriend24-May-04 8:26 
GeneralRe: converting TCHAR to LPVOID Pin
Dominik Reichl24-May-04 7:11
Dominik Reichl24-May-04 7:11 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 8:32
pnpfriend24-May-04 8:32 
GeneralRe: converting TCHAR to LPVOID Pin
David Crow24-May-04 8:39
David Crow24-May-04 8:39 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 9:05
pnpfriend24-May-04 9:05 
GeneralRe: converting TCHAR to LPVOID Pin
David Crow24-May-04 9:49
David Crow24-May-04 9:49 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 10:49
pnpfriend24-May-04 10:49 
GeneralRe: converting TCHAR to LPVOID Pin
David Crow24-May-04 10:52
David Crow24-May-04 10:52 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 9:19
pnpfriend24-May-04 9:19 
GeneralRe: converting TCHAR to LPVOID Pin
Michael Dunn24-May-04 11:04
sitebuilderMichael Dunn24-May-04 11:04 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend25-May-04 7:59
pnpfriend25-May-04 7:59 
GeneralRe: converting TCHAR to LPVOID Pin
Blake Miller25-May-04 15:11
Blake Miller25-May-04 15:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.