CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2001
    Posts
    391

    Is there a way to pass a HANDLE from one process to another?

    I am playing with Pipes which allow me to intercommunicate from one process to another but if you have ever played with pipes you quickly realize that the CreatePipe() function returns
    back two handles one for reading and one for writing. The one handle is for the one process, the other handle for the other process. The problem is how do you get a VALID handle
    to the other process so the communication can begin? I noticed they Created a new process and had it Inherit the handles of the process that did the creating BUT what i want to
    know is, is there a way to pass one of these handles to an already existing process. I know i can pass anything i want to another process with such techniques as the clipboard, or
    WM_COPYDATA but it is this HANDLE that it seems that it becomes invalid once it gets into another process. I am hoping there is a way to pass a handle to another process and
    still remain valid. Are there any existing API functions to resolve this?

  2. #2
    Join Date
    Sep 2002
    Posts
    1,747
    DuplicateHandle
    */*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

    "It's hard to believe in something you don't understand." -- the sidhi X-files episode

    galathaea: prankster, fablist, magician, liar

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by galathaea
    DuplicateHandle
    ha ha beat me too it I'll just add there is a lot of documentation on using duplicatehandle(...) if you just search your own local msdn or msdn.microsoft.com and example code too boot.

  4. #4
    Join Date
    Dec 2001
    Posts
    391
    THANK YOU!!! You guys are lifesavers!!

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

Featured