Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recieve Windows Messages

Status
Not open for further replies.

wgcs

Programmer
Mar 31, 2002
2,056
EC
Does anyone know how to recieve windows messages before/without VFP processes them?

A C application's main event loop has a message processor... VFP does too, but only hands certain messages to VFP-created Forms. I know that it is possible to intercept the "mouse scroll" event on the VFP main window (that's used for the callback message in the VFP Tray-Icon example), but I need to process other messages.

Perhaps an ActiveX control someone knows about that would simply have a Message event which I could tie VFP code to.

(Hopefully such a control would have a "message mask" so that the many thousands of "other" messages would be ignored, and not take up the CPU time of processing VFP code)


- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Bill,

In VFP 9.0, you can do this with BINDEVENTS(). If you have the November FoxPro Advisor, there is an article by Drew Speedie that tells you all about it.

For VFP 8.0, I don't know of any obvious way of doing it, but no doubt someone else can advise you better than I can.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Also take a look at the January 2005 Foxtalk. The cover article by Doug Hennig covers this.
 
wgcs,

I need a bit of clairification, are you talking about intercepting window messages for the entire OS (message queue) or just intercepting messages that would otherwise be handled by the windows in your VFP application? Also, are you looking to be able to process them and then pass them on OR intercept and discard certain messages?

boyd.gif

 
In the interests of using an active-x control to do this...



...and samples of their use:


Note: the ocx's are VB and the samples are also in VB.

Historic Note: I have tried in the past to implement similar functionality with VFP 7 (haven't tried again since I got VFP 8 some time ago). I was trying to figure out a way to implement a global keyboard hook since I had never seen it done successfully with VFP. No matter what I tried, I ran into C00000005 (enough 0's?) errors like there was no tomorrow. I could not figure out a way to make VFP stable and implement the hook. I created DLLs in VB and C++ and tried a number of third party dlls (COM) and the result was ultimately the same... just as I got close BAM! C5 errors and even some general protection faults.

So wgcs, I wish you luck in your endeavour and may even jump in myself at some point as this is a topic of particular interest to me. I think it wounded my fragile ego a bit to fail at implementing a true hook in VFP. I was so sure at the time that using a COM class (written in another language) was the answer.

boyd.gif

 
Also, are you looking to be able to process them and then pass them on OR intercept and discard certain messages?

Basically, Intercept and discard. Skype uses Windows Messages to allow an application to automate it; First you send a broadcast message, including as data the handle of the window that Skype should respond to, and Skype sends the return messages directly to that window.

I've successfully extended some Delphi code which now works and does all the messaging I need, and it works in Delphi, but when I try to build an ActiveX control, VFP doesn't see the events from the typelibrary (though I'm not seeing the C05 errors anymore... had a couple of funny things defined wrong in the ActiveX control).

I am nowhere near proficient at creating ActiveX controls in Delphi, or anything other than VFP's COM servers, and it's become very clear that the FoxTeam did a great job of making it easy to use VFP to create COM automation servers!

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top