HighGuy Posted May 25, 2005 Posted May 25, 2005 Hi, I want to disable or remove the exit-button of a cmd.exe. Instead the user should be forced to type "exit". Does anyone know of a way to realize this? TIA, Highguy
Blue_Drache Posted May 25, 2005 Posted May 25, 2005 Hi,I want to disable or remove the exit-button of a cmd.exe. Instead the user should be forced to type "exit". Does anyone know of a way to realize this?TIA, Highguy<{POST_SNAPBACK}>A transparent GUI overlaid on top of the CMD window's title bar should do the trick, although it still doesn't break the Alt+F4 combination. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
/dev/null Posted May 25, 2005 Posted May 25, 2005 A transparent GUI overlaid on top of the CMD window's title bar should do the trickNice idea. How would you do that?CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
quaizywabbit Posted May 26, 2005 Posted May 26, 2005 (edited) you could alter the style of the window also.... using Winspector I got all the properties:Class Name: ConsoleWindowClass Text: C:\WINDOWS\System32\cmd.exe Rectangle: 235, 594, 904, 932 Size: 669, 338 Client Rectangle: 0, 0, 640, 300 Client Size: 640, 300 Styles: WS_OVERLAPPED WS_VISIBLE WS_CLIPSIBLINGS WS_BORDER WS_VSCROLL WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX 0x04194304 StylesEx: WS_EX_ACCEPTFILES WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR WS_EX_APPWINDOW Edited May 26, 2005 by quaizywabbit [u]Do more with pre-existing apps![/u]ANYGUIv2.8
HighGuy Posted May 27, 2005 Author Posted May 27, 2005 Found a different solution. Quite nice #include <GUIConstants.au3> ; Change into the WinTitleMatchMode that supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) $SC_CLOSE = 0xF060 Run(@ComSpec) WinWait(@ComSpec) ; Get the handle $handle = WinGetHandle("classname=ConsoleWindowClass", "") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else $dSysMenu = DllCall("User32.dll", "hwnd", "GetSystemMenu", "hwnd", $handle, "int", 0) $hSysMenu = $dSysMenu[0] DllCall("User32.dll", "int", "RemoveMenu", "hwnd", $hSysMenu, "int", $SC_CLOSE, "int", 0) DllCall("User32.dll", "int", "DrawMenuBar", "hwnd", $handle) EndIf
Blue_Drache Posted May 27, 2005 Posted May 27, 2005 Nice idea. How would you do that?CheersKurt<{POST_SNAPBACK}>Well, I'd make the GUI a bit wider than the cmd window, and make sure it was constantly centered over it. It'd involve a lot of variable math to figure out the width of the title bar and such. My idea was a bit of a resource hog, and the DLL call soloution is admittedly better. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
/dev/null Posted May 27, 2005 Posted May 27, 2005 Found a different solution. Quite nice Hm... Nothing happens on my system. What should the script do to a runningcmd.exe window? (BTW: I'm running 3.1.1.40).CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
HighGuy Posted May 28, 2005 Author Posted May 28, 2005 Hm... Nothing happens on my system. What should the script do to a runningcmd.exe window? (BTW: I'm running 3.1.1.40).<{POST_SNAPBACK}>Hi Kurt,the script works on my WinXP system. Not sure if it works on other window versions. What are you using? Maybe you can check @error of DllCalls to see if they work fine. Can you press the Exit-Button of the cmd.exe-window after running the script?
/dev/null Posted May 28, 2005 Posted May 28, 2005 the script works on my WinXP system. Not sure if it works on other window versions. What are you using? Maybe you can check @error of DllCalls to see if they work fine.Sorry, config error on my system. The script did not even execute Now everthing works fine. Nice DLL call. Could I remove the menu bar and some other controls of Internet Explorer as well?CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
scriptkitty Posted May 28, 2005 Posted May 28, 2005 Yea, you can do all sorts of things with IE.I posted some fun stuff using the new AutoIt beta:http://www.autoitscript.com/forum/index.ph...335entry82335You can control existing ones, or use it to start up a new one exactly how you like it.some properties of interext for ya:.visible = <integer>;(1 - Visible/ 0 - Not Visible).menuBar = <integer>;(1 - Visible/ 0 - Not Visible).toolBar = <integer>;(1 - Visible/ 0 - Not Visible).statusBar = <integer>;(1 - Visible/ 0 - Not Visible) AutoIt3, the MACGYVER Pocket Knife for computers.
/dev/null Posted May 30, 2005 Posted May 30, 2005 Yea, you can do all sorts of things with IE.I posted some fun stuff using the new AutoIt beta:http://www.autoitscript.com/forum/index.ph...335entry82335Great! Works like a charm... Do you know, how to do the same with firefox?ThanksKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now