Click here to Skip to main content
15,897,360 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 6:55
Jorgen E.25-May-04 6:55 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.23-Jun-04 8:21
Jorgen E.23-Jun-04 8:21 
QuestionHibernate event on WinXP ? Pin
Cris24-May-04 8:36
Cris24-May-04 8:36 
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 
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. This in itself works perfectly. However, when I try to close the app, the app will crash or start to take up 100% cpu usage. If I right click the app in the task bar and choose close, I get 100% cpu usage, or if I then press 'C' for the 'Close' menu option, the app crashes. The X button will crash, double clicking the icon in the titlebar will exit without error, as will Alt-F4, and choosing Close from the system menu will crash.

It doesn't matter if I uninstall the hook in OnClose or not, because the DLL will cleanup on DLL_PROCESS_DETACH. I get the same result anyway.

I'm very confused, I have no idea what the problem is, its not consistant at all. I do know that if in the DLL I comment out the PostMessage lines in the event callback, there are no crashes or hangs at all. So I don't know if my app or dll is to blaim. Before the GetMesssage hook I had separate mouse and keyboard hooks, which didn't cause the CPU hang, but would occassionally crash.

Any suggestions?

Thanks!
-Aaron

modified 12-Jul-20 21:01pm.

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 
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 

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.