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

    passing a value from one exe to another

    Hi all,

    I have two exe's. i have got handle of one exe in another using this api

    Code:
    HWND m_RemoteWindow;
    m_RemoteWindow = ::FindWindow(NULL,_T("b"));
    now i want to pass a parameter to my second exe... i have got handle for it...

    How can i do so.....

    I have to pass parameter from one exe to another and retrieve that parameter in second exe

  2. #2
    Join Date
    Nov 2004
    Posts
    133

    Re: passing a value from one exe to another

    use PostMessage (wparam,lparam) to send the parameters

  3. #3
    Join Date
    Oct 2005
    Posts
    199

    Re: passing a value from one exe to another

    There are several ways for it, Google some information for 'interprocess communication'.

    If amount of data is small, you can send it by COPYDATA-message.

    example (might or might not work 100%):
    Code:
            COPYDATASTRUCT lpCopyData;
            int iVariable=2;
    
            lpCopyData.dwData = 1;
            lpCopyData.cbData = sizeof(int);
            lpCopyData.lpData = (LPVOID)&iVariable;
    
            ::SendMessage(Handle, WM_COPYDATA, NULL, (LPARAM)(LPVOID)(&lpCopyData));
    'You help me, and I, in turn, am helped by you!'
    -H.S.

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: passing a value from one exe to another

    Quote Originally Posted by VCProgrammer
    Hi all,

    I have two exe's. i have got handle of one exe in another using this api

    Code:
    HWND m_RemoteWindow;
    m_RemoteWindow = ::FindWindow(NULL,_T("b"));
    now i want to pass a parameter to my second exe... i have got handle for it...

    How can i do so.....

    I have to pass parameter from one exe to another and retrieve that parameter in second exe
    There are various ways, shared memory, named pipes, etc. You can search for it on the web, there are enough articles on the topic.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

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