Drew Wutka
DWUTKA at Marlow.com
Mon Jul 16 17:09:32 CDT 2007
Just an FYI, the code I have posted is in use in VB 6. It should work fine with Access VBA, but I know there will be two quirks. First, the ISFEMonitoring class uses frmMain's timer, the code will have to be changed for that, because Access forms have the timers as a native object, instead of a separate object. The timer is used to allow the windows messaging API's to completely finish before trying to do something with the message that came through. During testing, without this process in place, when I ran a 'pulse', it would run about 80 times before the code would just stop. No errors, it just stopped sending, because the code was firing messages back and forth without letting each progressive message finish on it's own. So instead of working the with message immediately, it's added to a collection, and the timer is used to kick start the process of working with the messages. The other quirk is that frmMain is adding messages to a listbox, in VB, you can just use an AddItem method, can't do that with an Access listbox. So another method should be used to display message results. There is also functionality that isn't used in the sample. The ISFEMessage has two ways it can be sent. SendMessage and BroadcastMessage. To use sendmessage, the ISFEMonitoring class must handshake, so it can find the hWnd of the window it's supposed to communicate with. It only needs to handshake once, then SendMessage will send messages back and forth between the same two applications. (which is what the pulse 'test' process does). BroadcastMessage (which I don't demo with the form) sends a message to EVERY window out there. Note, I only have it working for sending a long integer (through the SecondParameter) value of the ISFEMessage class. To broadcast other data, the receiving windows would have to NOT destroy the data window. I don't need this capability, so I didn't setup my code to do this. One ideas, if broadcasting text data is necessary, would be to just create a single 'data' window, and keep it open while the class is in use, then destroy it when the ISFEMessaging class terminates. Keep in mind, the window being used would be hidden from a user's desktop, but can be viewed with all sorts of utilities. (Which is why I destroy the window in the 1 to 1 process I have setup). Okey dokey, hope someone finds some use for this, I'm off to starting putting it into my actual application. Drew The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI BusinessSensitve material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.