Click here to Skip to main content
16,004,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

i have a small windows application which is running as a macro for another application. i am calling this application using system.diaognastic.process.start(app.exe) in the macro. my problem is whenever the main application is clicked or whenever the user performs any operation on the main application this small form is automatically minimized,how to avoid this ?? and also if the main application is closed or minimized the small form should also be closed...

Note:- i am calling .exe, not using .dll

thanks for help....
Posted

Once you start a process, you lose communications with it to an extent: you do get a ProcessID from which you can get the window handles and so forth which would allow you to send windows messages to minimize, close, and so forth - but a better idea would be to set up "proper" communications between the two processes to allow them to talk to each other and tell them directly what to do.
That would be pretty easy: just open a socket and start passing instructions.
 
Share this answer
 
Comments
vikaskallidantheyil 28-Oct-14 6:58am    
thank you..i didnt get you... can u please elaborate...

sorry for inconvenience...
OriginalGriff 28-Oct-14 7:31am    
Google for the Socket class, or "interprocess communications c#" - you will find what you need!
vikaskallidantheyil 29-Oct-14 1:29am    
Thank You..
1.- Try setting TopMost=true in your called application
2.- You have to store the process you are calling in a Process variable, and the in your main form closing kill it:

C#
Process p;
p=Process.Start("notepad.exe");

.
.
.
//In your FormClosing Event Handler
            p.Kill();
 
Share this answer
 
Comments
vikaskallidantheyil 28-Oct-14 6:56am    
thank you...
i cant control the main form.. it is an external application. i had written a macro for it through which i am calling my .exe. in this situation how to know the formclosing event>>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900