Results 1 to 3 of 3

Thread: Send a string to another instance without DDE?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    1

    Unhappy

    I have a game application which is played via email. Upon opening a newly received data file from e-mail, players click on the data file to open or restore the program. My program starts, finds an already open instance (if any) of the program, and sends the full path (in the temp dir) of the newly received data file to the existing instance, then closes. I know all about App.PrevInstance, and I have no problem restoring the open instance. I am currently sending the path of the file to open via DDE, and that's where my trouble is. The DDE link fails to establish about 1 time out of 20, and I have had a very hard time trying to debug this, due to the need for email to be open and TWO instances of my VB program. I am logging all the DDE steps, but when it fails, it just seems to go off to "la-la land" (i.e. no errors, nothing logged, and the NEW - sending - instance of the app gets hung) when I try to set the LinkMode to 2.

    Recently I realized that there MUST be an easier and faster way to do this, and that DDE probably isn't even necessary since I don't need a 2-way conversation! I'm thinking that I should be able to use something like "SendMessage" to transmit the newly-received path the already-open instance. My program already has a WindowProc procedure in it (I'm using the System Tray snippet), so I think I have a way to "catch" the message as well.

    Basically, what I need is this:
    1. Given that I know the window handle of the existing instance, how do I send a string (the path) to it?
    2. When that message is sent, how do I go about getting the existing instance to recognize that it has been sent a message, so that I can act upon it?

    THANK YOU FOR ANY HELP!!
    Wayne Torman
    Please email me at: [email protected]

  2. #2
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197
    retired member. Thanks for everything

  3. #3
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    You can use the SendMessage API. There is a message reserved for just this sort of thing. I got a sample on how to use it from somehwere - I don't remember. Because it is not my code I don't feel good about posting it here but I have made it available on my web site.


    http://windsweptsoftware.com/codetool/sendmsg.zip

    This sample has both a client and server.

    Greg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width