Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unable to kill application

38 views
Skip to first unread message

Pulkit

unread,
May 9, 2007, 5:10:01 AM5/9/07
to
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

<ctacke/>

unread,
May 9, 2007, 7:58:24 AM5/9/07
to
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

"Pulkit" <Pul...@discussions.microsoft.com> wrote in message
news:3069C215-E72C-4EE1...@microsoft.com...

Pulkit

unread,
May 9, 2007, 8:16:01 AM5/9/07
to
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

<ctacke/>

unread,
May 9, 2007, 9:11:33 AM5/9/07
to
> 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.

Pulkit

unread,
May 10, 2007, 12:19:00 AM5/10/07
to
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

<ctacke/>

unread,
May 10, 2007, 8:22:26 AM5/10/07
to
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

"Pulkit" <Pul...@discussions.microsoft.com> wrote in message

news:E97DDB15-B0EA-4876...@microsoft.com...

Pulkit

unread,
May 11, 2007, 1:01:02 AM5/11/07
to
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

<ctacke/>

unread,
May 11, 2007, 9:40:04 AM5/11/07
to
>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

0 new messages