Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Hook not executed

fobermaier
Beginner
520 Views

I have a QWIN program that uses a DLL which sends status and progress events.
The events are registered using RegisterWindowsMessage.

In order to react to these messages I have set up a hook like this:

use ifwin, only: SetWindowsHookEx, GetCurrentThreadId, WH_GETMESSAGE
! ...
m_hHook = SetWindowsHookEx(WH_GETMESSAGE, %LOC(V3MessagesHook), 0, GetCurrentThreadId())

The signature of the V3MessagesHook function is like this:

integer(4) function V3MessagesHook(nCode, wparam, lparam)
  !DEC$ ATTRIBUTES STDCALL, DECORATE  ::  V3MessagesHook
  integer(4), intent(in)  ::  nCode, wParam, lParam
  !...
end function

Compiling and running the program is no problem, the results are ok, too. But the V3MessagesHook function gets never called.
Using Spy++ I can see that the events I'm trying to get are fired alright.

Where am I going wrong?

TIA Felix

0 Kudos
1 Reply
Steven_L_Intel1
Employee
520 Views

In QuickWin, the UI thread is different from the thread running your code, so I suspect that using GetCurrentThreadID() won't work here. You may want to look at the Poker sample to see how it does subclassing. QuickWin is a somewhat strange environment and not all Windows API features may be usable.

0 Kudos
Reply