Jump to content
Sign in to follow this  
Wombat

Weird GUI bug

Recommended Posts

Wombat

Alright, so I've been slowly combining all I've learned into a script for my job.... All the way up until I coded the search function it ran perfectly. Now when a window is over the gui or you drag it off screen the "GUICtrlCreateGraphics" items are not being redrawn. I have no idea why, After getting them setup and working I never touched them again.

I need someone to look over my code and point me in the direction to solving it myself, as I have spent days deleting and rewriting code trying to debug it... and I've come up with nothing...

 

Here's my entire code:

CODE:

#region ; Includes begin here:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include <_RecFileListToArray.au3>
#include <String.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#NoTrayIcon
; Includes end here;;;;;;;;;;;;;;;;;
#endregion

#region ; Options are set here:
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
;Options end here;;;;;;;
#endregion

#region ; Special Chr and coding begins here:
Global $Qmark = Chr(34)
Global $Comma = Chr(44)
Global $InputDef = "Program Currently Loaded: "
Global $cHour = @HOUR
Global $cMin = @MIN
Global $cDay = @MDAY
Global $cMonth = @MON
Global $cYear = @YEAR
Global $SearchPath = FileRead("C:\Users\Wombat\workshop\Lab\test_res\PSS_T500_FilePath_Holder.dat1")
Global $SearchResults
Global $InputData
#endregion ;Special Chr and coding ends here;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SPLASH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;$Splash = GUICreate("SPLASH", 588.5, 200, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
;GUISetBkColor(0xFFFFFF)
;$pSplash = GUICtrlCreatePic("C:\prog_res\Lab\test_res\storm_newlogo_TEST.jpg",0,0,588.5,200)
;GUISetState(@SW_SHOW, "SPLASH")
;Sleep(2000)
;GUIDelete("SPLASH")
;Sleep(10)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#region ; Main GUI begins here:

#region ; $MainGUI
$MainGUI = GUICreate("MainGUI", 774, 580, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
GUISetBkColor(0xFFFFFF)
GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainGUIMinimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainGUIMaximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "MainGUIRestore")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
#endregion

#region ; $Slogan
$Slogan = GUICtrlCreateLabel($Qmark & "Every Order" & $Comma & " Every Time" & $Qmark, 525, 40, 200, 20)
GUICtrlSetFont(-1, 14, 800, 2, "Tw Cen MT")
#endregion

#region ; $gHorBar1
$gHorBar1 = GUICtrlCreateGraphic(175, 125, 600, 15)
GUICtrlSetBkColor( -1,0x3B3B3B)
GUICtrlSetState( -1, $GUI_DISABLE)
#endregion

#region ; $gHorBar2
$gHorBar2 = GUICtrlCreateGraphic(475, 105, 400, 20)
GUICtrlSetBkColor( -1,0x3B3B3B)
GUICtrlSetState( -1, $GUI_DISABLE)
#endregion

#region ; $gVertBar1
$gVertBar1 = GUICtrlCreateGraphic(175, 125, 15, 550)
GUICtrlSetBkColor( -1,0x3B3B3B)
GUICtrlSetState( -1, $GUI_DISABLE)
#endregion

#region ; $gVertBar2
$gVertBar2 = GUICtrlCreateGraphic(10, 428, 125, 200)
GUICtrlSetBkColor( -1,0x353535)
GUICtrlSetState( -1, $GUI_DISABLE)
#endregion

#region ; $Input1
$Input1 = GUICtrlCreateInput("", 503, 112, 250, 20)
GUICtrlSetOnEvent(-1, "Input1ENTER")
#endregion

#region ; $mButton1
$mButton1 = GUICtrlCreateLabel(@CR & "SEND PROGRAM", 10, 212, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 7)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0x868686)
#endregion

#region ; $mButton2
$mButton2 = GUICtrlCreateLabel(@CR & "TOOL BOX", 10, 266, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 7)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0x868686)
#endregion

#region ; $mButton3
$mButton3 = GUICtrlCreateLabel(@CR & "LOGIN", 10, 320, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 0)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion

#region ; $mButton4
$mButton4 = GUICtrlCreateLabel(@CR & "RESET", 10, 374, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 0)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion

#region ; $Clock
$Clock= GUICtrlCreateLabel(@CR & $cDay & "/" & $cMonth & "/" & $cYear & " - " & $cHour-12 & ":" & $cMin, 10, 428, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 0)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion

GUISetState(@SW_SHOW, "MainGUI")
#endregion ;Main GUI ends here

AdlibRegister("ClockSetTime", 15000)

  $msg = GUIGetMsg()
If $msg = $Input1 Then Input1ENTER()


While 1
    _GDIPlus_Startup()
    $gdi_Logo = _GDIPlus_ImageLoadFromFile("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_title_sm.PNG")
    $LOGO = _GDIPlus_GraphicsCreateFromHWND($MainGUI)
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
WEnd

Func WM_PAINT($MainGUI, $iMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    _WinAPI_RedrawWindow($MainGUI, 0, 0, $RDW_VALIDATE)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT

Func ClockSetTime()
    GUICtrlSetData($Clock, @CR & @MDAY & "/" & @MON & "/" & @YEAR & " - " & @HOUR -12 & ":" & @MIN)
EndFunc

#region ;Functions begin here:
Func MainGUIClose()
    _GDIPlus_GraphicsDispose($gdi_Logo)
    _GDIPlus_ImageDispose($LOGO)
    _GDIPlus_ShutDown()
    GUIDelete("MainGUI")
    Exit
EndFunc

Func Input1ENTER()
        Search()
        GUICtrlSetColor($mButton1, 0xFFFFFF)
        GUICtrlSetColor($mButton2, 0xFFFFFF)
        GUICtrlSetCursor($mButton1, 0)
        GUICtrlSetCursor($mButton2, 0)
        GUICtrlSetData($Input1, "")
        GUICtrlSetStyle($Input1, $ES_READONLY)
EndFunc

Func Search()
    $InputData = GUICtrlRead($Input1)
    $SearchResults = _RecFileListToArray("Z:\", $InputData & ".lst*", 1, 1, 1, 2)
    If @error Then
        MsgBox(1, "FAIL", "FAIL" & @error)
    ElseIf IsArray($SearchResults) Then
        _ArrayDisplay($SearchResults, "Results")
    EndIf
EndFunc

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Return $HTCAPTION
EndFunc

Func MainGUIMaximize()

EndFunc

Func MainGUIMinimize()

EndFunc

Func MainGUIRestore()

EndFunc
#endregion ;Functions end here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;







#region ;DynamicGUI begins here:

#endregion ;DynamicGui ends here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

Thank you,

Wombat


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
Wombat

Alrighty, I solved it (I think permanently) by Changing:

_WinAPI_RedrawWindow($MainGUI, 0, 0, $RDW_VALIDATE)

to:

_WinAPI_RedrawWindow($MainGUI, 100, 100, $RDW_VALIDATE)

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
FireFox

Hi,
No that's not correct.
 
The only issue is that you're using the GUIRegisterMsg inside a loop.
 
This function registers a message, once registered it's not necessary to register it again.
 

...
$LOGO = 0
$gdi_Logo = 0
GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT
GUISetState(@SW_SHOW, "MainGUI")
...
 
While 1
    ...
    ;remove GUIRegisterMsg
    ...
WEnd
 

Func WM_PAINT($MainGUI, $iMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT
...
Br, FireFox.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Wombat

 

Hi,

No that's not correct.

 

The only issue is that you're using the GUIRegisterMsg inside a loop.

 

This function registers a message, once registered it's not necessary to register it again.

 

...
$LOGO = 0
$gdi_Logo = 0
GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT
GUISetState(@SW_SHOW, "MainGUI")
...
 
While 1
    ...
    ;remove GUIRegisterMsg
    ...
WEnd
 

Func WM_PAINT($MainGUI, $iMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT
...
Br, FireFox.

 

 

I tried your modification and it didn't work, it actually caused the items drawn by GDIPlus to not be drawn...

I'm not saying you're wrong, just that implementing your modification my code didn't work.

Here's my code as it currently stands, and it works exactly as i need it to without any bugs or process hogging

CODE:

#region ; Pre-GUI

#region ; Includes begin here:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include <_RecFileListToArray.au3>
#include <String.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <Toast.au3>
#include <GUICtrlOnHover.au3>
#NoTrayIcon
#endregion ; Includes end here;;;;;;;;;;;;;;;;;

#region ; Options are set here:
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
#endregion ; Options end here:

#region ; Special Chr and coding begins here:
Global $Qmark = Chr(34)
Global $Comma = Chr(44)
Global $InputDef = "Program Currently Loaded: "
Global $cHour = @HOUR
Global $cMin = @MIN
Global $cDay = @MDAY
Global $cMonth = @MON
Global $cYear = @YEAR
Global $Pointer
Global $InputData
Global $SelectProgramList
Global $SearchResults
Global $sPath
Global $sLabel
Global $CurrentProgram
Global $SendValue = False
Global $TBValue = False
Global $LoginValue = False
#endregion ; Special Chr and coding begins here:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SPLASH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;$Splash = GUICreate("SPLASH", 588.5, 200, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
;GUISetBkColor(0xFFFFFF)
;$pSplash = GUICtrlCreatePic("C:\prog_res\Lab\test_res\storm_newlogo_TEST.jpg",0,0,588.5,200)
;GUISetState(@SW_SHOW, "SPLASH")
;Sleep(2000)
;GUIDelete("SPLASH")
;Sleep(10)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#region ; Main GUI begins here:

#region ; $MainGUI
$MainGUI = GUICreate("MainGUI", 774, 580, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
GUISetBkColor(0xFFFFFF)
GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainGUIMinimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainGUIMaximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "MainGUIRestore")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
#endregion ; $MainGUI

#region ; Invisible Blocks behind buttons:
#region ; $Block1
$Block1 = GUICtrlCreateGraphic(10, 252, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block1

#region ; $Block2
$Block2 = GUICtrlCreateGraphic(10, 306, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block2

#region ; $Block3
$Block3 = GUICtrlCreateGraphic(10, 360, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block3

#region ; $Block4
$Block4 = GUICtrlCreateGraphic(10, 414, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block4

#region ; $Block5
$Block5 = GUICtrlCreateGraphic(0, 212, 10, 400)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block5

#endregion ; Invisible Blocks end here:

#region ; $Slogan
$Slogan = GUICtrlCreateLabel($Qmark & "Every Order" & $Comma & " Every Time" & $Qmark, 525, 40, 200, 20)
GUICtrlSetFont(-1, 12, 800, 0, "Arimo")
#endregion ; $Slogan

#region ; Black frame around data:
#region ; $gHorBar1
$gHorBar1 = GUICtrlCreateGraphic(175, 125, 600, 15)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gHorBar1

#region ; $gHorBar2
$gHorBar2 = GUICtrlCreateGraphic(475, 105, 400, 20)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gHorBar2

#region ; $gVertBar1
$gVertBar1 = GUICtrlCreateGraphic(175, 125, 15, 550)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gVertBar1

#region ; $gVertBar2
$gVertBar2 = GUICtrlCreateGraphic(10, 428, 125, 200)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
#endregion ; $gVertBar2

#region ; $Input1
$Input1 = GUICtrlCreateInput("", 503, 112, 250, 20)
GUICtrlSetOnEvent(-1, "Input1ENTER")
#endregion ; $Input1
#endregion ; Black frame around data:

#region ; MainGUI Buttons:
#region ; $mButton1
$mButton1 = GUICtrlCreateLabel(@CR & "SEND PROGRAM", 10, 212, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button1_Hover", "Button1_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "_Send_Program")
#endregion ; $mButton1

#region ; $mButton2
$mButton2 = GUICtrlCreateLabel(@CR & "TOOL BOX", 10, 266, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button2_Hover", "Button2_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "_Tool_Box")
#endregion ; $mButton2

#region ; $mButton3
$mButton3 = GUICtrlCreateLabel(@CR & "LOGIN", 10, 320, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button3_Hover", "Button3_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "_Login")
#endregion ; $mButton3

#region ; $mButton4
$mButton4 = GUICtrlCreateLabel(@CR & "RESET", 10, 374, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button4_Hover", "Button4_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "Reset")
#endregion ; $mButton4
#endregion ; MainGUI Buttons:

#region ; $Clock
$Clock = GUICtrlCreateLabel(@CR & $cDay & "/" & $cMonth & "/" & $cYear & " - " & $cHour - 12 & ":" & $cMin, 10, 428, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion ; $Clock

GUISetState(@SW_SHOW, "MainGUI")
#endregion ; Main GUI begins here:
#endregion

#region ; Post-GUI
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND");GUI watches for double click

AdlibRegister("ClockSetTime", 15000);Check and update clock every 15 seconds

$msg = GUIGetMsg()
If $msg = $Input1 Then Input1ENTER();Read ENTER key being pressed while Input is focused


While 1
    _GDIPlus_Startup()
    $gdi_Logo = _GDIPlus_ImageLoadFromFile("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_title_sm.PNG")
    $LOGO = _GDIPlus_GraphicsCreateFromHWND($MainGUI)
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
WEnd

#region ;Functions begin here:

#region ; GUICtrl Functions:

Func ClockSetTime()
    GUICtrlSetData($Clock, @CR & @MDAY & "/" & @MON & "/" & @YEAR & " - " & @HOUR - 12 & ":" & @MIN)
EndFunc   ;==>ClockSetTime

Func Search()
    Local $SearchPath = FileRead(@ScriptDir & "\test_res\PSS_T500_FilePath_Holder.txt")
    Local $InputData = GUICtrlRead($Input1)
    Local $SearchResults = _RecFileListToArray($SearchPath, $InputData & "*.lst*", 1, 1, 0, 2)
    If @error Then
        Local $eNote = _Toast_Show(0, "Error Code = " & @error, "Unable to locate file", 5)
        _Toast_Hide()
    Else
        Local $tResults = _ArrayToString($SearchResults)
        $sLabel = GUICtrlCreateLabel("Choose a program to begin: ", 275, 175, 200, 20)
        $SelectProgramList = GUICtrlCreateList("", 275, 200, 400, 100)
        GUICtrlSetData(-1, $tResults)

    EndIf
EndFunc   ;==>Search

Func Input1ENTER()
    GUICtrlDelete($sLabel)
    GUICtrlDelete($SelectProgramList)
    Search()
    GUICtrlSetData($Input1, "")
EndFunc   ;==>Input1ENTER

Func Display_Results()
        $SendValue = True
        $TBValue = True
        $LoginValue = True

EndFunc

Func _Send_Program()
    If $SendValue = False Then
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$SendValue' & @lf & @lf & 'Return:' & @lf & $SendValue) ;### Debug MSGBOX
    Else
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$SendValue' & @lf & @lf & 'Return:' & @lf & $SendValue) ;### Debug MSGBOX
    EndIf
EndFunc

Func _Tool_Box()
    If $TBValue = False Then
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$TBValue' & @lf & @lf & 'Return:' & @lf & $TBValue) ;### Debug MSGBOX
    Else
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$TBValue' & @lf & @lf & 'Return:' & @lf & $TBValue) ;### Debug MSGBOX
    EndIf
EndFunc

Func _Login()
    If $LoginValue = False Then
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$LoginValue' & @lf & @lf & 'Return:' & @lf & $LoginValue) ;### Debug MSGBOX
    Else
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$LoginValue' & @lf & @lf & 'Return:' & @lf & $LoginValue) ;### Debug MSGBOX
    EndIf
EndFunc

#endregion

#region ; Drag&Drop, GDI-PNG-Drawing, and Window Dragging Functions:

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam);Dbl-clk processing

    #forceref $hWnd, $iMsg, $lParam

    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word

    Switch $iCode
        Case $LBN_DBLCLK
            Switch $iIDFrom
                Case $SelectProgramList
                    $CurrentProgram = GUICtrlRead($SelectProgramList) ; Use the native function
                    GUICtrlDelete($SelectProgramList)
                    GUICtrlDelete($sLabel)
                    Display_Results()
            EndSwitch
    EndSwitch

EndFunc   ;==>_WM_COMMAND

Func WM_PAINT($MainGUI, $iMsg, $wParam, $lParam);PNG drawing
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    _WinAPI_RedrawWindow($MainGUI, 100, 100, $RDW_VALIDATE)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam);Window Dragging
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST
#endregion

#region ; Window-Control Functions:

Func MainGUIClose();Shuts down and disposes of GDI elements, Deletes GUI and exits script
    _GDIPlus_GraphicsDispose($gdi_Logo)
    _GDIPlus_ImageDispose($LOGO)
    _GDIPlus_Shutdown()
    GUIDelete("MainGUI")
    Exit
EndFunc   ;==>MainGUIClose

Func Reset();Exits, then runs the script again, thus resetting it
    If @Compiled Then
        Run(FileGetShortName(@ScriptFullPath))
    Else
        Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc   ;==>Reset

Func MainGUIMaximize()

EndFunc   ;==>MainGUIMaximize

Func MainGUIMinimize()

EndFunc   ;==>MainGUIMinimize

Func MainGUIRestore()

EndFunc   ;==>MainGUIRestore
#endregion

#region ; Hover Functions:
Func Button1_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 220, 26, 25)
EndFunc   ;==>Button1_Hover

Func Button1_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button1_LeaveHover

Func Button2_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 274, 26, 25)
EndFunc   ;==>Button2_Hover

Func Button2_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button2_LeaveHover

Func Button3_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 328, 26, 25)
EndFunc   ;==>Button3_Hover

Func Button3_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button3_LeaveHover

Func Button4_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 382, 26, 25)
EndFunc   ;==>Button4_Hover

Func Button4_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button4_LeaveHover
#endregion

#endregion ;Functions begin here:

Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
FireFox

A few things:
-Your while code is very messy, the main while is never looped and you use GUIGetMsg multiple times whereas you previously set an onevent mode.
-Use a GUI handle for the GUIDelete function.
-Read carrefuly the helpfile to avoid this kind of mistakes.

#region ; Includes begin here:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include <_RecFileListToArray.au3>
#include <String.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#NoTrayIcon
; Includes end here;;;;;;;;;;;;;;;;;
#endregion ; Includes begin here:
 
#region ; Options are set here:
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
;Options end here;;;;;;;
#endregion ; Options are set here:
 
#region ; Special Chr and coding begins here:
Global $Qmark = Chr(34)
Global $Comma = Chr(44)
Global $InputDef = "Program Currently Loaded: "
Global $cHour = @HOUR
Global $cMin = @MIN
Global $cDay = @MDAY
Global $cMonth = @MON
Global $cYear = @YEAR
Global $SearchPath = FileRead("C:\Users\Wombat\workshop\Lab\test_res\PSS_T500_FilePath_Holder.dat1")
Global $SearchResults
Global $InputData
#endregion ; Special Chr and coding begins here:
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SPLASH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;$Splash = GUICreate("SPLASH", 588.5, 200, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
;GUISetBkColor(0xFFFFFF)
;$pSplash = GUICtrlCreatePic("C:\prog_res\Lab\test_res\storm_newlogo_TEST.jpg",0,0,588.5,200)
;GUISetState(@SW_SHOW, "SPLASH")
;Sleep(2000)
;GUIDelete("SPLASH")
;Sleep(10)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
#region ; Main GUI begins here:
 
#region ; $MainGUI
$MainGUI = GUICreate("MainGUI", 774, 580, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
GUISetBkColor(0xFFFFFF)
GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainGUIMinimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainGUIMaximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "MainGUIRestore")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
#endregion ; $MainGUI
 
#region ; $Slogan
$Slogan = GUICtrlCreateLabel($Qmark & "Every Order" & $Comma & " Every Time" & $Qmark, 525, 40, 200, 20)
GUICtrlSetFont(-1, 14, 800, 2, "Tw Cen MT")
#endregion ; $Slogan
 
#region ; $gHorBar1
$gHorBar1 = GUICtrlCreateGraphic(175, 125, 600, 15)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gHorBar1
 
#region ; $gHorBar2
$gHorBar2 = GUICtrlCreateGraphic(475, 105, 400, 20)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gHorBar2
 
#region ; $gVertBar1
$gVertBar1 = GUICtrlCreateGraphic(175, 125, 15, 550)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gVertBar1
 
#region ; $gVertBar2
$gVertBar2 = GUICtrlCreateGraphic(10, 428, 125, 200)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gVertBar2
 
#region ; $Input1
$Input1 = GUICtrlCreateInput("", 503, 112, 250, 20)
GUICtrlSetOnEvent(-1, "Input1ENTER")
#endregion ; $Input1
 
#region ; $mButton1
$mButton1 = GUICtrlCreateLabel(@CR & "SEND PROGRAM", 10, 212, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 7)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0x868686)
#endregion ; $mButton1
 
#region ; $mButton2
$mButton2 = GUICtrlCreateLabel(@CR & "TOOL BOX", 10, 266, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 7)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0x868686)
#endregion ; $mButton2
 
#region ; $mButton3
$mButton3 = GUICtrlCreateLabel(@CR & "LOGIN", 10, 320, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 0)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion ; $mButton3
 
#region ; $mButton4
$mButton4 = GUICtrlCreateLabel(@CR & "RESET", 10, 374, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 0)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion ; $mButton4
 
#region ; $Clock
$Clock = GUICtrlCreateLabel(@CR & $cDay & "/" & $cMonth & "/" & $cYear & " - " & $cHour - 12 & ":" & $cMin, 10, 428, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 0)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion ; $Clock
 
$gdi_Logo = 0
$LOGO = 0
GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT
 
GUISetState(@SW_SHOW, "MainGUI")
#endregion ; Main GUI begins here:
 
AdlibRegister("ClockSetTime", 15000)
 
_GDIPlus_Startup()
$gdi_Logo = _GDIPlus_ImageLoadFromFile("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_title_sm.PNG")
$LOGO = _GDIPlus_GraphicsCreateFromHWND($MainGUI)
_GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
 
While 1
    Sleep(10)
WEnd
 
Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT
 
Func ClockSetTime()
    GUICtrlSetData($Clock, @CR & @MDAY & "/" & @MON & "/" & @YEAR & " - " & @HOUR - 12 & ":" & @MIN)
EndFunc   ;==>ClockSetTime
 
#region ;Functions begin here:
Func MainGUIClose()
    _GDIPlus_GraphicsDispose($gdi_Logo)
    _GDIPlus_ImageDispose($LOGO)
    _GDIPlus_Shutdown()
    GUIDelete($MainGUI)
    Exit
EndFunc   ;==>MainGUIClose
 
Func Input1ENTER()
    Search()
    GUICtrlSetColor($mButton1, 0xFFFFFF)
    GUICtrlSetColor($mButton2, 0xFFFFFF)
    GUICtrlSetCursor($mButton1, 0)
    GUICtrlSetCursor($mButton2, 0)
    GUICtrlSetData($Input1, "")
    GUICtrlSetStyle($Input1, $ES_READONLY)
EndFunc   ;==>Input1ENTER
 
Func Search()
    $InputData = GUICtrlRead($Input1)
    $SearchResults = _RecFileListToArray("Z:\", $InputData & ".lst*", 1, 1, 1, 2)
    If @error Then
        MsgBox(1, "FAIL", "FAIL" & @error)
    ElseIf IsArray($SearchResults) Then
        _ArrayDisplay($SearchResults, "Results")
    EndIf
EndFunc   ;==>Search
 
Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST
 
Func MainGUIMaximize()
 
EndFunc   ;==>MainGUIMaximize
 
Func MainGUIMinimize()
 
EndFunc   ;==>MainGUIMinimize
 
Func MainGUIRestore()
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
EndFunc   ;==>MainGUIRestore
#endregion ;Functions begin here:
 
 
 
 
 
 
 
#region ;DynamicGUI begins here:
 
#endregion ;DynamicGUI begins here:
Br, FireFox.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Wombat

A few things:

-Your while code is very messy, the main while is never looped and you use GUIGetMsg multiple times whereas you previously set an onevent mode.

I noticed it was messy, but the code was producing the desired effect, your edit helped as the GUI is more responsive.

However, what do you mean about the code using GUIGetMsg multiple times?? I only use it once and that is when the enter key is pressed while the input is focused. Please explain.

 

-Use a GUI handle for the GUIDelete function.

is this necessary? I was wanting the window to only be closeable via the Esc key.

My code with your advised edits...

CODE:

#region ; Pre-GUI

#region ; Includes begin here:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include <_RecFileListToArray.au3>
#include <String.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <Toast.au3>
#include <GUICtrlOnHover.au3>
#NoTrayIcon
#endregion ; Includes end here;;;;;;;;;;;;;;;;;

#region ; Options are set here:
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
#endregion ; Options end here:

#region ; Special Chr and coding begins here:
Global $Qmark = Chr(34)
Global $Comma = Chr(44)
Global $InputDef = "Program Currently Loaded: "
Global $cHour = @HOUR
Global $cMin = @MIN
Global $cDay = @MDAY
Global $cMonth = @MON
Global $cYear = @YEAR
Global $Pointer
Global $InputData
Global $SelectProgramList
Global $SearchResults
Global $sPath
Global $sLabel
Global $CurrentProgram
Global $SendValue = False
Global $TBValue = False
Global $LoginValue = False
#endregion ; Special Chr and coding begins here:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SPLASH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;$Splash = GUICreate("SPLASH", 588.5, 200, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
;GUISetBkColor(0xFFFFFF)
;$pSplash = GUICtrlCreatePic("C:\prog_res\Lab\test_res\storm_newlogo_TEST.jpg",0,0,588.5,200)
;GUISetState(@SW_SHOW, "SPLASH")
;Sleep(2000)
;GUIDelete("SPLASH")
;Sleep(10)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#region ; Main GUI begins here:

#region ; $MainGUI
$MainGUI = GUICreate("MainGUI", 774, 580, Default, Default, BitOR($WS_THICKFRAME, $WS_POPUP))
GUISetBkColor(0xFFFFFF)
GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainGUIMinimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainGUIMaximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "MainGUIRestore")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
#endregion ; $MainGUI

#region ; Invisible Blocks behind buttons:
#region ; $Block1
$Block1 = GUICtrlCreateGraphic(10, 252, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block1

#region ; $Block2
$Block2 = GUICtrlCreateGraphic(10, 306, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block2

#region ; $Block3
$Block3 = GUICtrlCreateGraphic(10, 360, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block3

#region ; $Block4
$Block4 = GUICtrlCreateGraphic(10, 414, 125, 15)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block4

#region ; $Block5
$Block5 = GUICtrlCreateGraphic(0, 212, 10, 400)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0xFFFFFF)
#endregion ; $Block5

#endregion ; Invisible Blocks end here:

#region ; $Slogan
$Slogan = GUICtrlCreateLabel($Qmark & "Every Order" & $Comma & " Every Time" & $Qmark, 525, 40, 200, 20)
GUICtrlSetFont(-1, 12, 800, 0, "Arimo")
#endregion ; $Slogan

#region ; Black frame around data:
#region ; $gHorBar1
$gHorBar1 = GUICtrlCreateGraphic(175, 125, 600, 15)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gHorBar1

#region ; $gHorBar2
$gHorBar2 = GUICtrlCreateGraphic(475, 105, 400, 20)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gHorBar2

#region ; $gVertBar1
$gVertBar1 = GUICtrlCreateGraphic(175, 125, 15, 550)
GUICtrlSetBkColor(-1, 0x3B3B3B)
GUICtrlSetState(-1, $GUI_DISABLE)
#endregion ; $gVertBar1

#region ; $gVertBar2
$gVertBar2 = GUICtrlCreateGraphic(10, 428, 125, 200)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
#endregion ; $gVertBar2

#region ; $Input1
$Input1 = GUICtrlCreateInput("", 503, 112, 250, 20)
GUICtrlSetOnEvent(-1, "Input1ENTER")
#endregion ; $Input1
#endregion ; Black frame around data:

#region ; MainGUI Buttons:
#region ; $mButton1
$mButton1 = GUICtrlCreateLabel(@CR & "SEND PROGRAM", 10, 212, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button1_Hover", "Button1_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "_Send_Program")
#endregion ; $mButton1

#region ; $mButton2
$mButton2 = GUICtrlCreateLabel(@CR & "TOOL BOX", 10, 266, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button2_Hover", "Button2_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "_Tool_Box")
#endregion ; $mButton2

#region ; $mButton3
$mButton3 = GUICtrlCreateLabel(@CR & "LOGIN", 10, 320, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button3_Hover", "Button3_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "_Login")
#endregion ; $mButton3

#region ; $mButton4
$mButton4 = GUICtrlCreateLabel(@CR & "RESET", 10, 374, 125, 40, $SS_CENTER)
_GUICtrl_OnHoverRegister(-1, "Button4_Hover", "Button4_LeaveHover")
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetOnEvent(-1, "Reset")
#endregion ; $mButton4
#endregion ; MainGUI Buttons:

#region ; $Clock
$Clock = GUICtrlCreateLabel(@CR & $cDay & "/" & $cMonth & "/" & $cYear & " - " & $cHour - 12 & ":" & $cMin, 10, 428, 125, 40, $SS_CENTER)
GUICtrlSetCursor(-1, 16)
GUICtrlSetBkColor(-1, 0x353535)
GUICtrlSetColor(-1, 0xFFFFFF)
#endregion ; $Clock

$gdi_Logo = 0
$LOGO = 0
GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT

GUISetState(@SW_SHOW, "MainGUI")
#endregion ; Main GUI begins here:
#endregion

#region ; Post-GUI
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND");GUI watches for double click

AdlibRegister("ClockSetTime", 15000);Check and update clock every 15 seconds

$msg = GUIGetMsg()
If $msg = $Input1 Then Input1ENTER();Read ENTER key being pressed while Input is focused

_GDIPlus_Startup()
$gdi_Logo = _GDIPlus_ImageLoadFromFile("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_title_sm.PNG")
$LOGO = _GDIPlus_GraphicsCreateFromHWND($MainGUI)
_GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)

While 1
    Sleep(100)
WEnd

#region ;Functions begin here:

#region ; GUICtrl Functions:

Func ClockSetTime()
    GUICtrlSetData($Clock, @CR & @MDAY & "/" & @MON & "/" & @YEAR & " - " & @HOUR - 12 & ":" & @MIN)
EndFunc   ;==>ClockSetTime

Func Search()
    Local $SearchPath = FileRead(@ScriptDir & "\test_res\PSS_T500_FilePath_Holder.txt")
    Local $InputData = GUICtrlRead($Input1)
    Local $SearchResults = _RecFileListToArray($SearchPath, $InputData & "*.lst*", 1, 1, 0, 2)
    If @error Then
        Local $eNote = _Toast_Show(0, "Error Code = " & @error, "Unable to locate file", 5)
        _Toast_Hide()
    Else
        Local $tResults = _ArrayToString($SearchResults)
        $sLabel = GUICtrlCreateLabel("Choose a program to begin: ", 275, 175, 200, 20)
        $SelectProgramList = GUICtrlCreateList("", 275, 200, 400, 100)
        GUICtrlSetData(-1, $tResults)

    EndIf
EndFunc   ;==>Search

Func Input1ENTER()
    GUICtrlDelete($sLabel)
    GUICtrlDelete($SelectProgramList)
    Search()
    GUICtrlSetData($Input1, "")
EndFunc   ;==>Input1ENTER

Func Display_Results()
        $SendValue = True
        $TBValue = True
        $LoginValue = True

EndFunc

Func _Send_Program()
    If $SendValue = False Then
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$SendValue' & @lf & @lf & 'Return:' & @lf & $SendValue) ;### Debug MSGBOX
    Else
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$SendValue' & @lf & @lf & 'Return:' & @lf & $SendValue) ;### Debug MSGBOX
    EndIf
EndFunc

Func _Tool_Box()
    If $TBValue = False Then
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$TBValue' & @lf & @lf & 'Return:' & @lf & $TBValue) ;### Debug MSGBOX
    Else
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$TBValue' & @lf & @lf & 'Return:' & @lf & $TBValue) ;### Debug MSGBOX
    EndIf
EndFunc

Func _Login()
    If $LoginValue = False Then
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$LoginValue' & @lf & @lf & 'Return:' & @lf & $LoginValue) ;### Debug MSGBOX
    Else
        MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$LoginValue' & @lf & @lf & 'Return:' & @lf & $LoginValue) ;### Debug MSGBOX
    EndIf
EndFunc

#endregion

#region ; Drag&Drop, GDI-PNG-Drawing, and Window Dragging Functions:

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam);Dbl-clk processing

    #forceref $hWnd, $iMsg, $lParam

    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word

    Switch $iCode
        Case $LBN_DBLCLK
            Switch $iIDFrom
                Case $SelectProgramList
                    $CurrentProgram = GUICtrlRead($SelectProgramList) ; Use the native function
                    GUICtrlDelete($SelectProgramList)
                    GUICtrlDelete($sLabel)
                    Display_Results()
            EndSwitch
    EndSwitch

EndFunc   ;==>_WM_COMMAND

Func WM_PAINT($MainGUI, $iMsg, $wParam, $lParam);PNG drawing
    _GDIPlus_GraphicsDrawImage($LOGO, $gdi_Logo, -25, -435)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam);Window Dragging
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST
#endregion

#region ; Window-Control Functions:

Func MainGUIClose();Shuts down and disposes of GDI elements, Deletes GUI and exits script
    _GDIPlus_GraphicsDispose($gdi_Logo)
    _GDIPlus_ImageDispose($LOGO)
    _GDIPlus_Shutdown()
    GUIDelete("MainGUI")
    Exit
EndFunc   ;==>MainGUIClose

Func Reset();Exits, then runs the script again, thus resetting it
    If @Compiled Then
        Run(FileGetShortName(@ScriptFullPath))
    Else
        Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc   ;==>Reset

Func MainGUIMaximize()

EndFunc   ;==>MainGUIMaximize

Func MainGUIMinimize()

EndFunc   ;==>MainGUIMinimize

Func MainGUIRestore()

EndFunc   ;==>MainGUIRestore
#endregion

#region ; Hover Functions:
Func Button1_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 220, 26, 25)
EndFunc   ;==>Button1_Hover

Func Button1_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button1_LeaveHover

Func Button2_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 274, 26, 25)
EndFunc   ;==>Button2_Hover

Func Button2_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button2_LeaveHover

Func Button3_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 328, 26, 25)
EndFunc   ;==>Button3_Hover

Func Button3_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button3_LeaveHover

Func Button4_Hover()
    $Pointer = GUICtrlCreatePic("C:\Users\Wombat\workshop\Lab\test_res\storm_newlogo_pointer.jpg", 140, 382, 26, 25)
EndFunc   ;==>Button4_Hover

Func Button4_LeaveHover()
    GUICtrlDelete($Pointer)
EndFunc   ;==>Button4_LeaveHover
#endregion

#endregion ;Functions begin here:
Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
FireFox

What you don't understand is that the GUIGetMsg function can NOT work if the GUIOnEventMode is set to 1.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Wombat

so GUIGetMsg is used for Loop mode, and wont work in GUIOnEventMode,

It seemed as though it was working but that was not the case as the input had an OnEvent Function that was actually executing.

My bad, and thank you for teaching me something I should already know as it's such a basic part of the language.


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
FireFox

You're welcome ;)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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  

×