gary kuipers has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks:

A VB programmer wants me to write a Perl script which signals his program that I have just completed inserting a record into a database. I think I could alert him through a socket but he wants to do it through Windows calls and has sent me this:

My interfaces to slot systems use the following API's for IPC: CallWindowProc CopyMemory GetDesktopWindow GetWindow GetWindowText SendMessage SetWindowLong The process is: SetWindowLong to trap windows messages in your message handler. Send a message: GetDesktopWindow for the topmost window handle. Loop until found GetWindowText to see the window caption If destination window is found, CopyMemory to build a byte array (it's a VB convolution) SendMessage to the window end if GetWindow for next window in chain loop To receive messages: CopyMemory in your message handler to access the text. (This may +be a VB thing, also) CallWindowProc to resume message processing SetWindowLong to unhook your program from windows messages. I hope this is helpful. If you haven't called API's from VB, it may s +eem like unnecessary steps are performed. That's because some C++ da +tatypes are not present in VB.

I will withhold comment.

Anyone know of a Perl Module thta implements this of should I just tell him to get with the program and open a listen socket for me.

Thankx!
Gary

Replies are listed 'Best First'.
Re: Win 32 APIs for IPC (Perl to/from VB)
by BrowserUk (Patriarch) on Aug 12, 2003 at 22:01 UTC

    Every one of the APIs listed except CopyMemory is exposed through Win32::GUITest.

    It also has a call, FindWindowLike() which will probably do away with the loop in that pseudo-code.

    As indicated, I think that the CopyMemory is a VBism that will be taken care of by the Perl interface to SendMessage.

    Good luck.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

Re: Win 32 APIs for IPC (Perl to/from VB)
by Jenda (Abbot) on Aug 13, 2003 at 19:48 UTC

    Win32::GUI contains most (if not all) the functions you need. See hiddenWin.pl for a loop like the one you need. I believe Win32::GUI does contain SendMessage().

    HTH, Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature