i remember the FindWindow command in NSIS 1.4x could detect if a software was running during the installation-process and close it.
now that the commands changed, i'm in need of help.
i want my setup to
1) detect if winamp is running and force the user to close it
or
2) close winamp without asking
if you can help me, please paste the syntax. the makensis.html wasnt a big help for me!
thx in advance,
kb
Close Running Application
22 posts
This is from functions.htm in the nsis distro:
Function CloseWinamp
Push $0
loop:
FindWindow $0 "Winamp v1.x"
IntCmp $0 0 done
SendMessage $0 16 0 0
Sleep 100
Goto loop
done:
Pop $0
FunctionEnd i remember i tried this before. nothing happening. reading the makensis.html it should be possible with FindWindow/SendMessage, but i have no clue how that works. this function does nothing, but thanks anyhow for the quick reply!
I just ran it and it closed winamp just like it should. Are you calling the function?
i did copy+paste =)
what version of nsis did you use? mine is 1.94
what version of nsis did you use? mine is 1.94
I'm using 1.94
Name "CloseWinamp"
Outfile "closewinamp.exe"
Section -
Call CloseWinamp
SectionEnd
Function CloseWinamp
Push $0
loop:
FindWindow $0 "Winamp v1.x"
IntCmp $0 0 done
SendMessage $0 16 0 0
Sleep 100
Goto loop
done:
Pop $0
FunctionEnd This will not work for the current BETA of Winamp. If you want to close a BETA version simply replace
withFindWindow $0 "Winamp v1.x"
~ FlorianFindWindow $0 "STUDIO"
Doh. It never crossed my mind they might be refering wo Winamp 3. 😎
thank you very much! works now, and i added both functions to support both versions =)
Excuse my ignorance on this topic, but how do you find out the name of the Window you want to close if you did not write the application you are trying to close?
-Carlos
-Carlos
Carlos,
there is a tool called Spy++ that ships with Visual Studio. With this tool you could identify the window class or window handle of every open window.
There are similar tools called Window Finder (which ships with source code) and WinSpy.
Kichik uploaded the Spy program from the platform SDK at this thread.
~ Florian
there is a tool called Spy++ that ships with Visual Studio. With this tool you could identify the window class or window handle of every open window.
There are similar tools called Window Finder (which ships with source code) and WinSpy.
Kichik uploaded the Spy program from the platform SDK at this thread.
~ Florian
Thank you for all those useful links Florian, they worked great!!!
-Carlos
-Carlos
kill task
is there an other way to close apps like the above one
i mean a command like kill (killtask ...)"exename"
is more simplier than write everytime a function like the findwindow...
is there a way to implement this command in the next releases of nsis
sorry for my bad english😕
is there an other way to close apps like the above one
i mean a command like kill (killtask ...)"exename"
is more simplier than write everytime a function like the findwindow...
is there a way to implement this command in the next releases of nsis
sorry for my bad english😕
Just make a function to do that an always pass in "exename" in one of thhe registers. Name the function "killtask" if you want, then just Call killtask
example
can you give me an example please???😔
can you give me an example please???😔
Function CloseApplication
Pop $1
Push $0
loop:
FindWindow $0 $1
IntCmp $0 0 done
SendMessage $0 16 0 0
Sleep 100
Goto loop
done:
Pop $0
FunctionEnd
Function .onInit
Push "Winamp v1.x"
Call CloseApplication
FunctionEnd Push the class name of the application before calling it, then the closeapplication will close it.ah
ah yes ok thank you 🙂 🙂 🙂
ah yes ok thank you 🙂 🙂 🙂
no
that way wont work because the task i want to close runs in the background
i have found the window name but it close only the (invisible) window and not the task
the task is still shown in taskmon
is there an other way to close this because i can not write over the file
please help 😕 😕
that way wont work because the task i want to close runs in the background
i have found the window name but it close only the (invisible) window and not the task
the task is still shown in taskmon
is there an other way to close this because i can not write over the file
please help 😕 😕
please Tell me!! help me!!
I can not English Very well.
I want to closeing MYSQL daemon.
please Tell me. help.
Function CloseWinamp
Push $0
loop:
FindWindow $0 "Winamp v1.x" <== How Can i set...
IntCmp $0 0 done
SendMessage $0 16 0 0
Sleep 100
Goto loop
done:
Pop $0
I can not English Very well.
I want to closeing MYSQL daemon.
please Tell me. help.
Function CloseWinamp
Push $0
loop:
FindWindow $0 "Winamp v1.x" <== How Can i set...
IntCmp $0 0 done
SendMessage $0 16 0 0
Sleep 100
Goto loop
done:
Pop $0
In case of MySQL, you can NOT simply kill the daemon. If you do that, you will probably loose database consitency. Instead, simply run the mysqladmin commandline-tool:
C:\mysql\bin\mysqladmin shutdown
This terminates the server gracefully.
From within your script, this would be:
Depending on your setup, this probably needs to specify a database admin-user and his password on the commandline.
See mysql docs...
A question:
Why do you want to shutdown the DB-server?
Nearly anything can be done without shutting down MySQL.
-Fritz
C:\mysql\bin\mysqladmin shutdown
This terminates the server gracefully.
From within your script, this would be:
Function stopMySQL
ExecWait "C:\\mysql\\bin\\mysqladmin shutdown"
FunctionEnd Note:Depending on your setup, this probably needs to specify a database admin-user and his password on the commandline.
See mysql docs...
A question:
Why do you want to shutdown the DB-server?
Nearly anything can be done without shutting down MySQL.
-Fritz
Just, I want to Know... Mysql Daemon State.
How do i know... MySQL Daemon State. (RUNning? OR Not RUNning)
If (MySQL daemon == running) Sending SQL query To MySQL server.
else message "Please Running MySQL Daemon"
<= please teach me. help me.
How can i know MySQL Daemon State.
How do i know... MySQL Daemon State. (RUNning? OR Not RUNning)
If (MySQL daemon == running) Sending SQL query To MySQL server.
else message "Please Running MySQL Daemon"
<= please teach me. help me.
How can i know MySQL Daemon State.
Re: ah
it is March, did you find a way to cloes the running task?🙂
thank you
Originally posted by benpyes that is true.
that way wont work because the task i want to close runs in the background
i have found the window name but it close only the (invisible) window and not the task
the task is still shown in taskmon
is there an other way to close this because i can not write over the file
it is March, did you find a way to cloes the running task?🙂
thank you