Jump to content

Problem with multiple GUI's... [SOLVED]


Recommended Posts

Hello everyone!

I already read https://www.autoitscript.com/wiki/Managing_Multiple_GUIs

But I can't make the first GUI receive the actions from the second...Before trying advanced GuiGetMsg , I created a .exe and tried to call him from the main GUI... But the problem is:

1 - When I execute the exe myself he locate the external program executable and add a drag and drop area, everything works fine, the drop area and the right click menu...

2 - When I call him inside main script with run, the drop area stop working...The right click menu still there, the tip, the close the external program when exit works fine, but the drop message is gone... It seens not working...

I need help to acomplish the task with one of the options...Help to find out why the second GUI is not detected by advanced GuiGetMsg(1) , or why just de drag and drop stoped when calling an exe from script... I tried a lot before come here ask for help...I'm running out of options! I'll try a little more meanwhile!

Thanks in advance! And a nice day for everybody!

 

Edited by edumanilha
typo
Link to comment
Share on other sites

  • Moderators

@edumanilha there is a lot of example code on that wiki page. How about helping us help you by posting exactly the code you're trying to get working?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

1 hour ago, JLogan3o13 said:

@edumanilha there is a lot of example code on that wiki page. How about helping us help you by posting exactly the code you're trying to get working?

Hi @JLogan3o13 , indeed... The script look like this:

 

while 1
$aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
Switch $aMsg[1]; check which GUI sent the message
    Case $hGUI Or $hGUI2 Or $hGUI3 Or $hGUI4

        Switch $aMsg[0]

                Case blablabla
                    do this
                    do that             
                    Open PuTTY session
                    _GUIPUTTY(); drag and drop and right click menu over the PuTTY window
                
                Case hocuspocus
                    etc
                    etc
                
        EndSwitch

    Case $GUIPUTTY
        Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                WinClose("[CLASS:PuTTY]")
                Exit
                Case $GUI_EVENT_SECONDARYDOWN
                                    Local $MenuButtonsArray[5] = ["Copiar Bemasat.xml", "Copiar config.properties", "teste","teste","Reboot"]
                                    ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
                                    Local $MenuSelect = _Metro_RightClickMenu($GUIPUTTY, 150, $MenuButtonsArray)
                                            Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
                                                Case "0"
                                                Case "1"
                                                Case "2"
                                                Case "3"
                                                Case "4"
                                                    $ret = _SSHSend( $ConnectedSocket , "Reboot" &@crlf)
                                            EndSwitch

                Case $GUI_EVENT_PRIMARYDOWN
                Case $GUI_EVENT_DROPPED
                    MsgBox($MB_TOPMOST, "","File accepted!" & @GUI_DragFile)

        EndSwitch
EndSwitch
WEnd

 

the function:
 

Func _GUIPUTTY()

Global $PuTTY = WinGetHandle("[CLASS:PuTTY]")

$GUIPUTTY = GUICreate("Connect Helper", 200, 430, Default ,Default,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_ACCEPTFILES),$PuTTY)


WinMove($GUIPUTTY,"",@DesktopWidth/2 - 342,@DesktopHeight/2 - 215,200,430)

                Global $InsertFile = GUICtrlCreateLabel("", 50, 310, 100, 100,-1,$WS_EX_STATICEDGE)
                GUICtrlSetState ($InsertFile, $GUI_DROPACCEPTED)
                GUICtrlSetTip ($InsertFile, "Drag files here to send!" & @CRLF & @CRLF & "Right click for menu!" )
                GUICtrlSetBkColor($InsertFile,0xFFFFFF)

GUISetState()
WinSetTrans($GUIPUTTY,"",40)
GUISetControlsVisible($GUIPUTTY)

WinMove($PuTTY,"",@DesktopWidth/2 - 350,@DesktopHeight/2 - 215,708,438)
sleep(200)


Global $MainPos = WinGetPos("[CLASS:PuTTY]")
$iX1 = $MainPos[0]
$iY1 = $MainPos[1]
$iX2 = $iX1
$iY2 = $iY1


EndFunc

The main and second GUI show UP, in the second I have right click but the event dropped don't trigger...And the cases work fine for main GUI...

 

 

in the example look like this:

The main GUI inside a function that have the loop...I tried like this, and with the main GUI ouside a function, before the loop...

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Global $g_hGUI2 = 9999, $g_idButton3 ; Predeclare the variables with dummy values to prevent firing the Case statements, only for GUI this time

gui1()

Func gui1()
    Local $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)
    Local $idButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30)
    Local $idButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)
    GUISetState()

    Local $aMsg 
    While 1
        $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array

Thanks for your support! :)

Edited by edumanilha
typo
Link to comment
Share on other sites

generally you have to do it like this

While 1
        $nMsg = GUIGetMsg(1)
        Switch $nMsg[1]
            Case $GUI
                Switch $nMsg[0]
                    Case $GUI_EVENT_PRIMARYDOWN
                    Case $GUI_EVENT_CLOSE
                        Exit
                    Case $GUI_EVENT_MINIMIZE, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
                EndSwitch
            Case $GUI1
                Switch $nMsg[0]
                    Case $GUI_EVENT_CLOSE
                EndSwitch
            Case $GUI2
                Switch $nMsg[0]
                    Case $GUI_EVENT_CLOSE
                EndSwitch
            Case $GUI3
                Switch $nMsg[0]
                    Case $GUI_EVENT_CLOSE
                EndSwitch
            Case $GUI4
                Switch $nMsg[0]
                    Case $GUI_EVENT_CLOSE
                EndSwitch
        EndSwitch
    WEnd

sadly you didn't post an executable script... i tried to put it together ... so my answer could be more specific

EDIT: something is weird in your posted script... you created a $hgui1 and in the case there is just a $hgui :o 

also you call the function of _GUIputty() with your first gui

you should declare your globals first and return the handle of _GUIputty() to set it or you could start the GUIputty before the GUI1 func and hide it until it will be needed ... i often had much problems with create a GUI inside another,too

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

1 minute ago, Aelc said:
Quote

generally you have to do it like this

sadly you didn't post an executable script... i tried to put it together ... so my answer could be more specific

Hello @Aelc , the first checks are not my problem...I did the "Or" to avoid multiples checks and dispensable lines, and because I found in the forum this can be done like this...

But thanks for your answer!

I didn't posted a executable script because its too big and have some UDF's...

Link to comment
Share on other sites

2 minutes ago, edumanilha said:

Hello @Aelc , the first checks are not my problem...I did the "Or" to avoid multiples checks and dispensable lines, and because I found in the forum this can be done like this...

But thanks for your answer!

I didn't posted a executable script because its too big and have some UDF's...

true the OR shouldnt be the problem ... i believe it's a long script. all i need is an executeable overview  :P i actually can't figure out what happens wrong cause i would have to change so much to make it runable

13 minutes ago, Aelc said:

EDIT: something is weird in your posted script... you created a $hgui1 and in the case there is just a $hgui :o 

also you call the function of _GUIputty() with your first gui

you should declare your globals first and return the handle of _GUIputty() to set it or you could start the GUIputty before the GUI1 func and hide it until it will be needed ... i often had much problems with create a GUI inside another,too

 

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

1 minute ago, Aelc said:

true the OR shouldnt be the problem ... i believe it's a long script. all i need is an executeable overview  :P i actually can't figure out what happens wrong cause i would have to change so much to make it runable

 

Sorry I didn't saw you edit, I was typing the time you did... This hGUI1 thing is about the wiki example, not my actual script...

my first tries was calling the func from my main GUI...I can try to modify again and test...

I tried to open GUIPUTTY together with the others using HIDE and then SHOW, when I needed too, can be done...But when I tried that way script didn't work too...

The main problem is that I can't call the GUI with functional right click menu and the dropaccepted... :(

Only scenario everything worked is calling the .exe with the complete script stand alone...But when I try to call this exe using "run" the only thing working is right click menu, the darg and drop stops... I don't know what I'm doing wrong...
 

Link to comment
Share on other sites

13 minutes ago, Aelc said:

true the OR shouldnt be the problem ... i believe it's a long script. all i need is an executeable overview  :P i actually can't figure out what happens wrong cause i would have to change so much to make it runable

 

I'll try to resume so you can have some idea whats is happening...

Link to comment
Share on other sites

$WS_EX_STATICEDGE is the problem i guess ... i tried to run just the single putty func and it don't run with it. if i delete it it works pretty fine

 

from helpfile 

Quote
$WS_EX_STATICEDGE |0x00020000  Creates a window [...] to be used for items that do not accept user input.

 

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

56 minutes ago, Aelc said:

true the OR shouldnt be the problem ... i believe it's a long script. all i need is an executeable overview  :P i actually can't figure out what happens wrong cause i would have to change so much to make it runable

 

here the cleaned up script...I did some more tests with this resumed script...same result!

All the main GUI's inside a function like the wiki example, and all the Main GUi's before the loop and the second GUI been called like a function...

@Aelc can you do a putty session? first thing he looks is for a running putty session...

test.zip

Link to comment
Share on other sites

10 minutes ago, Aelc said:

$WS_EX_STATICEDGE is the problem i guess ... i tried to run just the single putty func and it don't run with it. if i delete it it works pretty fine

Oh god...All the trouble for this? I'll try here!

 

EDIT: Didn't work... What you did? I think someone used this to prevent user write things down in the field...Its not supposed to block the right click and the drop...My stand alone exe works fine with this parameter...

Edited by edumanilha
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <windowsConstants.au3>

Global $g_hGUI2 = 9999, $g_idButton3 ; Predeclare the variables with dummy values to prevent firing the Case statements, only for GUI this time

_GUIPUTTY()

Func _GUIPUTTY()

Global $PuTTY = WinGetHandle("[CLASS:PuTTY]")

$GUIPUTTY = GUICreate("Connect Helper", 200, 430, Default ,Default,$WS_POPUP,$WS_EX_ACCEPTFILES)

                Global $InsertFile = GUICtrlCreateLabel("", 50, 310, 100, 100,-1,)
                GUICtrlSetState ($InsertFile, $GUI_DROPACCEPTED)
                GUICtrlSetTip ($InsertFile, "Drag files here to send!" & @CRLF & @CRLF & "Right click for menu!" )
                GUICtrlSetBkColor($InsertFile,0xFFFFFF)

GUISetState()
WinSetTrans($GUIPUTTY,"",40)
WinMove($PuTTY,"",@DesktopWidth/2 - 350,@DesktopHeight/2 - 215,708,438)
sleep(200)


Global $MainPos = WinGetPos("[CLASS:PuTTY]")
$iX1 = $MainPos[0]
$iY1 = $MainPos[1]
$iX2 = $iX1
$iY2 = $iY1

While 1
$nmsg = GUIGetMsg ()
Switch $nmsg
            Case $GUI_EVENT_DROPPED
                MsgBox ( 64,"",@GUI_DragFile )
        EndSwitch
WEnd

EndFunc

thats what i tried... if you add the $WS_EX_STATICEDGE the msgbox doesnt appear anymore

i will take a look on your testscript

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

well im wondered but seems like it's rly the OR in the Case of loop

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_LegalCopyright=Eduardo.Pavão
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****


Global $ConnectedSocket[7] = [-1,-1,-1,-1,-1,-1,-1]
Global $Auth[7] = [0,0,0,0,0,0,0]
Global $Filial,$SplashGUIlogo,$SplashGUIlogoback,$CloseGUI,$end,$msg, $recv, $ret,$endpos,$endposcloseinfo,$endposxinfo,$endposxclose , $endposxmini, $endposycloseinfo, $midposxclose,$midposxinfo,$hideclose,$hideinfo,$onover
Global $msg, $recv, $ret,$moveright,$mTray,$mTrayX,$mTrayY,$mTram,$aMainPos,$hGUI,$hGUI2,$hGUI3,$hGUI4,$b,$Mute,$GUIPUTTY,$aMsg
Local $menu = 0


Global $aMainPos = WinGetPos($hGUI)
;WinMove($hGUI2, '', $aMainPos[0]+$aMainPos[2], $aMainPos[1])
;WinMove($hGUI3, '', $aMainPos[0]+$aMainPos[2], $aMainPos[1])
;WinMove($hGUI4, '', $aMainPos[0]+$aMainPos[2], $aMainPos[1])
;WinMove($hGUI2, '', $aMainPos[0]+$aMainPos[2], $aMainPos[1])

Opt("WinTitleMatchMode",2);busca parte do nome
Opt("TrayOnEventMode", 1)
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 3); The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.
Opt("TrayIconHide", 1)

;AutoItSetOption("GUICloseOnESC",0);não fecha com esc

;#NoTrayIcon
#RequireAdmin
#include-once
#include <AutoItConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GDIPlus.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <Constants.au3>
#include <GUIConstants.au3>
#include <GUIMenu.au3>
#include <WinAPI.au3>
#include <FontConstants.au3>
#include <Misc.au3>
#include "MetroGUI-UDF\MetroGUI_UDF.au3"

_GDIPlus_Startup()

$hGUI = GUICreate("GUI", 700, 300, Default, Default, $WS_POPUP,$WS_EX_TOOLWINDOW)

$ButtonStrgA = GUICtrlCreateDummy()
Local $accelerators[1][2]
    $accelerators[0][0] = "{ESC}"
    $accelerators[0][1] = $ButtonStrgA
GUISetAccelerators($accelerators)

GUISetState()
GUISetControlsVisible($hGUI)


;GUI2 botões flutuantes
;======================================================================================================================================================================
$hGUI2 = GUICreate("GUI", 700, 300, Default, Default, $WS_POPUP,$WS_EX_TOOLWINDOW, $hGUI)
GUISetState()
GUISetControlsVisible($hGUI2)


;GUI3 botões
;======================================================================================================================================================================

$hGUI3 = GUICreate("GUI3", 700, 300, Default, Default, $WS_POPUP,$WS_EX_TOOLWINDOW)

Global $buttoncx = GUICtrlCreateButton ("button 1", 65,65 , 110, 170, $BS_BITMAP)
GUICtrlSetImage ($buttoncx, @ScriptDir & "\Dados\Imagens\caixa.bmp")
GUICtrlSetTip(-1, "Conectar em PDV.")
;GUICtrlSetOnEvent(-1, "caixa")

;botão 2 atm
Global $buttonatm = GUICtrlCreateButton ("button 2", 195, 65, 110, 170, $BS_BITMAP)
GUICtrlSetImage ($buttonatm, @ScriptDir & "\Dados\Imagens\atm.bmp")
GUICtrlSetTip(-1, "Conectar em ATM/CONECTA.")
;GUICtrlSetOnEvent(-1, "atm")

;botão 3 mobile
Global $buttonmbl = GUICtrlCreateButton ("button 3", 325, 65, 110, 170, $BS_BITMAP)
GUICtrlSetImage ($buttonmbl, @ScriptDir & "\Dados\Imagens\mobile.bmp")
GUICtrlSetTip(-1, "Conectar em MOBILE SERVER.")
;GUICtrlSetOnEvent(-1, "mobile")

GUISetState()
GUISetControlsVisible($hGUI3)


$hGUI4 = GUICreate("GUI4", 700, 300, Default, Default, $WS_POPUP,BitOR($WS_EX_TOOLWINDOW, $GUI_WS_EX_PARENTDRAG))


GUISetState()
GUISetControlsVisible($hGUI4)



While 1



$aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
Switch $aMsg[1]; check which GUI sent the message
    Case $hGUI3

        ;Switch GUIGetMsg()
        Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $idOK
                        ;MsgBox($MB_TOPMOST, ""," teste saida função")
                        Exit
                Case $ButtonStrgA;accelerator ESC para minimizar
;~                      _MinimizeToTray()
            Case $GUI_EVENT_PRIMARYDOWN
                ;MsgBox($MB_TOPMOST, ""," cursor")
                Case $GUI_EVENT_RESTORE
                Case $buttoncx
                                            Local $MenuButtonsArray[1] = ["test"]
                                            ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
                                            Local $MenuSelect = _Metro_RightClickMenu($hGUI3, 100, $MenuButtonsArray)
                                                    Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
                                                            Case "0"
                                                            _GUIPUTTY()

                                                    EndSwitch
                Case $buttonatm

                Case $buttonmbl

            EndSwitch

    Case $GUIPUTTY
            Switch $aMsg[0]
                ;Exit
                ;WinClose("[CLASS:PuTTY]")
                Case $GUI_EVENT_CLOSE
                WinClose("[CLASS:PuTTY]")
                   Exit
                Case $GUI_EVENT_SECONDARYDOWN
                                    Local $MenuButtonsArray[5] = ["Copy file 1", "Copy file 2", "teste","teste","Reboot"]
                                    ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
                                    Local $MenuSelect = _Metro_RightClickMenu($GUIPUTTY, 150, $MenuButtonsArray)
                                            Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
                                                Case "0"
                                                Case "1"
                                                Case "2"
                                                Case "3"
                                                Case "4"
                                            EndSwitch

                Case $GUI_EVENT_PRIMARYDOWN
                ;   _SendMessage($GUIPUTTY, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
                Case $GUI_EVENT_DROPPED
                    MsgBox($MB_TOPMOST, "","Arquivo aceito!" & @GUI_DragFile)
                    ;GUICtrlSetData(@GUI_DropId, @GUI_DragFile)
                ;Case $GUISize

            EndSwitch
EndSwitch
WEnd



;======================================================================================================================================================================
Func _WM_LBUTTONDOWN($hWnd, $iMsg, $iwParam, $ilParam)
    $Clicked = WinGetTitle($hWnd)
    if $Clicked = "Minimize" then
        ;GUISetState(@SW_MINIMIZE, $hGUI)
;~                                              _MinimizeToTray()
    endif

    if $Clicked = "Close" then
        ;MsgBox($MB_SYSTEMMODAL, "dados", "vc clicou em fechar")
        Exit
    endif

    if $Clicked = "Riachuelo" then
        MsgBox($MB_SYSTEMMODAL, "dados", "vc clicou na riachuelo")
        ;Exit
    endif

    If $Clicked = "Info" then
        ;Disable_GUI()
        _Metro_MsgBox(0,"                                Informação!", "Acesse o ícone na bandeja do sistema para informações e ajuda!", 400, 11)
        ;Enable_GUI()
    EndIf
EndFunc

;======================================================================================================================================================================
Func GUISetControlsVisible($hWnd)
    Local $aM_Mask, $aCtrlPos, $aMask

    $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1))

    For $i = 3 To $aLastID[0]
        $aCtrlPos = ControlGetPos($hWnd, '', $i)
        If Not IsArray($aCtrlPos) Then ContinueLoop

        $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _
            "long", $aCtrlPos[0], _
            "long", $aCtrlPos[1], _
            "long", $aCtrlPos[0] + $aCtrlPos[2], _
            "long", $aCtrlPos[1] + $aCtrlPos[3])
        DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2)
    Next
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1)
EndFunc

Func _SetBitmap($hGUI, $hImage, $iOpacity)
    ;Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend

    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    ;DllStructSetData($tSize, "X", $n_width)
    ;DllStructSetData($tSize, "Y", $n_height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
    _GDIPlus_ImageDispose($hImage)
EndFunc   ;==>_SetBitmap

Func RemoveExtRegExp($Input)
    Return StringRegExpReplace($Input, "\.[^.]*$", "")
EndFunc

Func RemoveExt($MenuButtonsArray)
;~     Local $ExtArray = StringSplit($MenuButtonsArray[$i], ".")
;~     Return StringReplace($MenuButtonsArray[$i], "." & $ExtArray[$ExtArray[0]], "", -1)
EndFunc

;mouse over GUI
;======================================================================================================================================================================
Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)   ;==>WM_MOUSEMOVE
    $Over = WinGetTitle($hWnd)

If $Over = "Riachuelo" then
;~  _ToolTip("Olá! Mais informações na bandeja!",1000);mensagem e timeout
    sleep(10)
EndIf


EndFunc

Func WM_MOUSELEAVE($hWnd, $iMsg, $wParam, $lParam)   ;==>WM_MOUSELEAVE
$Over = WinGetTitle($hWnd)

If $Over <> "Riachuelo" then
    ToolTip("")
EndIf
            ;MsgBox($MB_SYSTEMMODAL, "", "deixou")
    ;$Over = WinGetTitle($hWnd)
EndFunc



Func Disable_GUI()
    GUISetState(@SW_DISABLE, $hGUI)
    GUISetState(@SW_DISABLE, $hGUI2)
    GUISetState(@SW_DISABLE, $hGUI3)
    GUISetState(@SW_DISABLE, $hGUI4)
;~  GUISetState(@SW_DISABLE, $LabelGUI)
;~  GUISetState(@SW_DISABLE, $LabelGUI2)
    GUISetState(@SW_DISABLE, $SplashGUIlogo)
EndFunc

Func Enable_GUI()
    GUISetState(@SW_ENABLE, $hGUI)
    GUISetState(@SW_ENABLE, $hGUI2)
    GUISetState(@SW_ENABLE, $hGUI3)
    GUISetState(@SW_ENABLE, $hGUI4)
;~  GUISetState(@SW_ENABLE, $LabelGUI)
;~  GUISetState(@SW_ENABLE, $LabelGUI2)
    GUISetState(@SW_ENABLE, $SplashGUIlogo)
EndFunc

Func WM_PAINT($hWnd,$iMsg,$wParam,$lParam)
_WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW)
;Your Code must lie in it
_WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)

_WinAPI_RedrawWindow($hGUI2, 0, 0, $RDW_UPDATENOW)
;Your Code must lie in it
_WinAPI_RedrawWindow($hGUI2, 0, 0, $RDW_VALIDATE)

_WinAPI_RedrawWindow($hGUI3, 0, 0, $RDW_UPDATENOW)
;Your Code must lie in it
_WinAPI_RedrawWindow($hGUI3, 0, 0, $RDW_VALIDATE)

_WinAPI_RedrawWindow($hGUI4, 0, 0, $RDW_UPDATENOW)
;Your Code must lie in it
_WinAPI_RedrawWindow($hGUI4, 0, 0, $RDW_VALIDATE)
Return 'GUI_RUNDEFMSG'
EndFunc

Func _GUIPUTTY()

Global $PuTTY = WinGetHandle("[CLASS:PuTTY]")

$GUIPUTTY = GUICreate("Connect Helper", 200, 430, Default ,Default,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_ACCEPTFILES),$PuTTY)


;WinMove($GUIPUTTY,"",@DesktopWidth/2 - 342,@DesktopHeight/2 - 215,200,430)

                Global $InsertFile = GUICtrlCreateLabel("", 50, 310, 100, 100,-1,$ws_ex_STATICEDGE)
                GUICtrlSetState ($InsertFile, $GUI_DROPACCEPTED)
                GUICtrlSetTip ($InsertFile, "Arraste arquivos aqui para enviar!" & @CRLF & @CRLF & "Clique direito para menu!" )
                GUICtrlSetBkColor($InsertFile,0xFFFFFF)


GUISetState()
WinSetTrans($GUIPUTTY,"",40)
GUISetControlsVisible($GUIPUTTY)

WinMove($PuTTY,"",@DesktopWidth/2 - 350,@DesktopHeight/2 - 215,708,438)
sleep(200)


Global $MainPos = WinGetPos("[CLASS:PuTTY]")
$iX1 = $MainPos[0]
$iY1 = $MainPos[1]
$iX2 = $iX1
$iY2 = $iY1


EndFunc

this works for me

btw my bad it looks like the $WS_EX_STATICEDGE doesn't matter

but i learned from it :)

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

3 minutes ago, edumanilha said:

Ok, I'll try like this...But still got only right click menu...Drag and drop still disabled...

thats weird... do you use WIN7 OR 10?

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

3 minutes ago, Aelc said:

thats weird... do you use WIN7 OR 10?

10...Buts thats strange as I said before when I try the stand alone exe, works fine...The only difference between them that I can Think, is that the main gui use #requireadmin...

 

EDIT: NOOOOOOOO!!! It's the requireadmin....OMG...

Edited by edumanilha
add info
Link to comment
Share on other sites

i just read in a german forum about it. i use win7 that's why it works i guess.

someone had problems with it,too 

try to should down the UAC (to lowest) and delete #requireadmin and give it a try

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Link to comment
Share on other sites

12 minutes ago, Aelc said:

there is another way around to hold #requireadmin

 

best regards

I was about to ask, because I need to block users input at some point of the script!

Man! Thank you very much! I changed the "OR" for "comas", and put the _ChangeWindowMessageFilterExchange from the thread you show me, into the drag and drop GUI to bypass requireadmin! Thank you very much for your time and help again! Everything seens to be working fine now! I just need to put some align and movement checks an the others functions, but I think I can go from here! You have helped me a lot!!!




 

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