Question

Problem defitintion
I have two applications: First and Second. The First is mine, the Second is developed by the outsource.

1) At a certain time I need to send a message from the First app to the Second, to make Second one visible and maximized, after it has been minimized.

2) In order to do the (1) step, Second app should store its handle somewhere in a shared memory, which could be accessed by the name or by whatever it might be (like mutexes do).

Question

So, what is the better option to store data (a handle) in an operating memory?

Was it helpful?

Solution

If you want to store this information in a shared place, then you would typically use shared memory. In Windows terms that's a file mapping object. Create one by calling CreateFileMapping. These are kernel objects and so can be named in the kernel namespace.

File mappings are not a whole lot of fun to work with, so you might like to find an easier solution. Give your application's main form a unique class name. For instance you might name the form's class TMyCompanyNameMyProductNameMainForm. Then call FindWindow passing that class name to find an existing application window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top