Jump to content

Disable GUI, but have an ability to drag it.


 Share

Recommended Posts

Hi all,

Is there a way to actualy disable the gui, and in the same time have ability to drag it?

i mean, disable like this:

GuiSetState(@SW_DISABLE, $GuiHwnd)

But in that case, i can not drag the gui by a title, i know that this is possible with some styles, and then set a label to dragable and then disable each control... or somthing like that... and also i know that it can be done if you cover whole gui with some disabled label, but its not it, i need somthing original, somthing that will allow to drag a GUI while it's disabled.

Is this possible?

Thanks for any help.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi all,

Is there a way to actualy disable the gui, and in the same time have ability to drag it?

i mean, disable like this:

GuiSetState(@SW_DISABLE, $GuiHwnd)

But in that case, i can not drag the gui by a title, i know that this is possible with some styles, and then set a label to dragable and then disable each control... or somthing like that... and also i know that it can be done if you cover whole gui with some disabled label, but its not it, i need somthing original, somthing that will allow to drag a GUI while it's disabled.

Is this possible?

Thanks for any help.

Maybe, just maybe, disable all of the controls, and then leave the window open to be dragged? Not sure if that'll work though
Link to comment
Share on other sites

Maybe, just maybe, disable all of the controls, and then leave the window open to be dragged? Not sure if that'll work though

That's a nice idea , but if you disabling a widows gui that has default styles set , then you can't disable the title bar min,max and close controls afik. (maybe can be done via dll call.. idk for sure though)

Most the other controls you can disable though , eg: menus and butttons and such.

I've asked and researched the same question before , but never really found a straight out answer to do it.

Good luck.

Link to comment
Share on other sites

  • 3 months later...

Maybe now someone has found a solution for that one? :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I have some ideas, maybe it will work or not.

Have a check to check if MousePos() and WinActive(), if the MousePos is at Titlebar and the GUI is active, i believe you stil can make it active even the windows is disabled, and then use Larry's mouse hook, if it drags then just use WinMove() to go along with it.

Hope that helped.

Link to comment
Share on other sites

I have some ideas, maybe it will work or not.

Have a check to check if MousePos() and WinActive(), if the MousePos is at Titlebar and the GUI is active, i believe you stil can make it active even the windows is disabled, and then use Larry's mouse hook, if it drags then just use WinMove() to go along with it.

Hope that helped.

And if you do it the way Generator suggests then WIndowFromPoint might be useful because you need to be sure the window you're trying to drag is really 'seen' by the cursor.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks for the idea Generator, but the problem is, that while the gui should be disabled, there many stuff executed, so it will not help - while copying for example, the script is waiting, and therefore i can not drag the gui manual (using WinMove() ).

Maybe if there a way to do it using GuiRegistrMsg() - then it might help...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Thanks for the idea Generator, but the problem is, that while the gui should be disabled, there many stuff executed, so it will not help - while copying for example, the script is waiting, and therefore i can not drag the gui manual (using WinMove() ).

Maybe if there a way to do it using GuiRegistrMsg() - then it might help...

In that case I think you need to run another script which is just used to move the disabled one like this (not tested)

#include <GuiConstants.au3>
#Include <Misc.au3>

$GuiHwnd = WinGetHandle("Title of your disabled Gui")

 While 1
    
    If _IsPressed("01") Then
           $mp = MouseGetPos()
           $hwnd = DLLCall("user32.dll", "hwnd", "WindowFromPoint", "int", $mp[0], "int", $mp[1])
       If $hwnd[0] = $GuiHwnd Then
            $wp = WinGetPos("test")
            While _IsPressed("01")
              $np = MouseGetPos()
              WinMove("test","",$wp[0] - $mp[0] + $np[0],$wp[1] - $mp[1] + $np[1])
            WEnd
         EndIf
     EndIf
     
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Ok, i think that i has found a solution, but there is one problem that i mentioned here (there is traces of the "Controls Gui")...

#include <GuiConstants.au3>

$HostGui = GuiCreate("Test", 400, 300)
$MainGui = GuiCreate("", 400, 300, -1, -1, $WS_POPUP, BitOR($WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $HostGui)

$DisableGUI_Button = GUICtrlCreateButton("Disable GUI", 20, 60)
$CheckBoxCtrl = GUICtrlCreateCheckbox("Test CheckBox", 20, 120)
$LabelCtrl = GUICtrlCreateLabel("Some label", 20, 180, 400)

GUISetState(@SW_SHOW, $HostGui)
GUISetState(@SW_SHOW, $MainGui)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $DisableGUI_Button
            GUISetState(@SW_DISABLE, $MainGui)
            GUICtrlSetData($LabelCtrl, "Now try to drag the window ;)")
    EndSwitch
WEnd

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Ok, i think that i has found a solution, but there is one problem that i mentioned here (there is traces of the "Controls Gui")...

#include <GuiConstants.au3>

$HostGui = GuiCreate("Test", 400, 300)
$MainGui = GuiCreate("", 400, 300, -1, -1, $WS_POPUP, BitOR($WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $HostGui)

$DisableGUI_Button = GUICtrlCreateButton("Disable GUI", 20, 60)
$CheckBoxCtrl = GUICtrlCreateCheckbox("Test CheckBox", 20, 120)
$LabelCtrl = GUICtrlCreateLabel("Some label", 20, 180, 400)

GUISetState(@SW_SHOW, $HostGui)
GUISetState(@SW_SHOW, $MainGui)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $DisableGUI_Button
            GUISetState(@SW_DISABLE, $MainGui)
            GUICtrlSetData($LabelCtrl, "Now try to drag the window ;)")
    EndSwitch
WEnd

That's very neat. I'm sure I was just about to think of that myself. :)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Another crude solution to dragging a disabled window, could be tweaked a bit to get the desired result..

#include <GUIConstants.au3>

Opt("MouseCoordMode", 1)

$Gui = GuiCreate("Drag Disabled Window", 300, 100)
GUISetState(@SW_SHOW, $Gui)
GUISetState(@SW_DISABLE, $Gui)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
    WindowClicked()
WEnd

Func WindowClicked()
    $GGCI = GUIGetCursorInfo($Gui)
    $MGP = MouseGetPos()
    $WGP = WinGetPos($GUI, "")
    If $GGCI[2] = 1 And $MGP[0] >= $WGP[0] And $MGP[0] <= ($WGP[0] + $WGP[2]) _
                    And $MGP[1] >= $WGP[1] And $MGP[1] <= ($WGP[1] + $WGP[3]) Then 
        WinMove($Gui, "", $MGP[0] - 150, $MGP[1] - 50)
    EndIf   
EndFunc

Cheers

Edited by smashly
Link to comment
Share on other sites

Another crude solution to dragging a disabled window

Thanks, in that case i think it better to do it like this:

#include <GUIConstants.au3>
Opt("GuiOnEventMode", 1)

$Gui = GuiCreate("Drag Disabled Window", 300, 100)
GUISetState(@SW_SHOW, $Gui)
GUISetState(@SW_DISABLE, $Gui)

GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "DragGui")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

While 1
    Sleep(10)
WEnd

Func Quit()
    Exit
EndFunc

Func DragGui()
    Local $MousePos = MouseGetPos()
    Local $hWndPos = WinGetPos($Gui)
    Local $WinPos[2], $GuiCurInfo[5]
    
    $WinPos[0] = $MousePos[0]-$hWndPos[0]
    $WinPos[1] = $MousePos[1]-$hWndPos[1]
    
    $GuiCurInfo = GUIGetCursorInfo($Gui)
    While $GuiCurInfo[2] = 1
        $MousePos = MouseGetPos()
        $GuiCurInfo = GUIGetCursorInfo($Gui)
        WinMove($Gui, '', $MousePos[0]-$WinPos[0], $MousePos[1]-$WinPos[1])
    WEnd
EndFunc

But in fact, i wanted to title be NOT disabled, as in my previous solution(?) :P - But the problem in that solution, that the background is always (almoust) leave traces of transparent gui when draging :).

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

But the problem in that solution, that the background is always (almoust) leave traces of transparent gui when draging :).

If you do this there are no traces.

#include <GUIConstants.au3>


$HostGui = GuiCreate("Test", 400, 300)
$MainGui = GuiCreate("", 400, 300, 0, 0,$WS_POPUP)
DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($MainGui), "hwnd", WinGetHandle($HostGui))
$DisableGUI_Button = GUICtrlCreateButton("Disable GUI", 20, 60)
$CheckBoxCtrl = GUICtrlCreateCheckbox("Test CheckBox", 20, 120)
$LabelCtrl = GUICtrlCreateLabel("Some label", 20, 180, 400)

GUISetState(@SW_SHOW, $HostGui)
GUISetState(@SW_SHOW, $MainGui)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $DisableGUI_Button
            GUISetState(@SW_DISABLE, $MainGui)
            GUICtrlSetData($LabelCtrl, "Now try to drag the window wink.gif")
    EndSwitch
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks!!! it's perfect now! :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

It seems that there is just one more litle(?) problem - before i disable the Gui, i can not press any button on title bar (close/minimize etc) - the child gui is always has the focus :) - how to prevent this behaviour?

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

It seems that there is just one more litle(?) problem - before i disable the Gui, i can not press any button on title bar (close/minimize etc) - the child gui is always has the focus :) - how to prevent this behaviour?

Moving the SetParent call to after the Gui SetState commands works for me:

#include <GUIConstants.au3>


$HostGui = GuiCreate("Test", 400, 300)
$MainGui = GuiCreate("", 400, 300, 0, 0,$WS_POPUP)

$DisableGUI_Button = GUICtrlCreateButton("Disable GUI", 20, 60)
$CheckBoxCtrl = GUICtrlCreateCheckbox("Test CheckBox", 20, 120)
$LabelCtrl = GUICtrlCreateLabel("Some label", 20, 180, 400)

GUISetState(@SW_SHOW, $HostGui)
GUISetState(@SW_SHOW, $MainGui)

DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($MainGui), "hwnd", WinGetHandle($HostGui))

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $DisableGUI_Button
            GUISetState(@SW_DISABLE, $MainGui)
            GUICtrlSetData($LabelCtrl, "Now try to drag the window wink.gif")
    EndSwitch
WEnd
Link to comment
Share on other sites

Moving the SetParent call to after the Gui SetState commands works for me:

#include <GUIConstants.au3>
$HostGui = GuiCreate("Test", 400, 300)
$MainGui = GuiCreate("", 400, 300, 0, 0,$WS_POPUP)

$DisableGUI_Button = GUICtrlCreateButton("Disable GUI", 20, 60)
$CheckBoxCtrl = GUICtrlCreateCheckbox("Test CheckBox", 20, 120)
$LabelCtrl = GUICtrlCreateLabel("Some label", 20, 180, 400)

GUISetState(@SW_SHOW, $HostGui)
GUISetState(@SW_SHOW, $MainGui)

DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($MainGui), "hwnd", WinGetHandle($HostGui))

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $DisableGUI_Button
            GUISetState(@SW_DISABLE, $MainGui)
            GUICtrlSetData($LabelCtrl, "Now try to drag the window wink.gif")
    EndSwitch
WEnd

That works, but the Gui still looks disabled when it doesn't have focus and it looks wrong to me.

This approach also works, but MsCreatoR you might not like the time used by the AdLibEnable

#include <GUIConstants.au3>
#Include <Misc.au3>

$HostGui = GuiCreate("Test", 400, 300)

$DisableGUI_Button = GUICtrlCreateButton("Disable GUI", 20, 60)
$CheckBoxCtrl = GUICtrlCreateCheckbox("Test CheckBox", 20, 120)
$LabelCtrl = GUICtrlCreateLabel("Some label", 20, 180, 400)

AdlibEnable("MoveMe",200)
GUISetState(@SW_SHOW, $HostGui)
$disabled = False

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $DisableGUI_Button
            $disabled = True
            GUISetState(@SW_DISABLE, $HostGui)
            GUICtrlSetData($LabelCtrl, "Now try to drag the window")
    EndSwitch
WEnd



Func MoveMe()
    If Not $disabled Then Return
    if _IsPressed("01") Then
        $mp = MouseGetPos()
        $hwnd = DLLCall("user32.dll", "hwnd", "WindowFromPoint", "int", $mp[0], "int", $mp[1])
        If $hwnd[0] = $HostGui Then
            $wp = WinGetPos("Test")
            While _IsPressed("01")
                $np = MouseGetPos()
                WinMove("Test","",$wp[0] - $mp[0] + $np[0],$wp[1] - $mp[1] + $np[1])
            WEnd
        EndIf
    EndIf
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Moving the SetParent call to after the Gui SetState commands works

Thanks, but not after all states, like this is better:

GUISetState(@SW_SHOW, $HostGui)
DllCall("user32.dll", "int", "SetParent", "hwnd", $MainGui, "hwnd", $HostGui)
GUISetState(@SW_SHOW, $MainGui)

That way nothing is jumping up :)

Thanks a lot!

but MsCreatoR you might not like the time used by the AdLibEnable

And also the _IsPressed() :P

But thanks anyway, all that works, but besides moving the window, in my script there many stuff executed, so it must be as much simple as it can be.

Thank to all, the problem is solved i think!

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
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
 Share

  • Recently Browsing   0 members

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