Click to See Complete Forum and Search --> : Function calling


the Fresh!
July 4th, 1999, 11:17 PM
Hi all!

How is it possible to call a function that resides in another application? I have an application that consists of a few executables. The main executable is dialog based, and the others are automatically executed when starting the main program, by calling something like this:

char path[100];
GetCurrentDirectory(sizeof(path),path);
m_FeedThread = m_ps.Exec(path, "AppsName.EXE", NULL,...);



Now, when I press a particular button on the main program, I want to trigger a function in AppsName. The class for AppsName is not in the main program, so I can't use

((CAppsName *)GetParent())->FunctionName();



How can I achieve this? Any suggestions / tips is very much appreciated.

the Fresh!

Heaven is a Playground!

Fabi Pantera
July 5th, 1999, 12:54 AM
Hi fresh man,
1. Why don't you use a DLL.
2 Why don't you use Automation application.
3. You can use a SendMessage mechanism (i think this is the best method you can use it for this moment). You have to make some command function on your AppName application which respond to some particular ID_MESAGES.. From you main application find the hwnd of the second application (with FindWindow) and simply send the message you want (with SendMessage(HWND, ...)). Is alike you tell the AppName Application "run function ...".
Let me know if this works fine for you.
Best regards,
Faby

the Fresh!
July 5th, 1999, 08:14 PM
Hi Faby,

I tried your last option (using FindWindow() and SendMessage()) but I encounter some problems. The application was written (it wasn't done by me, I have to add some features in it) in such a way that when FindWindow() is called, it will output an error message and the application stops running.

I am now trying to store the message in the registry and get the other program to retrieve it from the registry. Hope it works, as I am not supposed to make major changes to the current application. It's quite hard.

Thanks, man.

the Fresh!

Heaven is a Playground!