1

Topic: How correctly to remove WH_CALLWNDPROCRET

I cause SetWindowsHookEx (WH_CALLWNDPROCRET, MyHookProc, 0, ThreadID) where ThreadID is not current flow. I do the affairs, then I remove . But after removal  there are calls MyHookProc, and my data and itself MyHookProc any more , and application falls. There are methods to win a trouble, or setting  WH_CALLWNDPROCRET on other flow except leaking are illegal?

2

Re: How correctly to remove WH_CALLWNDPROCRET

UnhookWindowsHookEx that returns?

3

Re: How correctly to remove WH_CALLWNDPROCRET

Hello, SNNy, you wrote: SNN> UnhookWindowsHookEx that returns? The problem is shown very rarely. But when a smog it catch, UnhookWindowsHookEx returned True.

4

Re: How correctly to remove WH_CALLWNDPROCRET

Hello, Aniskin, you wrote: A> I Cause SetWindowsHookEx (WH_CALLWNDPROCRET, MyHookProc, 0, ThreadID) where ThreadID is not current flow. I do the affairs, then I remove . But after removal  there are calls MyHookProc, and my data and itself MyHookProc any more , and application falls. There are methods to win a trouble, or setting  WH_CALLWNDPROCRET on other flow except leaking are illegal? You after removal  transfer the message in queue that it is correct to wait for removal ? Synchronously,  SendMessage (hWnd, WM_NULL...) For even in dock it is written: The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.

5

Re: How correctly to remove WH_CALLWNDPROCRET

Hello, std.denis, you wrote: SD> even in dock it is written Yes, really, in black and white. Looked through, I repent. Whether there was only a question will be sufficient SendMessage (hWnd, WM_NULL...) for a solution of a problem? And how to be, if hWnd hangs, and I do not want to hang together with it. Or if hWnd hangs, MyProc it will not be caused , and it is possible to use SendMessageTimeout?

6

Re: How correctly to remove WH_CALLWNDPROCRET

Hello, Aniskin, you wrote: A> I Cause SetWindowsHookEx (WH_CALLWNDPROCRET, MyHookProc, 0, ThreadID) where ThreadID is not current flow. I do the affairs, then I remove . But after removal  there are calls MyHookProc, and my data and itself MyHookProc any more , and application falls. There are methods to win a trouble, or setting  WH_CALLWNDPROCRET on other flow except leaking are illegal? And if so: - suspend thread - unhook - release thread? Can be eat methods to prevent departures of messages SendMessage/PostMessage? If so then it is better: - to stop messages - in  in cycle PeekMessage, Dispatch - unhook - to release messages

7

Re: How correctly to remove WH_CALLWNDPROCRET

Hello, Aniskin, you wrote: A> Yes, really, in black and white. Looked through, I repent. Whether there was only a question will be sufficient SendMessage (hWnd, WM_NULL...) for a solution of a problem? And how to be, if hWnd hangs, and I do not want to hang together with it. Or if hWnd hangs, MyProc it will not be caused , and it is possible to use SendMessageTimeout? If removal of the bound structures can wait, can instead of Unhook do PostMessage with request Unhook, both droops, and arrives