|
|
|
|
#1 |
|
Member
Join Date: Mar 2011
Posts: 80
|
How to close firefox in nsis?
Here is what I did to close firefox,
FindWindow $0 'MozillaWindowClass' '' ${If} $0 <> 0 SendMessage $0 ${WM_CLOSE} 0 0 ${EndIf} But it doesn't work. How can I achieve that? Thanks. |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
PHP Code:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 | |
|
Member
Join Date: Mar 2011
Posts: 80
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
It worked when I tested it (Firefox 3.6) The class name is a internal thing and could change between releases. Use http://catch22.net/software/winspy to find the class name
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#5 | |
|
Member
Join Date: Mar 2011
Posts: 80
|
Quote:
|
|
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Firefox 4 is just called MozillaWindowClass.
Stu |
|
|
|
|
|
#7 |
|
Member
Join Date: Mar 2011
Posts: 80
|
|
|
|
|
|
|
#8 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
well, the message is WM_SYSCOMMAND + SC_CLOSE so it should work, but you could try WM_CLOSE as well, and if both fail, bring out the big hammer and call DestroyWindow with the system plugin...
(But why not just ask the user to close firefox? They might want to save bookmarks etc) IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#9 | |
|
Member
Join Date: Mar 2011
Posts: 80
|
Quote:
Could you give me an example how to use DestroyWindow with the system plugin? Thanks a lot. |
|
|
|
|
|
|
#10 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
PHP Code:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#11 | |
|
Member
Join Date: Mar 2011
Posts: 80
|
Quote:
|
|
|
|
|
|
|
#12 | |
|
Junior Member
Join Date: Feb 2011
Posts: 38
|
Quote:
and create a new profile for testing. |
|
|
|
|
|
|
#13 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
I think you should change your strategy. Ask the user to close Firefox themselves. You can either do this with your own code (similar to what we use in this topic) or use a plug-in such as LockedList.
Stu |
|
|
|
|
|
#14 |
|
Member
Join Date: Mar 2011
Posts: 80
|
So should I just call MessageBox MB_OK "Please Close Firefox" in the script? Thanks.
|
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Apr 2008
Posts: 21
|
i think yes!
i would never install a program that will automatically taskkill my firefox.exe! Take a look at that LockedList plugin as Afrow UK suggested. What you have to use depends on your purpose/program. but never kill a task on the user system unasked !!! bye |
|
|
|
|
|
#16 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
You don't just have to have a message box. Using FindWindow you can detect whether Firefox has been closed or not and keep asking them to close Firefox until FindWindow returns 0. Using LockedList has more features of course.
Stu |
|
|
|
|
|
#17 |
|
Member
Join Date: Mar 2011
Posts: 80
|
I don't quite get what you meant. Without using message box, how can I "keep asking them to close Firefox"? I should have some way to inform the users of closing the firefox, right? Thanks.
|
|
|
|
|
|
#18 |
|
Member
Join Date: Jan 2011
Posts: 69
|
...
He means that you have not to show this messegebox always. You can use the "find firefox window" checkup to show the messagebox only if firefox is open.
PHP Code:
|
|
|
|
|
|
#19 |
|
Member
|
Would it not achieve the same affect to do the following...
PHP Code:
http://nsis.sourceforge.net/NsProcess_plugin Squirre1 |
|
|
|
|
|
#20 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
That will not work if and when they make an official 64-bit build of Firefox. FindWindow is safer (when you have a class name).
Stu |
|
|
|
|
|
#21 |
|
Banned
Join Date: Nov 2010
Posts: 7
|
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|