Unable to kill application

G

Guest

I am writiing an application in c# targeting window mobile 5.0. The project
consists of one application(lets call it main) which needs to start another
application. I do this using process class. this part works fine. Now when my
other application starts, i need to hide it. i do that using this.hide(). Now
I need to kill this applicatiion from my main application. which I am unable
to do. process.kill, process.close, process.closemainwindowhandle all fail.
Even the findwindow and destroywindow doesnt work, since findwindow cannot
find my window since its hidden. How can I kill my application from my main
application. Please suggest
Thanks and regards,
Pulkit Sethi
 
G

Guest

Kill is a very unfriendly way to do it. If the target is yours, the best
mechanism is to add some form of IPC to tell it to close. If it's not
yours, posting a WM_QUIT or WM_CLOSE is far better.

FindWindow works fine for any window, hidden or not, so your code tehre is
likely flawed.

The reason an app may continue to run is that it's in a system wait state.
You can't terminate an app in that state until the wait is signalled and the
app gets scheduled again.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
G

Guest

Findwindow doesnt work when someone hides window using this.hide(). if its
minimised then its a different situation. sendmessage is also not working
because i dont have window handle, but i have got a way around for this.
Thanks for the reply
 
G

Guest

Findwindow doesnt work when someone hides window using this.hide(). if its
minimised then its a different situation. sendmessage is also not working
because i dont have window handle, but i have got a way around for this.
Thanks for the reply

Incorrect. FindWindow can and does find hidden windows.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
G

Guest

May be it works on desktop, but it certainly doesnt work on pocket pc hidden
windows. You cant even see such a window on running programs list
 
G

Guest

Again you are wrong. It works fine on Pocket PC, SmartPhone, Windows
Mobile, Hand-Held PC, Palm-Sized PC and every other platform derived from
Windows CE that has GWES. The "Running programs" list doesn't have anything
to do with it - that applet shows top-level Forms with a Caption.

If you're having a problem using the API, then post a question with the code
that is failing. I simply corrected you the first time so that if someone
comes across this thread while searching the newsgroup archives they don't
go away with misinformation. Continuing to argue this is like arguing that
the sky isn't blue.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
G

Guest

I just removed the this.hide() statement from the code, and I was able to
find the window handle. May be it has something to do with c# or clr which
just hides the window to be used by anybody except itself. This is definitely
the behaviour i have seen. My argument is only to find the real reason behind
such a behaviour
 
G

Guest

I just removed the this.hide() statement from the code, and I was able to
find the window handle. May be it has something to do with c# or clr which
just hides the window to be used by anybody except itself. This is
definitely
the behaviour i have seen. My argument is only to find the real reason
behind
such a behaviour

Once again, I have to disagree. It has nothing to do with the CLR. It has
everything to do with something wrong in *your* code (which you've still not
posted). FindWindow can and does find hidden windows. Since you seem to
require proof, here it is:

http://blog.opennetcf.org/ctacke/PermaLink,guid,fcaf9bc2-2026-427b-b65e-95639de2d857.aspx


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top