I didnt know i must post code here so sry everyone :).
So my problem is next: I have two exes that need to excange data. I tried using standard ::CreateProcess() and ::GetProcAdress() functions but got errors. I presume thats becouse exes are in different processes. I cant use COM for communication heres code

#include "stdafx.h"
#include <windows.h>
#include <iostream>
using std::cout;
using std::cin;
#define EXPORT __declspec(dllexport)
typedef int(*BLA);

//typedef int (__stdcall *myFunc)(const int*);
int _tmain(int argc, _TCHAR* argv[])

    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

    // Start the child process. 
    if( !CreateProcess( TEXT("d.exe"),   // No module name (use command line). 
        NULL, // Command line. 
        NULL,             // Process handle not inheritable. 
        NULL,             // Thread handle not inheritable. 
        FALSE,            // Set handle inheritance to FALSE. 
        0,                // No creation flags. 
        NULL,             // Use parent's environment block. 
        NULL,             // Use parent's starting directory. 
        &si,              // Pointer to STARTUPINFO structure.
        &pi )             // Pointer to PROCESS_INFORMATION structure.
        printf( "CreateProcess failed (%d).\n", GetLastError() );

        //cout<<" Main application succeeded in loading exe!\n";

    BLA l=(BLA)::GetProcAddress((HMODULE)pi.hProcess,"a");


    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE );

    // Close process and thread handles. 

    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );
    char c;
    return 0;

please help. Thanks in advance!

Apparently, you didn't know you should have used code tags either, despite all the places where it gets mentioned.

This article has been dead for over six months. Start a new discussion instead.