Re: How kill process with Windows mobile 5 ?
- From: "Lisa Pearlson" <no@xxxxxxxx>
- Date: Tue, 29 May 2007 10:26:00 +0200
Try "SetForegroundWindow(hWnd)" instead of sending API, where hWnd is the
handle of this window.
If this doesn't work, then try :
SetForegroundWindow(hWnd | 0x01);
It is always better to keep first instance, than to kill it and create new
one, because use may have already entered some data in first instance and
application would lose its state if you kill and recreate it.
You should install and use Embedded Visual C++ 4. Its for free and it can
create basic "Hello World" application for SmartPhone that also shows how to
make your application single instance.
Lisa
"Juanito" <jean.cougnaud@xxxxxxxxxxxxxx> wrote in message
news:mn.ea127d75e5edbf19.68503@xxxxxxxxxxxxxxxxx
I use Windev Mobile and I don't think that this language is use here.
I retrieve the Handle with the title of the form with a Windev
instruction.
I retrieve the PID enumerating processes with a Windev instruction too.
In fact, instead of trying to activate the first instance, I send a user
Windows message to the first instance that ask it to close itself. It is
not very good as solution but it is waiting another idea.
I have tried to send it WM_Activate, WM_SetFocus or WM_Close but nothing
occurs.
Thank you for the answer.
Jean
Michael Salamone a exposé le 28/05/2007 :
How are you obtaining the window handle? Is the thread of the owning
window running a message pump/loop?
It may be more expedient for you to post a code fragment so we can review
that.
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com
"Juanito" <jean.cougnaud@xxxxxxxxxxxxxx> wrote in message
news:mn.e4457d75c5eee4a3.68503@xxxxxxxxxxxxxxxxx
My program have a window. I can retrieve the handle of this windows to
send message to it but it seems that there is no effect.
I can retrieve if the program is already running and stop the new
instance but I can't activate the first instance.
I have tried to send message WM_Activate or WM_SetFocus but without
success.
I can retrieve the PID of the first process but I can't kill it. The
message error indicate that I have not enough rights to do it.
I don't know what to do now...
Thank you for the answer.
Jean
Le 28/05/2007, Michael Salamone a supposé :
If your app doesn't have a window, then certainly sending any window
message (what are you using for hWnd?) certainly will not have any
affect.
If you are trying to single-instance the program, then an instance of
it has to detect if their is another instance running and, if so,
terminate. As was already suggested, you can create named kernel object
(e.g. CreateMutex(L"MY_PROGRAM_INSTANCE_NAME" or
CreateEvent(L"MY_PROGRAM_INSTANCE_NAME")). If that is successful, then
call GetLastError. If GetLastError returns 0, then there is no
existing instance and the program should keep running. If it returns
ERROR_ALREADY_EXISTS, then there is an existing instance and the
program should terminate.
Michael Salamone
eMVP
www.entrek.com
"Juanito" <jean.cougnaud@xxxxxxxxxxxxxx> wrote in message
news:mn.e3b57d75e36f927c.68503@xxxxxxxxxxxxxxxxx
My program is multiple instance and I send WM_ACTIVATE to the first
instance but it is the same than with WM_CLOSE or WM_SETFOCUS, nothing
occurs.
I realise that my program is not seen like application but like
process. Is it the reason why it is not possible to stop it or to send
Windows message ?
I use Windev Mobile.
Thank you for the answer.
Jean
Fabien a utilisé son clavier pour écrire :
You can use a Mutex to avoid running multiple instance of your
application... and try to send a WM_ACTIVATE to your first
application
to activate it.
BR
Fabien Decret
Windows Embedded Consultant
ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/ | http://fabdecret.blogspot.com/
On 28 mai, 12:40, Juanito <jean.cougnaud@xxxxxxxxxxxxxx> wrote:
Fabien a formulé la demande :
Hi Jean,
What is the application you want to kill? Is it one of your
application? because since you've written both applications, write
something for notification that will allow this to be done cleanly,
rather than kill process.
You can also try to send a WM_CLOSE to the application you want to
kill.
BR
Fabien Decret
Windows Embedded Consultant
ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/|http://fabdecret.blogspot.com/
On 28 mai, 10:06, Juanito <jean.cougn...@xxxxxxxxxxxxxx> wrote:
Good morning,
I am writing an application on smartphone and I have to kill
another
application. I retreived PID for the application to kill but I
can't
kill it. I have a message that indicates than I do not have the
sufficient rights to do that.
How modify rights for my application ?
Another question, the PID retreived is negative. Is it normal ?
Best regards.
Jean
(France)
I have tried to send WM_CLOSE to the other instance of my
application
and nothing occurs.
In fact I would like just one time my program in memory. If the user
doesn't quit my program but use "home" touch to call another
program,
my program is already in memory but is not visible. If he calls
another
time my program, there are 2 instances in memory.
Kill process doesn't work, send WM_CLOSE doesn't work, ... I don't
know
what to do now...
I use en smartphone.
Thanks for your answer.
Jean- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
.
- Follow-Ups:
- Re: How kill process with Windows mobile 5 ?
- From: Juanito
- Re: How kill process with Windows mobile 5 ?
- From: Juanito
- Re: How kill process with Windows mobile 5 ?
- References:
- How kill process with Windows mobile 5 ?
- From: Juanito
- Re: How kill process with Windows mobile 5 ?
- From: Fabien
- Re: How kill process with Windows mobile 5 ?
- From: Juanito
- Re: How kill process with Windows mobile 5 ?
- From: Fabien
- Re: How kill process with Windows mobile 5 ?
- From: Juanito
- Re: How kill process with Windows mobile 5 ?
- From: Michael Salamone
- Re: How kill process with Windows mobile 5 ?
- From: Juanito
- Re: How kill process with Windows mobile 5 ?
- From: Michael Salamone
- Re: How kill process with Windows mobile 5 ?
- From: Juanito
- How kill process with Windows mobile 5 ?
- Prev by Date: Re: How to bring up "Programs" menu?
- Next by Date: WM_KEYDOWN does not work
- Previous by thread: Re: How kill process with Windows mobile 5 ?
- Next by thread: Re: How kill process with Windows mobile 5 ?
- Index(es):
Relevant Pages
|