Sign in to follow this  
Followers 0
Slym

Dragging window with complex GUI

13 posts in this topic

Hi there,

I'm trying to find a way to make my GUI draggable.

My GUI is composed of two components :

  • $GUI : contains the background PNG image
  • $CONTROL_GUI : contains the controls and some others PNG images (not shown in archive)

When only control_gui is draggable then only the controls are moving and not the background image.

When gui is draggable then everything moves (controls and background) but I lose focus on my control_gui.

I attached a simplified example.

Press ESC to terminate the example attached.

Thank you in advance for your help.

Global $GUI, $CONTROL_GUI, $EXIT_BUTTON

; Global variables for Graphical Part
Global Const $LWA_ALPHA = 0x2
Global Const $LWA_COLORKEY = 0x1


#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinApi.au3>
#include <GDIPlus.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <File.au3>

Opt("GUIOnEventMode", 1)

_GDIPlus_Startup()
$PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\GUI.png")


$GUI = GUICreate("LiLi USB Creator", 450, 750, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

SetBitmap($GUI, $PNG_GUI, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState(@SW_SHOW, $GUI)
$LAYERED_GUI_CORRECTION = GetVertOffset($GUI)
$CONTROL_GUI = GUICreate("LiLi USB Creator", 450, 750, 0, $LAYERED_GUI_CORRECTION, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

HotKeySet("{ESC}", "Terminate")


; Offset for applied on every items
$offsetx0 = 27
$offsety0 = 23

; Label of Step 1
GUICtrlCreateLabel("ETAPE 1 : CHOISIR LA CLE", 28 + $offsetx0, 108 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")

GUISetBkColor(0x121314)
_WinAPI_SetLayeredWindowAttributes($CONTROL_GUI, 0x121314)

GUISetState(@SW_SHOW, $CONTROL_GUI)

$ZEROGraphic = _GDIPlus_GraphicsCreateFromHWND($CONTROL_GUI)
GUISetState(@SW_SHOW, $CONTROL_GUI)


; Main part
While 1
    Sleep(1000)
WEnd


Func Terminate()
    Exit 0
EndFunc

LiLi Bug.zip


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have added some code to do what I think you need. I also altered the window $CONTROL_GUI so that I could see it.

The parts I added have been marked <--------------

Global $GUI, $CONTROL_GUI, $EXIT_BUTTON

; Global variables for Graphical Part
Global Const $LWA_ALPHA = 0x2
Global Const $LWA_COLORKEY = 0x1


#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinApi.au3>
#include <GDIPlus.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <File.au3>

Global Const $WM_ENTERSIZEMOVE = 0x231, $WM_EXITSIZEMOVE = 0x232;<---------------
Global $RelPos[2];<----------------------------------------------------------------------------------------
Opt("GUIOnEventMode", 1)

_GDIPlus_Startup()
$PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\GUI.png")


$GUI = GUICreate("LiLi USB Creator", 450, 750, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

SetBitmap($GUI, $PNG_GUI, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUIRegisterMsg($WM_ENTERSIZEMOVE, "setrelpos");<-------------------------
GUIRegisterMsg($WM_MOVE, "followme");<----------------------------------------
GUISetState(@SW_SHOW, $GUI)
$LAYERED_GUI_CORRECTION = GetVertOffset($GUI)
$CONTROL_GUI = GUICreate("LiLi USB Creator", 450, 750, 0, $LAYERED_GUI_CORRECTION);, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI);<-------change back

HotKeySet("{ESC}", "Terminate")


; Offset for applied on every items
$offsetx0 = 27
$offsety0 = 23

; Label of Step 1
GUICtrlCreateLabel("ETAPE 1 : CHOISIR LA CLE", 28 + $offsetx0, 108 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")

GUISetBkColor(0x121314)
_WinAPI_SetLayeredWindowAttributes($CONTROL_GUI, 0x121314)

GUISetState(@SW_SHOW, $CONTROL_GUI)

$ZEROGraphic = _GDIPlus_GraphicsCreateFromHWND($CONTROL_GUI)
GUISetState(@SW_SHOW, $CONTROL_GUI)


; Main part
While 1
    Sleep(1000)
WEnd


Func followme($hW, $iM, $wp, $lp);<---------------------------------------

    If $hW <> $GUI Then Return
    Local $xpos = BitAND($lp, 0xffff)
    Local $ypos = BitShift($lp, 16)
    Local $xypos = WinGetPos($GUI)
    WinMove($CONTROL_GUI, "", $xypos[0] - $RelPos[0], $xypos[1] - $RelPos[1])

EndFunc ;==>followme


Func SetRelPos($hW, $iM, $wp, $lp);<-----------------------------------------------

    If $hW <> $GUI Then Return

    Local $gpp = WinGetPos($GUI)
    Local $gsp = WinGetPos($CONTROL_GUI)

    $RelPos[0] = $gpp[0] - $gsp[0]
    $RelPos[1] = $gpp[1] - $gsp[1]


EndFunc ;==>SetRelPos


Func Terminate()
    Exit 0
EndFunc ;==>Terminate


; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
; ///////////////////////////////// Graphical Part  ///////////////////////////////////////////////////////////////////////////////
; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



Func GetVertOffset($hgui)
    ;Const $SM_CYCAPTION = 4
    Const $SM_CXFIXEDFRAME = 7
    Local $wtitle, $wclient, $wsize, $wside, $ans, $AC_SRC_ALPHA = 1
    $wclient = WinGetClientSize($hgui)
    $wsize = WinGetPos($hgui)
    $wtitle = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYCAPTION)
    $wside = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXFIXEDFRAME)
    $ans = $wsize[3] - $wclient[1] - $wtitle[0] - 2 * $wside[0] + 25
    Return $ans
EndFunc ;==>GetVertOffset

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then
    Return $HTCAPTION
    EndIf
EndFunc ;==>WM_NCHITTEST

Func SetBitmap($hgui, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend, $AC_SRC_ALPHA = 1

    $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))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _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)
EndFunc ;==>SetBitmap

;############# EndExample #########

;===============================================================================
;
; Function Name: _WinAPI_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Transparent color
; $Transparency - Set Transparancy of GUI
; $isColorRef - If True, $i_transcolor is a COLORREF( 0x00bbggrr ), else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed - use
; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s): Prog@ndy
;
; Link : @@MsdnLink@@ SetLayeredWindowAttributes
; Example : Yes
;===============================================================================
;
Func _WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; #############################################
    ; You are NOT ALLOWED to remove the following lines
    ; Function Name: _WinAPI_SetLayeredWindowAttributes
    ; Author(s): Prog@ndy
    ; #############################################
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03

    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hWnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, _WinAPI_GetLastError(), 0)
    Case Else
    Return 1
    EndSelect
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

;===============================================================================
;
; Function Name: _WinAPI_GetLayeredWindowAttributes
; Description:: Gets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Returns Transparent color ( dword as 0x00bbggrr or string "0xRRGGBB")
; $Transparency - Returns Transparancy of GUI
; $isColorRef - If True, $i_transcolor will be a COLORREF( 0x00bbggrr ), else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: Usage of LWA_ALPHA and LWA_COLORKEY (use BitAnd)
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed
; - use _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; - @extended contains _WinAPI_GetLastError
; Author(s): Prog@ndy
;
; Link : @@MsdnLink@@ GetLayeredWindowAttributes
; Example : Yes
;===============================================================================
;
Func _WinAPI_GetLayeredWindowAttributes($hWnd, ByRef $i_transcolor, ByRef $Transparency, $asColorRef = False)
    ; #############################################
    ; You are NOT ALLOWED to remove the following lines
    ; Function Name: _WinAPI_SetLayeredWindowAttributes
    ; Author(s): Prog@ndy
    ; #############################################
    $i_transcolor = -1
    $Transparency = -1
    Local $Ret = DllCall("user32.dll", "int", "GetLayeredWindowAttributes", "hwnd", $hWnd, "long*", $i_transcolor, "byte*", $Transparency, "long*", 0)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, _WinAPI_GetLastError(), 0)
    Case Else
    If Not $asColorRef Then
    $Ret[2] = Hex(String($Ret[2]), 6)
    $Ret[2] = '0x' & StringMid($Ret[2], 5, 2) & StringMid($Ret[2], 3, 2) & StringMid($Ret[2], 1, 2)
    EndIf
    $i_transcolor = $Ret[2]
    $Transparency = $Ret[3]
    Return $Ret[4]
    EndSelect
EndFunc ;==>_WinAPI_GetLayeredWindowAttributes
Edited by martin

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.

Share this post


Link to post
Share on other sites

Thank you for your reply however i tried this code and it did not work.

I'm on Windows 7 and when I run it I now have 2 separated GUI : the background PNG + controls in a window with a title bar.


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you for your reply however i tried this code and it did not work.

I'm on Windows 7 and when I run it I now have 2 separated GUI : the background PNG + controls in a window with a title bar.

I think I misunderstood the problem. Posted Image

Does this version get any nearer?

Global $GUI, $CONTROL_GUI, $EXIT_BUTTON

; Global variables for Graphical Part
Global Const $LWA_ALPHA = 0x2
Global Const $LWA_COLORKEY = 0x1

Const $WM_LBUTTONDOWN = 0x0201
#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinApi.au3>
#include <GDIPlus.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <File.au3>

Opt("GUIOnEventMode", 1)
Global $RelPos[2];
Global Const $WM_ENTERSIZEMOVE = 0x231, $WM_EXITSIZEMOVE = 0x232
_GDIPlus_Startup()
$PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\GUI.png")


$GUI = GUICreate("LiLi USB Creator", 450, 750, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetBitmap($GUI, $PNG_GUI, 254)
;_WinAPI_SetLayeredWindowAttributes($CONTROL_GUI, 0x121314)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState(@SW_SHOW, $GUI)

GUIRegisterMsg($WM_ENTERSIZEMOVE, "setrelpos");<-------------------------
GUIRegisterMsg($WM_MOVE, "followme")

$LAYERED_GUI_CORRECTION = GetVertOffset($GUI)
$pp = wingetpos($GUI)
$CONTROL_GUI = GUICreate("LiLi USB Creator", 450, 750, $pp[0],$pp[1]+ $LAYERED_GUI_CORRECTION, $WS_POPUP);, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

HotKeySet("{ESC}", "Terminate")


; Offset for applied on every items
$offsetx0 = 27
$offsety0 = 23

; Label of Step 1
GUICtrlCreateLabel("ETAPE 1 : CHOISIR LA CLE", 28 + $offsetx0, 108 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")
GUICtrlSetOnEvent(-1,"MoveParent")
GUISetBkColor(0x121314)
_WinAPI_SetLayeredWindowAttributes($CONTROL_GUI, 0x121314)

GUISetState(@SW_SHOW, $CONTROL_GUI)

$ZEROGraphic = _GDIPlus_GraphicsCreateFromHWND($CONTROL_GUI)
GUISetState(@SW_SHOW, $CONTROL_GUI)
GUIRegisterMsg($WM_LBUTTONDOWN,"moveParent")
    winsetontop($gui,"",1)
    winsetontop($gui,"",0)
; Main part
While 1
    Sleep(1000)
WEnd


Func Terminate()
    Exit 0
EndFunc

Func followme($hW, $iM, $wp, $lp);<---------------------------------------

    If $hW <> $GUI Then Return
    Local $xpos = BitAND($lp, 0xffff)
    Local $ypos = BitShift($lp, 16)
    Local $xypos = WinGetPos($GUI)
    WinMove($CONTROL_GUI, "", $xypos[0] - $RelPos[0], $xypos[1] - $RelPos[1])

EndFunc ;==>followme


Func SetRelPos($hW, $iM, $wp, $lp);<-----------------------------------------------

    If $hW <> $GUI Then Return

    Local $gpp = WinGetPos($GUI)
    Local $gsp = WinGetPos($CONTROL_GUI)

    $RelPos[0] = $gpp[0] - $gsp[0]
    $RelPos[1] = $gpp[1] - $gsp[1]


EndFunc ;==>SetRelPos


; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
; ///////////////////////////////// Graphical Part  ///////////////////////////////////////////////////////////////////////////////
; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Func MoveParent($hW)
    winsetontop($gui,"",1)
    winsetontop($gui,"",0)
    _SendMessage($gui, $WM_SYSCOMMAND, 0xF012, 0)
EndFunc


Func GetVertOffset($hgui)
;Const $SM_CYCAPTION = 4
    Const $SM_CXFIXEDFRAME = 7
    Local $wtitle, $wclient, $wsize,$wside,$ans,$AC_SRC_ALPHA = 1
    $wclient = WinGetClientSize($hgui)
    $wsize = WinGetPos($hgui)
    $wtitle = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYCAPTION)
    $wside = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXFIXEDFRAME)
    $ans = $wsize[3] - $wclient[1] - $wtitle[0] - 2 * $wside[0] +25
    Return $ans
EndFunc ;==>GetVertOffset

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then
        Return $HTCAPTION
    EndIf
EndFunc ;==>WM_NCHITTEST

Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend,$AC_SRC_ALPHA = 1

    $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))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _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)
EndFunc ;==>SetBitmap

;############# EndExample #########

;===============================================================================
;
; Function Name: _WinAPI_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Transparent color
; $Transparency - Set Transparancy of GUI
; $isColorRef - If True, $i_transcolor is a COLORREF( 0x00bbggrr ), else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed - use
; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s): Prog@ndy
;
; Link : @@MsdnLink@@ SetLayeredWindowAttributes
; Example : Yes
;===============================================================================
;
Func _WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; #############################################
    ; You are NOT ALLOWED to remove the following lines
    ; Function Name: _WinAPI_SetLayeredWindowAttributes
    ; Author(s): Prog@ndy
    ; #############################################
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03

    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hWnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, _WinAPI_GetLastError(), 0)
        Case Else
            Return 1
    EndSelect
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

;===============================================================================
;
; Function Name: _WinAPI_GetLayeredWindowAttributes
; Description:: Gets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Returns Transparent color ( dword as 0x00bbggrr or string "0xRRGGBB")
; $Transparency - Returns Transparancy of GUI
; $isColorRef - If True, $i_transcolor will be a COLORREF( 0x00bbggrr ), else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: Usage of LWA_ALPHA and LWA_COLORKEY (use BitAnd)
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed
; - use _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; - @extended contains _WinAPI_GetLastError
; Author(s): Prog@ndy
;
; Link : @@MsdnLink@@ GetLayeredWindowAttributes
; Example : Yes
;===============================================================================
;
Func _WinAPI_GetLayeredWindowAttributes($hWnd, ByRef $i_transcolor, ByRef $Transparency, $asColorRef = False)
    ; #############################################
    ; You are NOT ALLOWED to remove the following lines
    ; Function Name: _WinAPI_SetLayeredWindowAttributes
    ; Author(s): Prog@ndy
    ; #############################################
    $i_transcolor = -1
    $Transparency = -1
    Local $Ret = DllCall("user32.dll", "int", "GetLayeredWindowAttributes", "hwnd", $hWnd, "long*", $i_transcolor, "byte*", $Transparency, "long*", 0)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, _WinAPI_GetLastError(), 0)
        Case Else
            If Not $asColorRef Then
                $Ret[2] = Hex(String($Ret[2]), 6)
                $Ret[2] = '0x' & StringMid($Ret[2], 5, 2) & StringMid($Ret[2], 3, 2) & StringMid($Ret[2], 1, 2)
            EndIf
            $i_transcolor = $Ret[2]
            $Transparency = $Ret[3]
            Return $Ret[4]
    EndSelect
EndFunc ;==>_WinAPI_GetLayeredWindowAttributes
Edited by martin

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.

Share this post


Link to post
Share on other sites

Actually there is an item that can be viewed on CONTROL_GUI : it's a label "ETAPE 1 : CHOISIR LA SOURCE".

In your code, both windows are moving but only when GUI is moved.

Since CONTROL_GUI is over GUI I would like both to move when CONTROL_GUI is dragged. GUI cannot be dragged in my code because of CONTROL_GUI masking it.

Another solution would be to avoid using a background in CONTROL_GUI but this background (color 0x121314) is used to create the transparency.

I hope you understand what i'm saying even if it seems a bit confused :)


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

Actually there is an item that can be viewed on CONTROL_GUI : it's a label "ETAPE 1 : CHOISIR LA SOURCE".

In your code, both windows are moving but only when GUI is moved.

Since CONTROL_GUI is over GUI I would like both to move when CONTROL_GUI is dragged. GUI cannot be dragged in my code because of CONTROL_GUI masking it.

Another solution would be to avoid using a background in CONTROL_GUI but this background (color 0x121314) is used to create the transparency.

I hope you understand what i'm saying even if it seems a bit confused :)

I just changed my post before you posted so can you tell me if it is any different or better now?


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.

Share this post


Link to post
Share on other sites

I tried but I can't tell because I don't have Seven on my computer at work.

The idea seems good but now the CONTROL_GUI is behind GUI and has a black background.

CONTROL_GUI is where all the buttons will be so I cannot keep it like that.


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

I tried but I can't tell because I don't have Seven on my computer at work.

The idea seems good but now the CONTROL_GUI is behind GUI and has a black background.

CONTROL_GUI is where all the buttons will be so I cannot keep it like that.

OK but that should be easy to change. If I made the background transparent I couldn't see if it dragged the other window. Can you provide a sample with controls on the CONTROL_GUI and the background image on $CONTROL_GUI if there is one so that I can understand the problem a bit better.


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.

Share this post


Link to post
Share on other sites

You can find it directly on www.LinuxLiveUSB.com. Download the software, it contains a folder with the sources.

Just put LiLi's sources in the same folder as "LiLi USB Creator.exe".

Again, thanks for your help.


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

You can find it directly on www.LinuxLiveUSB.com. Download the software, it contains a folder with the sources.

Just put LiLi's sources in the same folder as "LiLi USB Creator.exe".

Again, thanks for your help.

I made some changes to the start of the script and all the changes are included in the code below, so just replace the original down to the function DrawAll() with this, then let me know if I've understood.

#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=tools\img\lili.ico
#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=Enjoy !
#AutoIt3Wrapper_Res_Description=Easily create a Linux Live USB
#AutoIt3Wrapper_Res_Fileversion=2.1.88.19
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=Y
#AutoIt3Wrapper_Res_LegalCopyright=CopyLeft Thibaut Lauziere a.k.a Slÿm
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%
#AutoIt3Wrapper_Res_Field=Site|http://www.linuxliveusb.com
#AutoIt3Wrapper_AU3Check_Parameters=-w 4
#AutoIt3Wrapper_Run_After=upx.exe --best --compress-resources=0 "%out%"
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; Author    : Thibaut Lauzière (Slÿm)
; Author's Website : www.slym.fr
; e-Mail    : contact@linuxliveusb.com
; License   : GPL v3.0
; Version   : 2.1
; Download  : http://www.linuxliveusb.com
; Support   : http://www.linuxliveusb.com/bugs/
; Compiled with : AutoIT v3.2.12.1


; Global constants
Global Const $software_version = "2.1"
Global $lang_ini = @ScriptDir & "\tools\languages\"
Global Const $settings_ini = @ScriptDir & "\tools\settings\settings.ini"
Global Const $compatibility_ini = @ScriptDir & "\tools\settings\compatibility_list.ini"
Global Const $blacklist_ini = @ScriptDir & "\tools\settings\black_list.ini"
Global Const $variants_using_default_mode = "default,gparted,debian,clonezilla,damnsmall,puppy431,toutou412,pclinuxos20092KDE,pmagic45,pmagic46,slax612,slitaz20,tinycore25"
Global Const $log_dir = @ScriptDir & "\logs\"

Global $lang, $anonymous_id
Global $downloaded_virtualbox_filename

; Global variables used for the onEvent Functions
; Globals images and GDI+ elements
Global $GUI, $CONTROL_GUI, $EXIT_BUTTON, $MIN_BUTTON, $DRAW_REFRESH, $DRAW_ISO, $DRAW_CD, $DRAW_DOWNLOAD, $DRAW_BACK, $DRAW_BACK_HOVER, $DRAW_LAUNCH, $HELP_STEP1, $HELP_STEP2, $HELP_STEP3, $HELP_STEP4, $HELP_STEP5, $label_iso, $label_cd, $label_download, $label_step2_status,$download_label2,$OR_label,$live_mode_only_label,$virtualbox
Global $ZEROGraphic, $EXIT_NORM, $EXIT_OVER, $MIN_NORM, $MIN_OVER, $PNG_GUI, $CD_PNG, $CD_HOVER_PNG, $ISO_PNG, $ISO_HOVER_PNG, $DOWNLOAD_PNG, $DOWNLOAD_HOVER_PNG, $BACK_PNG, $BACK_HOVER_PNG, $LAUNCH_PNG, $LAUNCH_HOVER_PNG, $HELP, $BAD, $GOOD, $WARNING, $BACK_AREA
Global $download_menu_active = 0, $cleaner, $cleaner2
Global $combo_linux, $download_manual, $download_auto, $slider, $slider_visual
Global $best_mirror, $iso_size, $filename, $progress_bar, $label_step2_status
Global $MD5_ISO ="" , $compatible_md5, $compatible_filename, $release_number = -1,$files_in_source,$prefetched_linux_list
Global $foo
Global $for_winactivate

; Global variables for Graphical Part
Global Const $LWA_ALPHA = 0x2
Global Const $LWA_COLORKEY = 0x1

; Global variables for debug
Global $mem = StringSplit("-1,-1,-1,-1,-1,-1,-1", ",")

Opt("GUIOnEventMode", 1)

; Checking if Tools folder exists (contains tools and settings)
If DirGetSize(@ScriptDir & "\tools\", 2) <> -1 Then
    If Not FileExists($lang_ini) Then
        MsgBox(48, "ERROR", "Language file not found !!!")
        Exit
    EndIf

    If Not FileExists($settings_ini) Then
        MsgBox(48, "ERROR", "Settings file not found !!!")
        Exit
    Else
        ; Generate an unique ID for anonymous crash reports and stats
        If IniRead($settings_ini, "General", "unique_ID", "none") = "none" Or IniRead($settings_ini, "General", "unique_ID", "none") = "" Then
            $anonymous_id = RegRead("HKEY_CURRENT_USER\SOFTWARE\LinuxLive\", "AnonymousID")
            if $anonymous_id = "" Then
                $anonymous_id = Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1)) & Chr(Random(Asc("A"), Asc("Z"), 1))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\LinuxLive\", "AnonymousID", "REG_SZ", $anonymous_id)
                IniWrite($settings_ini, "General", "unique_ID", $anonymous_id)
            Else

                IniWrite($settings_ini, "General", "unique_ID", $anonymous_id)
            EndIf
        Else
            $anonymous_id = IniRead($settings_ini, "General", "unique_ID", "none")
        EndIf
    EndIf
Else
    MsgBox(48, "ERROR", "Please put the 'tools' directory back")
    Exit
EndIf


#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinApi.au3>
#include <GDIPlus.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <md5.au3>
#include <INet.au3>
#include <IE.au3>
#include <WinHTTP.au3>

; LiLi's components
#include <About.au3>
#include <Automatic_Bug_Report.au3>
#include <Ressources.au3>
#include <Graphics.au3>
#include <Releases.au3>
#include <LiLis_heart.au3>

; Apply proxy settings
If IniRead($settings_ini, "General", "proxy_url", "none") <> "none" And IniRead($settings_ini, "General", "proxy_url", "none") <> "" Then
    $proxy_url = IniRead($settings_ini, "General", "proxy_url", "none")
    if IniRead($settings_ini, "General", "proxy_port", "none") <> "none" And IniRead($settings_ini, "General", "proxy_port", "none") <> "" Then $proxy_url &=":"&IniRead($settings_ini, "General", "proxy_port", "none")
        if IniRead($settings_ini, "General", "proxy_username", "none") <> "none" And IniRead($settings_ini, "General", "proxy_username", "none") <> "" Then
            $proxy_username=IniRead($settings_ini, "General", "proxy_username", "none")
            if IniRead($settings_ini, "General", "proxy_password", "none") <> "none" And IniRead($settings_ini, "General", "proxy_password", "none") <> "" Then
                $proxy_password=IniRead($settings_ini, "General", "proxy_password", "none")
                HttpSetProxy( 2, $proxy_url,$proxy_username,$proxy_password)
            Else
                HttpSetProxy( 2, $proxy_url,$proxy_username)
            Endif
        Else
            HttpSetProxy( 2, $proxy_url)
    EndIf
EndIf


SendReport("Starting LiLi USB Creator " & $software_version)

_GDIPlus_Startup()

; Loading PNG Files
$EXIT_NORM = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\close.PNG")
$EXIT_OVER = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\close_hover.PNG")
$MIN_NORM = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\min.PNG")
$MIN_OVER = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\min_hover.PNG")
$BAD = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\bad.png")
$WARNING = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\warning.png")
$GOOD = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\good.png")
$HELP = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\help.png")
$CD_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\cd.png")
$CD_HOVER_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\cd_hover.png")
$ISO_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\iso.png")
$ISO_HOVER_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\iso_hover.png")
$DOWNLOAD_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\download.png")
$DOWNLOAD_HOVER_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\download_hover.png")
$LAUNCH_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\launch.png")
$LAUNCH_HOVER_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\launch_hover.png")
$REFRESH_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\refresh.png")
$BACK_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\back.png")
$BACK_HOVER_PNG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\back_hover.png")
$PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\GUI.png")
#cs
If FileExists(@ScriptDir & "\tools\img\GUI_" & $lang & ".png") Then
    $PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\GUI_" & $lang & ".png")
Else
    $PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tools\img\GUI_English.png")
EndIf
#ce


SendReport("Creating GUI")

$GUI = GUICreate("LiLi USB Creator", 450, 750, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Events")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "GUI_Minimize")
GUISetOnEvent($GUI_EVENT_RESTORE, "GUI_Restore")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "GUI_Restore")

SetBitmap($GUI, $PNG_GUI, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState(@SW_SHOW, $GUI)

; Old offset was 18
$LAYERED_GUI_CORRECTION = GetVertOffset($GUI)
$CONTROL_GUI = GUICreate("LiLi USB Creator", 450, 750, 0, $LAYERED_GUI_CORRECTION, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

; Offset for applied on every items
$offsetx0 = 27
$offsety0 = 23

; Label of Step 1
_OE_GuiCtrlCreateLabel(Translate("ETAPE 1 : CHOISIR LA CLE"), 28 + $offsetx0, 108 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")

; Clickable parts of images
$EXIT_AREA = _OE_GuiCtrlCreateLabel("", 335 + $offsetx0, -20 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Exit")
$MIN_AREA = _OE_GuiCtrlCreateLabel("", 305 + $offsetx0, -20 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Minimize")
$REFRESH_AREA = _OE_GuiCtrlCreateLabel("", 300 + $offsetx0, 145 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Refresh_Drives")
$ISO_AREA = _OE_GuiCtrlCreateLabel("", 38 + $offsetx0, 231 + $offsety0, 75, 75)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Choose_ISO")
$CD_AREA = _OE_GuiCtrlCreateLabel("", 146 + $offsetx0, 231 + $offsety0, 75, 75)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Choose_CD")
$DOWNLOAD_AREA = _OE_GuiCtrlCreateLabel("", 260 + $offsetx0, 230 + $offsety0, 75, 75)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Download")
$LAUNCH_AREA = _OE_GuiCtrlCreateLabel("", 35 + $offsetx0, 600 + $offsety0, 22, 43)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Launch_Creation")
$HELP_STEP1_AREA = _OE_GuiCtrlCreateLabel("", 335 + $offsetx0, 105 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Help_Step1")
$HELP_STEP2_AREA = _OE_GuiCtrlCreateLabel("", 335 + $offsetx0, 201 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Help_Step2")
$HELP_STEP3_AREA = _OE_GuiCtrlCreateLabel("", 335 + $offsetx0, 339 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Help_Step3")
$HELP_STEP4_AREA = _OE_GuiCtrlCreateLabel("", 335 + $offsetx0, 451 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Help_Step4")
$HELP_STEP5_AREA = _OE_GuiCtrlCreateLabel("", 335 + $offsetx0, 565 + $offsety0, 20, 20)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "GUI_Help_Step5")

GUISetBkColor(0x121314)
_WinAPI_SetLayeredWindowAttributes($CONTROL_GUI, 0x121314)


GUISetState(@SW_SHOW, $CONTROL_GUI)


$ZEROGraphic = _GDIPlus_GraphicsCreateFromHWND($CONTROL_GUI)

; Firt display (initialization) of images
$EXIT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $EXIT_NORM, 0, 0, 20, 20, 335 + $offsetx0, -20 + $offsety0, 20, 20)
$MIN_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $MIN_NORM, 0, 0, 20, 20, 305 + $offsetx0, -20 + $offsety0, 20, 20)
$DRAW_REFRESH = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $REFRESH_PNG, 0, 0, 20, 20, 300 + $offsetx0, 145 + $offsety0, 20, 20)
$DRAW_ISO = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $ISO_PNG, 0, 0, 75, 75, 38 + $offsetx0, 231 + $offsety0, 75, 75)
$DRAW_CD = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $CD_PNG, 0, 0, 75, 75, 146 + $offsetx0, 231 + $offsety0, 75, 75)
$DRAW_DOWNLOAD = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $DOWNLOAD_PNG, 0, 0, 75, 75, 260 + $offsetx0, 230 + $offsety0, 75, 75)
$DRAW_LAUNCH = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $LAUNCH_PNG, 0, 0, 22, 43, 35 + $offsetx0, 600 + $offsety0, 22, 43)
$HELP_STEP1 = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $HELP, 0, 0, 20, 20, 335 + $offsetx0, 105 + $offsety0, 20, 20)
$HELP_STEP2 = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $HELP, 0, 0, 20, 20, 335 + $offsetx0, 201 + $offsety0, 20, 20)
$HELP_STEP3 = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $HELP, 0, 0, 20, 20, 335 + $offsetx0, 339 + $offsety0, 20, 20)
$HELP_STEP4 = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $HELP, 0, 0, 20, 20, 335 + $offsetx0, 451 + $offsety0, 20, 20)
$HELP_STEP5 = _GDIPlus_GraphicsDrawImageRectRect($ZEROGraphic, $HELP, 0, 0, 20, 20, 335 + $offsetx0, 565 + $offsety0, 20, 20)

; Put the state for the first 3 steps
Step1_Check("bad")
Step2_Check("bad")
Step3_Check("bad")

SendReport("Creating GUI (buttons)")

; Text for step 2

_OE_GuiCtrlCreateLabel(Translate("ETAPE 2 : CHOISIR LA SOURCE"), 28 + $offsetx0, 204 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")

$label_iso = _OE_GuiCtrlCreateLabel("ISO / IMG", 50 + $offsetx0, 302 + $offsety0, 50, 50)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)


$label_cd = _OE_GuiCtrlCreateLabel("CD", 175 + $offsetx0, 302 + $offsety0, 20, 50)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)

$label_download = _OE_GuiCtrlCreateLabel(Translate("Télécharger"), 262 + $offsetx0, 302 + $offsety0, 70, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)

; Text and controls for step 3
$offsetx3 = 60
$offsety3 = 150

_OE_GuiCtrlCreateLabel(Translate("ETAPE 3 : PERSISTANCE"), 28+$offsetx0, 194 + $offsety3 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")

$label_min = _OE_GuiCtrlCreateLabel("0 " & Translate("Mo"), 30 + $offsetx3 + $offsetx0, 228 + $offsety3 + $offsety0, 30, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$label_max = _OE_GuiCtrlCreateLabel("?? " & Translate("Mo"), 250 + $offsetx3 + $offsetx0, 228 + $offsety3 + $offsety0, 50, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)

$slider = GUICtrlCreateSlider(60 + $offsetx3 + $offsetx0, 225 + $offsety3 + $offsety0, 180, 20)
GUICtrlSetLimit($slider, 0, 0)
GUICtrlSetOnEvent(-1, "GUI_Persistence_Slider")
$slider_visual = GUICtrlCreateInput("0", 90 + $offsetx3 + $offsetx0, 255 + $offsety3 + $offsety0, 40, 20)
GUICtrlSetOnEvent(-1, "GUI_Persistence_Input")
$slider_visual_Mo = _OE_GuiCtrlCreateLabel(Translate("Mo"), 135 + $offsetx3 + $offsetx0, 258 + $offsety3 + $offsety0, 20, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$slider_visual_mode = _OE_GuiCtrlCreateLabel(Translate("(Mode Live)"), 160 + $offsetx3 + $offsetx0, 258 + $offsety3 + $offsety0, 100, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$live_mode_only_label = _OE_GuiCtrlCreateLabel(Translate("Mode Live"), 77 + $offsetx3 + $offsetx0, 233 + $offsety3 + $offsety0, 300, 100)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont($live_mode_only_label, 16)
Disable_Persistent_Mode()

; Text and controls for step 4
$offsetx4 = 10
$offsety4 = 195

_OE_GuiCtrlCreateLabel(Translate("ETAPE 4 : OPTIONS"), 28+$offsetx0, 259 + $offsety4 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")

$hide_files = GUICtrlCreateCheckbox("", 30 + $offsetx4 + $offsetx0, 285 + $offsety4 + $offsety0, 13, 13)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$hide_files_label = _OE_GuiCtrlCreateLabel(Translate("Cacher les fichiers sur la clé"), 50 + $offsetx4 + $offsetx0, 285 + $offsety4 + $offsety0, 300, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)

; No more reason to keep that option because menu is integrated on right click of the key
$except_wubi = GUICtrlCreateDummy()
;$except_wubi = GUICtrlCreateCheckbox("", 200 + $offsetx4+$offsetx0, 285 + $offsety4+$offsety0, 13, 13)
;$except_wubi_label = GUICtrlCreateLabel(Translate("(Sauf Umenu.exe)"), 220 + $offsetx4+$offsetx0, 285 + $offsety4+$offsety0, 200, 20)
;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
;GUICtrlSetColor(-1, 0xFFFFFF)

$formater = GUICtrlCreateCheckbox("", 30 + $offsetx4 + $offsetx0, 305 + $offsety4 + $offsety0, 13, 13)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "GUI_Format_Key")
$formater_label = GUICtrlCreateLabel(Translate("Formater la clé en FAT32 (Vos données seront supprimées!)"), 50 + $offsetx4 + $offsetx0, 305 + $offsety4 + $offsety0, 300, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$virtualbox = GUICtrlCreateCheckbox("", 30 + $offsetx4 + $offsetx0, 325 + $offsety4 + $offsety0, 13, 13)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$virtualbox_label = _OE_GuiCtrlCreateLabel(Translate("Permettre de lancer LinuxLive directement sous Windows (nécessite internet)"), 50 + $offsetx4 + $offsetx0, 325 + $offsety4 + $offsety0, 300, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)


; Text and controls for step 5

_OE_GuiCtrlCreateLabel(Translate("ETAPE 5 : INSTALLER"), 28+$offsetx0, 371 + $offsety4 + $offsety0, 400, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,400,0,"Tahoma")

$label_step6_statut = _OE_GuiCtrlCreateLabel("<- " & Translate("Cliquer l'éclair pour lancer l'installation"), 50 + $offsetx4 + $offsetx0, 410 + $offsety4 + $offsety0, 300, 60)
GUICtrlSetFont($label_step6_statut, 9, 800, 0, "Arial")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)


; Filling the combo box with drive list
Global $combo
$combo = GUICtrlCreateCombo("-> " & Translate("Choisir une clé USB"), 90 + $offsetx0, 145 + $offsety0, 200, -1, 3)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "GUI_Choose_Drive")
Refresh_DriveList()

; Setting up all global vars and local vars
Global $selected_drive, $logfile, $virtualbox_check, $virtualbox_size
Global $STEP1_OK, $STEP2_OK, $STEP3_OK
Global $DRAW_CHECK_STEP1, $DRAW_CHECK_STEP2, $DRAW_CHECK_STEP3
Global $MD5_ISO, $version_in_file
Global $variante
Const $WM_LBUTTONDOWN = 0x0201

$selected_drive = "->"
$file_set = 0;
$file_set_mode = "none"
$annuler = 0
$sysarg = " "
$combo_updated = 0

$STEP1_OK = 0
$STEP2_OK = 0
$STEP3_OK = 0

$MD5_ISO = "none"
$version_in_file = "none"

; Sending anonymous statistics
SendStats()
SendReport(LogSystemConfig())

; initialize list of compatible releases (load the compatibility_list.ini)
Get_Compatibility_List()
$prefetched_linux_list=Print_For_ComboBox()

; Hovering Buttons
AdlibEnable("Control_Hover", 150)


GUIRegisterMsg($WM_PAINT, "DrawAll")
WinActivate($for_winactivate)
GUISetState($GUI_SHOW, $CONTROL_GUI)
GUIRegisterMsg($WM_LBUTTONDOWN,"moveParent")

; Main part
While 1
    ; Force retracing the combo box (bugfix)
    If $combo_updated <> 1 Then
        GUICtrlSetData($combo, GUICtrlRead($combo))
        $combo_updated = 1
    EndIf
    Sleep(1000)
WEnd


Func _OE_GuiCtrlCreateLabel($s, $w, $h, $x, $y=32)
    GUICtrlCreatelabel($s,$w,$h,$x,$y)
    GUICtrlSetOnEvent(-1,"MoveParent")
EndFunc


Func MoveParent($hW)
    winsetontop($gui,"",1)
    winsetontop($gui,"",0)
    _SendMessage($gui, $WM_SYSCOMMAND, 0xF012, 0)
EndFunc

Func DrawAll()

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.

Share this post


Link to post
Share on other sites

Sorry to come back to you only now but i did not have time to try it out on Seven.

I modified your code and now it's working well :) . Just had a little bug on focus.

Thank you so much for helping me on that one.

I tried to debug it for many hours with no success.

Code will be available to everyone in next release (2.2) of LiLi.


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

Sorry to come back to you only now but i did not have time to try it out on Seven.

I modified your code and now it's working well :) . Just had a little bug on focus.

Thank you so much for helping me on that one.

I tried to debug it for many hours with no success.

Code will be available to everyone in next release (2.2) of LiLi.

Glad you got it fixed and that I was able to help. I'll have a look at your next version when it's released.


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.

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  
Followers 0