Jump to content
Sign in to follow this  
AdmiralAlkex

Is it possible to turn off the ability to minimise/maximise/shutdown/resise and move windows?

Recommended Posts

AdmiralAlkex

I am making a script that uses Holgers "SetWindowLong and SetParent method" to run a application in my gui and i really need the application to just be there like frozen but still "on" and accepting commands.

So is it like possible to turn off the ability to minimise/maximise/shutdown/resise and move windows??

Share this post


Link to post
Share on other sites
herewasplato

I am making a script that uses Holgers "SetWindowLong and SetParent method" to run a application in my gui and i really need the application to just be there like frozen but still "on" and accepting commands.

So is it like possible to turn off the ability to minimise/maximise/shutdown/resise and move windows??

Work thru this thread:

http://www.autoitscript.com/forum/index.ph...st&p=206064

I've not used the code, so I don't know what problems still remain.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
AdmiralAlkex

Work thru this thread:

http://www.autoitscript.com/forum/index.ph...st&p=206064

I've not used the code, so I don't know what problems still remain.

thx for this, it looks really interesting maybe even the solution to my problem!!

Share this post


Link to post
Share on other sites
AdmiralAlkex

I tried incorporating the code from the link you gave me into my code and nothing happens..... also i dont know how to build in the "SWP_NOMOVE / SWP_NOSIZE"...... Can someone plz help me??

#include <GUIConstants.au3>

$hGUI = GUICreate("DosCommandsMenu by Alexander Samuelsson", 1014, 732, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
WinMove("DosCommandsMenu by Alexander Samuelsson", "", "0", "0")

$PID    = Run("cmd.exe", "", @SW_HIDE)
$hWnd   = 0
$stPID  = DllStructCreate("int")

Do
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0

$stPID = 0

If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI) 
    WinSetState($hWnd, "", @SW_SHOW)
    WinMove($hWnd, "", 0, 0, 669, 400)
EndIf

GUISetState()

AutoItSetOption("WinTitleMatchMode", 2)
$calcHwnd = WinGetHandle("cmd.exe")
AutoItSetOption("WinTitleMatchMode", 1)

Global Const $SC_CLOSE = 0xF060
Global Const $SC_MINIMIZE = 0xF020
Global Const $SC_MAXIMIZE = 0xF030;
Global Const $SC_RESTORE = 0xF120

$menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MINIMIZE, "int", 0x0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MAXIMIZE, "int", 0x0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_RESTORE, "int", 0x0)

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
WEnd

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.