Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

A transparent GUI overlaid on top of the CMD window's title bar should do the trick

Nice idea. How would you do that?

Cheers

Kurt

__________________________________________________________(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 *

Posted (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 by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Posted

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
Posted

Nice idea. How would you do that?

Cheers

Kurt

<{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

Posted

Found a different solution. Quite nice  :(

Hm... Nothing happens on my system. What should the script do to a running

cmd.exe window? (BTW: I'm running 3.1.1.40).

Cheers

Kurt

__________________________________________________________(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 *

Posted

Hm... Nothing happens on my system. What should the script do to a running

cmd.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?

Posted

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?

Cheers

Kurt

__________________________________________________________(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 *

Posted

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...335entry82335

You 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.

Posted

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...335entry82335

Great! Works like a charm...

Do you know, how to do the same with firefox?

Thanks

Kurt

__________________________________________________________(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 *

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...