Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capture Windows Messages sent from a API to VFP. HELP!
Message
From
20/01/2001 05:32:46
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00466118
Message ID:
00466135
Views:
14
Ed,

>> I am looking for a way to
caputre/hook into the Windows Messaging System so I can display the messages
that are being sent to a defined window on the screen

Ok, I interpreted that as saying I want to monitor the messages (API MSG) being sent to the HWND/Windows procedure, NOT intercept the message and fire VFP code.

>> If however you want to physically plumb into the message queue you can do one of two things. First you can subclass an applications message queue or window procedure, secondly you define a system wide message hook. Both of these options are relatively easy to do and examples can be found on MSDN. I actually use the first option in my VFPEvents.fll to monitor the message queue and perform MessageBox manipulation, however its in C++.

>> Yes, Spy++ will observe the messages sent to a Window, but in order to fire VFP code in reaction to the arrival of a WM_USER-type message, something has to hook the message and fire an event that VFP knows how to handle - an FLL or a COM object coupled to Fox Code using VFPCOM can do this; you need an entrypoint to pass to the API call that tells Window to route windows messages to your code that reacts to the two WM_ messages being sent by the other app and notifies VFP to trigger some codee in response (not to mention to catch the message and place that somewhere VFP can read it. Appleman covers this in some detail in his book; he could use your sample FLL or Christof's assuming source were available, catch teh message(s) of interest, and copy the message structure to an accessible location - a publoc property of the COM object, or directly to a VFP variable from within an FLL. Another option would be to create the same thing as a straight DLL, and tying a Windows event to it - he could use ClsEvent to let VFP wait on a Windows event to be raised by the DLL and make a further call to the DLL to retrieve the message(s) pending. But some code, written in a language other than VFP is needed at some level.

Maybe my post wasn't clear but if you go and look at what my VFPEvents.fll does then you will see that it fires VFP code whilst plumbed into both the VFP message queue and the VFP event subsystem. I will be happy to give Gary code that does this in a complete FLL.

Neil
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform