-
August 27th, 2008, 12:32 AM
#1
Commnuication across individual process...need suggestion
Hello All,
Need some suggestion on how to proceed with the following situation:
I have a MDI Based Application "xxx.exe" in which we incorporated OLE layer such that the application can be invoked and communicated through the MS Excel too. Now xxx.exe invokes some zzz.DLL / some yyy.exe through CreateProcess (for launching .exes) methods, and i have requirement such that this zzz.dll or yyy.exe should be able to talk to xxx.exe and get some data from xxx.exe.
I was thinking whether i can achieve this through the existing OLE layer in xxx.exe or I should introduce some COM Layer in this xxx.exe and expose some interfaces such that the application like yyy.exe or zzz.dll can exchange data to and fro with xxx.exe.
Any suggestions in this scenario.
Thanks
Intellectuals solve problems; geniuses prevent them.--Albert Einstein.
Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.THAT'S Relativity --Albert Einstein
-
August 27th, 2008, 05:33 AM
#2
Re: Commnuication across individual process...need suggestion
Does using CConnectionPoint will be a good solution.
-venky
Intellectuals solve problems; geniuses prevent them.--Albert Einstein.
Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.THAT'S Relativity --Albert Einstein
-
August 28th, 2008, 10:41 PM
#3
Re: Commnuication across individual process...need suggestion
If your intention is to communicate between two processes without communicating with other OLE objects, consider pipe or socket.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 1st, 2008, 10:38 AM
#4
Re: Commnuication across individual process...need suggestion
i tried working out this way
HTML Code:
http://www.codeguru.com/forum/showthread.php?p=1757054#post1757054
but still no luck in resolving this issue...any suggestions...
Intellectuals solve problems; geniuses prevent them.--Albert Einstein.
Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.THAT'S Relativity --Albert Einstein
-
September 1st, 2008, 11:37 AM
#5
Re: Commnuication across individual process...need suggestion
Originally Posted by venkyhyd
i tried working out this way
HTML Code:
http://www.codeguru.com/forum/showthread.php?p=1757054#post1757054
but still no luck in resolving this issue...any suggestions...
You are only complicating things by bringing in C# into the mix.
-
September 2nd, 2008, 06:39 AM
#6
Re: Commnuication across individual process...need suggestion
Originally Posted by Arjay
You are only complicating things by bringing in C# into the mix.
Okay now here i have situation, i have an MFC MDI Based application with OLE Automation layer in it. I will launch this MFC and i have a C# application which is invoked by this MFC application through the create process methdo and want this C# application to talk to the MFC application and exchange data between these two.
Can the existing OLE layer in the MFC application be used for exchanging data across these two applications.
Please suggest me if i am missing anything here or messing up with things
Intellectuals solve problems; geniuses prevent them.--Albert Einstein.
Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.THAT'S Relativity --Albert Einstein
-
September 2nd, 2008, 07:15 AM
#7
Re: Commnuication across individual process...need suggestion
I don't know the answer to your question about using OLE layer, however, you could easily implement communications using (as JohnCz already mentioned) pipes or sockets. Since you run both Apps on the same PC you could also use WM_COPYDATA message (and if data to be sent were not so big and communications happened not so oft - just a simple PostMessage a registered Windows messages could work)
Victor Nijegorodov
-
September 11th, 2008, 09:51 AM
#8
Re: Commnuication across individual process...need suggestion
I think i have a solution for this, still need your valuable comments on this solution.
In the MFC Ole Server app i created an interface (deriving a class from CDocument or CCmdTraget). In the server before invoking the C# client I would instantiate the Interface in the appliction itselfs such that client need not do any CoCreateInstance on the interface, instead the client can just do a QueryInterface and get handle to the Interface and try talkting to the application.
Now how does the client get handle to application, so for this I would add this MFC Ole Server application to the ROT with ItemMoniker giving the name of the application and whatever string information which is easy to identify by the client. Now the client would parse through the entire ROT table and get handle to Application and do a GetObject and just
C# client code: to get handle to Ole app
Code:
Ole32.GetRunningObjectTable(0, out runningObjectTable);
runningObjectTable.EnumRunning(out pMonkEnum);
pMonkEnum.Reset();
IntPtr fetched = Marshal.AllocHGlobal(4);
IMoniker[] pMon = new IMoniker[1];
IMoniker pClientMoniker;
Object ppUnkVFObj;
string objList = "";// = new string();
string objOut = "From C# client: Hello I am from C# Client";
//test MFC Ole Server functionality strings
while (pMonkEnum.Next(1, pMon, fetched) == 0)
{
int iFetched = Marshal.ReadInt32(fetched);
IBindCtx pCtx;
Ole32.CreateBindCtx(0, out pCtx);
string str;
pMon[0].GetDisplayName(pCtx, null, out str);
if (str.CompareTo("OLESERVERNAME") == 0)
{
pClientMoniker= pMon[0];
runningObjectTable.GetObject(pClientMoniker, out ppUnkVFObj);//ppUnkVFOb is of type Object
vfAutomationFunct = (MFCApp.IExposeFunct)ppUnkVFObj; //Note i am not doing any cocreateinstance here instead just doing a getobject and type casting it to the interface type.
vfAutomationFunct.GetObjectList(ref objList); //these functions are defined in the Interface present in the MFC Ole server exe
vfAutomationFunct.SetObjData(objOut); //these functions are defined in the Interface present in the MFC Ole server exe
}
}
Any comments/suggestions on the above said?
-thanks
Intellectuals solve problems; geniuses prevent them.--Albert Einstein.
Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.THAT'S Relativity --Albert Einstein
-
September 12th, 2008, 12:00 AM
#9
Re: Commnuication across individual process...need suggestion
I would really appreciate your inputs on the solution i had thought of....
-thanks in advance
Intellectuals solve problems; geniuses prevent them.--Albert Einstein.
Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.THAT'S Relativity --Albert Einstein
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|