 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
mv331 Guest
|
Posted: Sat Jun 14, 2008 11:31 pm Post subject: Block the close button in Firefox or IE |
|
|
Hi,
Is there a way to put a block onto the close "X" button at the top right corner of a window? Especially with either Firefox or IE.
I need to do this to stop accidental closure of a window when I am doing my studies/researching on the net. Yesterday I was using Firefox and had about 8 or 9 tabs opened and hit the close button and then got really peeved off!
It wasnt as easy as going through history as I would of liked cause the list was massive and gave up when I only found 2 pages after about 20 min. so I gave up.
If there is a way to do this would be fab, also would be nice to toggle it off/on with a key combination.
Any help is appreciated.
mv331 |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 860 Location: The Interwebs
|
Posted: Sun Jun 15, 2008 2:23 am Post subject: |
|
|
Well, Firefox has a built in feature to alert you if more than one tab is open when you close the window...
But uh. The first thing that would come to mind for me would be to
a) use ImageSearch, determine the coords of the close button (this ensures that it will work no matter the position of the window)
b) set up a loop to check mouse position, and if it goes onto the coordinates where the close button is, move it back
I'm sure there are better ways to do this, but that is what I immediately think of. |
|
| Back to top |
|
 |
poetbox
Joined: 07 Jan 2007 Posts: 59
|
Posted: Sun Jun 15, 2008 2:59 am Post subject: |
|
|
WinSet, Style, -0x80000, A
This script can remove the close button on the Current windows.
Good luck! |
|
| Back to top |
|
 |
poetbox
Joined: 07 Jan 2007 Posts: 59
|
Posted: Sun Jun 15, 2008 3:14 am Post subject: |
|
|
| Quote: | `::
WinSet, Style, -0x80000, A
return |
Press ` to remove it!(Without the control,you can still use Alt+F4 to close,double-click the Title-bar to MAx or restore)
--
I think what you really need is a good Brower not a such kind of tool.
BTW,there're many browers that has a button to recover the URL which was just closed,and those browsers has a list on start page that contains all the tab page's links which weren't be closed by users,such as 'TheWorld','GreenBrowser' etc. in China.I'm sure that you can find one in your native language. |
|
| Back to top |
|
 |
Muzzi
Joined: 15 Jun 2008 Posts: 65 Location: east coast of Australia
|
Posted: Sun Jun 15, 2008 8:47 am Post subject: |
|
|
I found this but forgot where I pulled it from... some of the script is moded slightly but works for me just a treat.
Just bring any window to the forground to kill the close button. This works on any programs window.
| Code: |
~!x::DisableCloseButton(WinExist("A")) ; disables close button
~!z::RedrawSysmenu(WinExist("A")) ; enables close button
Return
DisableCloseButton(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-1,"Uint","0x400")
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-2,"Uint","0x400")
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}
RedrawSysMenu(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
DllCall("GetSystemMenu","Int",hWnd,"Int",TRUE)
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}
} |
_________________
̊˳ɱטᶚᶚї˳̊ |
|
| Back to top |
|
 |
poetbox
Joined: 07 Jan 2007 Posts: 59
|
Posted: Mon Jun 16, 2008 1:35 am Post subject: very good |
|
|
| MUZZi wrote: | I found this but forgot where I pulled it from... some of the script is moded slightly but works for me just a treat.
Just bring any window to the forground to kill the close button. This works on any programs window.
| Code: |
~!x::DisableCloseButton(WinExist("A")) ; disables close button
~!z::RedrawSysmenu(WinExist("A")) ; enables close button
Return
DisableCloseButton(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-1,"Uint","0x400")
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-2,"Uint","0x400")
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}
RedrawSysMenu(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
DllCall("GetSystemMenu","Int",hWnd,"Int",TRUE)
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}
} |
|
very good!!
BTW,you should delete the last "}" at the end of the good script above. |
|
| Back to top |
|
 |
poetbox
Joined: 07 Jan 2007 Posts: 59
|
Posted: Tue Jun 17, 2008 2:11 am Post subject: |
|
|
I found it here.
http://www.autohotkey.com/forum/viewtopic.php?p=62506#62506
By SKAN.
( | Quote: | Disabling/Enabling the Close button of all instances of Internet Explorer Windows:
Code (Expand - Copy):
| Code: | ^#F2::
WinGet,WindowID,List,ahk_class IEFrame
Loop, % WindowID {
cWindow = % WindowID%A_Index%
DisableCloseButton(cWindow)
}
Return
^#F3::
WinGet,WindowID,List,ahk_class IEFrame
Loop, % WindowID {
cWindow = % WindowID%A_Index%
RedrawSysMenu(cWindow)
} |
|
) |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|