Juvigy Posted November 27, 2012 Share Posted November 27, 2012 I have 3 GUI that are running. But when i do something like: While 1 $msg1 = GUIGetMsg($hGui2) $msg = TrayGetMsg() $msg2 = GUIGetMsg($hGUI3) If $msg1 = $GUI_EVENT_CLOSE Then GUIDelete($hGui2) if UBound($test2)>1 then ShowMsg($test2[1]) $test2 = 0 EndIf EndIf Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem TrayItemSetState($aboutitem,4) Case $msg = $exititem $test2 = 0 GUIDelete($hGui2) ExitLoop EndSelect WEnd It doesnt work. When i press the X on the corner to close one of the GUIs it doesnt work. If i right click and select "close" it works. Anything that i am doing wrong? Whole script is huge to post it here. One of the GUIs is for output of msgs, the other one is dummy for the tray and the third is for GUIregistermsg purposes. Link to comment Share on other sites More sharing options...
water Posted November 27, 2012 Share Posted November 27, 2012 The wiki has a very good tutorial that describes how to manage multiple GUIs: http://www.autoitscript.com/wiki/Managing_Multiple_GUIs My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Juvigy Posted November 29, 2012 Author Share Posted November 29, 2012 (edited) The wiki has a very good tutorial that describes how to manage multiple GUIs: http://www.autoitscript.com/wiki/Managing_Multiple_GUIs Thanks i have missed the parameter. Now i have this which works if i press the X of the GUI , but doesnt work if i press the exit button. Switch $aMsg[1] ; First check which GUI sent the message Case $hGui2 Switch $aMsg[0] ; Now check for the messages sent from $hGui2 Case $GUI_EVENT_CLOSE GUIDelete($hGui2) if UBound($test2)>1 then ShowMsg($test2[1]) $test2 = 0 EndIf Case $Exitbutton GUIDelete($hGui2) ConsoleWrite($Exitbutton&@CRLF) EndSwitch EndSwitch Edited November 29, 2012 by Juvigy Link to comment Share on other sites More sharing options...
guinness Posted November 29, 2012 Share Posted November 29, 2012 Juvigy, You should know by now that when posting code use the [autoit][/autoit] tags. Secondly, post a small reproducer we can look at or try and debug the code yourself. by taking parts out and stripping it back. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Juvigy Posted November 29, 2012 Author Share Posted November 29, 2012 I tried debugging but couldnt find anything. The button is created as i see it on the GUI. Just pressing it doesnt have any effect. The GUI creation is in the ShowMsg() function : expandcollapse popup$hGui2=GUICreate('', $iW, $iH,(@DesktopWidth-$iW)/2,(@DesktopHeight-$iH)/2,$WS_CAPTION+$WS_POPUP+$WS_SYSMENU,$WS_EX_TOPMOST) GUISetBkColor(0xff0001, $hGui2) $Label11 = GUICtrlCreateLabel("", 0, 0, $iW/2+50,20) $Label12 = GUICtrlCreateLabel("", $iW/2, 0, $iW/2,20) $Label21 = GUICtrlCreateLabel("", 0, 20, $iW/2,20) $Label22 = GUICtrlCreateLabel("", $iW/2, 20, $iW/2,20) $Label31 = GUICtrlCreateLabel("", 0, 40, $iW/2+50,20) $Label32 = GUICtrlCreateLabel("", $iW/2, 40, $iW/2,20) $Label41 = GUICtrlCreateLabel("", 0, 60, $iW/2,20) $Label42 = GUICtrlCreateLabel("", $iW/2, 60, $iW/2,20) $Label51 = GUICtrlCreateLabel("", 0, 80, $iW/2+50,20) $Label52 = GUICtrlCreateLabel("", $iW/2, 80, $iW/2,20) $Label61 = GUICtrlCreateLabel("", 0, 100, $iW/2,20) $Label62 = GUICtrlCreateLabel("", $iW/2, 100, $iW/2,20) $Label71 = GUICtrlCreateLabel("", 0, 120, $iW/2,20) $Label72 = GUICtrlCreateLabel("", $iW/2, 120, $iW/2,20) $Exitbutton = GUICtrlCreateButton("Exit", 0, $iH-30, $iW,30) ConsoleWrite($Exitbutton&@CRLF) GUICtrlSetFont($Label11, 10, 700) GUICtrlSetFont($Label12, 10, 700) GUICtrlSetFont($Label21, 10, 700) GUICtrlSetFont($Label22, 10, 700) GUICtrlSetFont($Label31, 10, 700) GUICtrlSetFont($Label32, 10, 700) GUICtrlSetFont($Label41, 10, 700) GUICtrlSetFont($Label42, 10, 700) GUICtrlSetFont($Label51, 10, 700) GUICtrlSetFont($Label52, 10, 700) GUICtrlSetFont($Label61, 10, 700) GUICtrlSetFont($Label62, 10, 700) GUICtrlSetFont($Label71, 10, 700) GUICtrlSetFont($Label72, 10, 700) GUICtrlSetBkColor($Label11,0xBFCFFF) GUICtrlSetBkColor($Label12,0xBFCFFF) GUICtrlSetBkColor($Label21,0xBFCFFF) GUICtrlSetBkColor($Label22,0xBFCFFF) GUICtrlSetBkColor($Label31,0xBFCFFF) GUICtrlSetBkColor($Label32,0xBFCFFF) GUICtrlSetBkColor($Label41,0xBFCFFF) GUICtrlSetBkColor($Label42,0xBFCFFF) GUICtrlSetBkColor($Label51,0xBFCFFF) GUICtrlSetBkColor($Label52,0xBFCFFF) GUICtrlSetBkColor($Label61,0xBFCFFF) GUICtrlSetBkColor($Label62,0xBFCFFF) GUICtrlSetBkColor($Label71,0xBFCFFF) GUICtrlSetBkColor($Label72,0xBFCFFF) GUICtrlSetData($Label11,"User Name is:") GUICtrlSetData($Label12,$users[$test][0]) GUICtrlSetData($Label21,"Phone Number:") GUICtrlSetData($Label22,$users[$test][1]) GUICtrlSetData($Label31,"Location:") GUICtrlSetData($Label32,$users[$test][2]) GUICtrlSetData($Label41,"Department:") GUICtrlSetData($Label42,$users[$test][3]) GUICtrlSetData($Label51,"Function:") GUICtrlSetData($Label52,$users[$test][4]) GUICtrlSetData($Label61,"Line Manager:") GUICtrlSetData($Label62,$users[$test][5]) GUICtrlSetData($Label71,"You have typed:") GUICtrlSetData($Label72,$users[$test][6]) ;~ GUISetState(@SW_SHOW, $hGui2) GUISetState() EndFunc Link to comment Share on other sites More sharing options...
water Posted November 29, 2012 Share Posted November 29, 2012 Unfortunately we can't help you because the code you posted is incomplete. Where do you check the button? As guinness posted: We need a small reproducer script! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Juvigy Posted November 29, 2012 Author Share Posted November 29, 2012 (edited) Hi Water , See my prev. post (the edited one) - there is where i check for the button. I will see what i can conjure for a reprodicer. Edit: Cant make a small script reproducer - it works if i make only th show function and the main while loop... Edited November 29, 2012 by Juvigy Link to comment Share on other sites More sharing options...
guinness Posted November 29, 2012 Share Posted November 29, 2012 Edit:Cant make a small script reproducer - it works if i make only th show function and the main while loop...Post the reproducer you made. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Juvigy Posted December 5, 2012 Author Share Posted December 5, 2012 The reprodicer is not a good one - it works as intended. In my bigger script it doesnt work. It doesnt make sense the $gui_event_close to work and the button , not to work. expandcollapse popupGlobal $result ,$users, $FilePath = "C:File.xlsm" Global $hGui2, $but,$Label, $iW = 500, $iH = 230,$test2,$Exitbutton Opt("TrayMenuMode",1) $aboutitem = TrayCreateItem("About") TrayCreateItem("") $lastitem = TrayCreateItem("Last") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() TraySetToolTip("VIPMaster 1.0") TraySetIcon("Shell32.dll",-18) $hGUI3 = GUICreate("Clipboard",10,10) GUISetState(@SW_HIDE) ; Initialize clipboard viewer $hNext = _ClipBoard_SetViewer ($hGUI3) GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN") GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD") ShowMsg() While 1 $msg = TrayGetMsg() $aMsg = GUIGetMsg(1) ; Use advanced parameter to get an array returned Switch $aMsg[1] ; First check which GUI sent the message Case $hGui2 Switch $aMsg[0] ; Now check for the messages sent from $hGui2 Case $GUI_EVENT_CLOSE GUIDelete($hGui2) Case $Exitbutton GUIDelete($hGui2) ConsoleWrite($Exitbutton&@CRLF) EndSwitch EndSwitch WEnd Exit Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam) ; If the next window is closing, repair the chain If $iwParam = $hNext Then $hNext = $ilParam ; Otherwise pass the message to the next viewer ElseIf $hNext <> 0 Then _SendMessage ($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd") EndIf EndFunc ;==>WM_CHANGECBCHAIN ; Handle WM_DRAWCLIPBOARD messages Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam) local $j,$clip If $j <= 9 Then $clip[$j] = _ClipBoard_GetData () $j+=1 Else $j = 0 $clip[$j] = _ClipBoard_GetData () $j+=1 EndIf ;~ MsgBox(0,"",_ClipBoard_GetData () & @CRLF) ; Pass the message to the next viewer If $hNext <> 0 Then _SendMessage ($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam) EndFunc ;==>WM_DRAWCLIPBOARD Func ShowMsg() $hGui2=GUICreate('', $iW, $iH,(@DesktopWidth-$iW)/2,(@DesktopHeight-$iH)/2,$WS_CAPTION+$WS_POPUP+$WS_SYSMENU,$WS_EX_TOPMOST) GUISetIcon("C:test2WebexConnect.ico") GUISetBkColor(0xff0001, $hGui2) $Label11 = GUICtrlCreateLabel("", 0, 0, $iW/2+50,20) $Label12 = GUICtrlCreateLabel("", $iW/2, 0, $iW/2,20) $Label21 = GUICtrlCreateLabel("", 0, 20, $iW/2,20) $Label22 = GUICtrlCreateLabel("", $iW/2, 20, $iW/2,20) $Label31 = GUICtrlCreateLabel("", 0, 40, $iW/2+50,20) $Label32 = GUICtrlCreateLabel("", $iW/2, 40, $iW/2,20) $Label41 = GUICtrlCreateLabel("", 0, 60, $iW/2,20) $Label42 = GUICtrlCreateLabel("", $iW/2, 60, $iW/2,20) $Label51 = GUICtrlCreateLabel("", 0, 80, $iW/2+50,20) $Label52 = GUICtrlCreateLabel("", $iW/2, 80, $iW/2,20) $Label61 = GUICtrlCreateLabel("", 0, 100, $iW/2,20) $Label62 = GUICtrlCreateLabel("", $iW/2, 100, $iW/2,20) $Label71 = GUICtrlCreateLabel("", 0, 120, $iW/2,20) $Label72 = GUICtrlCreateLabel("", $iW/2, 120, $iW/2,20) $Exitbutton = GUICtrlCreateButton("Exit", 0, $iH-30, $iW,28) GUICtrlSetFont($Label11, 10, 700) GUICtrlSetFont($Label12, 10, 700) GUICtrlSetFont($Label21, 10, 700) GUICtrlSetFont($Label22, 10, 700) GUICtrlSetFont($Label31, 10, 700) GUICtrlSetFont($Label32, 10, 700) GUICtrlSetFont($Label41, 10, 700) GUICtrlSetFont($Label42, 10, 700) GUICtrlSetFont($Label51, 10, 700) GUICtrlSetFont($Label52, 10, 700) GUICtrlSetFont($Label61, 10, 700) GUICtrlSetFont($Label62, 10, 700) GUICtrlSetFont($Label71, 10, 700) GUICtrlSetFont($Label72, 10, 700) GUICtrlSetBkColor($Label11,0xBFCFFF) GUICtrlSetBkColor($Label12,0xBFCFFF) GUICtrlSetBkColor($Label21,0xBFCFFF) GUICtrlSetBkColor($Label22,0xBFCFFF) GUICtrlSetBkColor($Label31,0xBFCFFF) GUICtrlSetBkColor($Label32,0xBFCFFF) GUICtrlSetBkColor($Label41,0xBFCFFF) GUICtrlSetBkColor($Label42,0xBFCFFF) GUICtrlSetBkColor($Label51,0xBFCFFF) GUICtrlSetBkColor($Label52,0xBFCFFF) GUICtrlSetBkColor($Label61,0xBFCFFF) GUICtrlSetBkColor($Label62,0xBFCFFF) GUICtrlSetBkColor($Label71,0xBFCFFF) GUICtrlSetBkColor($Label72,0xBFCFFF) GUICtrlSetData($Label11,"User Name is:") GUICtrlSetData($Label12,1) GUICtrlSetData($Label21,"Phone Number:") GUICtrlSetData($Label22,2) GUICtrlSetData($Label31,"Location:") GUICtrlSetData($Label32,3) GUICtrlSetData($Label41,"Department:") GUICtrlSetData($Label42,4) GUICtrlSetData($Label51,"Function:") GUICtrlSetData($Label52,5) GUICtrlSetData($Label61,"Line Manager:") GUICtrlSetData($Label62,6) GUICtrlSetData($Label71,"You have typed:") GUICtrlSetData($Label72,7) GUISetState() EndFunc Link to comment Share on other sites More sharing options...
kylomas Posted December 6, 2012 Share Posted December 6, 2012 Juvigy, The reprodicer is not a good one - it works as intended Does it? After I added the includes and a case statement following the traygetmsg() it worked. It is doing exactly what you are telling it to do when you action the exit button in $hgui2. Modified code expandcollapse popup#include <GUIConstantsEx.au3> #include <Clipboard.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Global $result, $users; , $FilePath = "C:File.xlsm" Global $hGui2, $but, $Label, $iW = 500, $iH = 230, $test2, $Exitbutton Opt("TrayMenuMode", 1) $aboutitem = TrayCreateItem("About") TrayCreateItem("") $lastitem = TrayCreateItem("Last") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() TraySetToolTip("VIPMaster 1.0") TraySetIcon("Shell32.dll", -18) $hGUI3 = GUICreate("Clipboard", 10, 10) GUISetState(@SW_HIDE) ; Initialize clipboard viewer $hNext = _ClipBoard_SetViewer($hGUI3) GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN") GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD") ShowMsg() While 1 $msg = TrayGetMsg() switch $msg case $exititem Exit endswitch $aMsg = GUIGetMsg(1) ; Use advanced parameter to get an array returned Switch $aMsg[1] ; First check which GUI sent the message Case $hGui2 Switch $aMsg[0] ; Now check for the messages sent from $hGui2 Case $GUI_EVENT_CLOSE GUIDelete($hGui2) Case $Exitbutton GUIDelete($hGui2) ConsoleWrite($Exitbutton & @CRLF) EndSwitch EndSwitch WEnd Exit Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam) ; If the next window is closing, repair the chain If $iwParam = $hNext Then $hNext = $ilParam ; Otherwise pass the message to the next viewer ElseIf $hNext <> 0 Then _SendMessage($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd") EndIf EndFunc ;==>WM_CHANGECBCHAIN ; Handle WM_DRAWCLIPBOARD messages Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam) Local $j, $clip If $j <= 9 Then $clip[$j] = _ClipBoard_GetData() $j += 1 Else $j = 0 $clip[$j] = _ClipBoard_GetData() $j += 1 EndIf ;~ MsgBox(0,"",_ClipBoard_GetData () & @CRLF) ; Pass the message to the next viewer If $hNext <> 0 Then _SendMessage($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam) EndFunc ;==>WM_DRAWCLIPBOARD Func ShowMsg() $hGui2 = GUICreate('', $iW, $iH, (@DesktopWidth - $iW) / 2, (@DesktopHeight - $iH) / 2, $WS_CAPTION + $WS_POPUP + $WS_SYSMENU, $WS_EX_TOPMOST) GUISetIcon("C:test2WebexConnect.ico") GUISetBkColor(0xff0001, $hGui2) $Label11 = GUICtrlCreateLabel("", 0, 0, $iW / 2 + 50, 20) $Label12 = GUICtrlCreateLabel("", $iW / 2, 0, $iW / 2, 20) $Label21 = GUICtrlCreateLabel("", 0, 20, $iW / 2, 20) $Label22 = GUICtrlCreateLabel("", $iW / 2, 20, $iW / 2, 20) $Label31 = GUICtrlCreateLabel("", 0, 40, $iW / 2 + 50, 20) $Label32 = GUICtrlCreateLabel("", $iW / 2, 40, $iW / 2, 20) $Label41 = GUICtrlCreateLabel("", 0, 60, $iW / 2, 20) $Label42 = GUICtrlCreateLabel("", $iW / 2, 60, $iW / 2, 20) $Label51 = GUICtrlCreateLabel("", 0, 80, $iW / 2 + 50, 20) $Label52 = GUICtrlCreateLabel("", $iW / 2, 80, $iW / 2, 20) $Label61 = GUICtrlCreateLabel("", 0, 100, $iW / 2, 20) $Label62 = GUICtrlCreateLabel("", $iW / 2, 100, $iW / 2, 20) $Label71 = GUICtrlCreateLabel("", 0, 120, $iW / 2, 20) $Label72 = GUICtrlCreateLabel("", $iW / 2, 120, $iW / 2, 20) $Exitbutton = GUICtrlCreateButton("Exit", 0, $iH - 30, $iW, 28) GUICtrlSetFont($Label11, 10, 700) GUICtrlSetFont($Label12, 10, 700) GUICtrlSetFont($Label21, 10, 700) GUICtrlSetFont($Label22, 10, 700) GUICtrlSetFont($Label31, 10, 700) GUICtrlSetFont($Label32, 10, 700) GUICtrlSetFont($Label41, 10, 700) GUICtrlSetFont($Label42, 10, 700) GUICtrlSetFont($Label51, 10, 700) GUICtrlSetFont($Label52, 10, 700) GUICtrlSetFont($Label61, 10, 700) GUICtrlSetFont($Label62, 10, 700) GUICtrlSetFont($Label71, 10, 700) GUICtrlSetFont($Label72, 10, 700) GUICtrlSetBkColor($Label11, 0xBFCFFF) GUICtrlSetBkColor($Label12, 0xBFCFFF) GUICtrlSetBkColor($Label21, 0xBFCFFF) GUICtrlSetBkColor($Label22, 0xBFCFFF) GUICtrlSetBkColor($Label31, 0xBFCFFF) GUICtrlSetBkColor($Label32, 0xBFCFFF) GUICtrlSetBkColor($Label41, 0xBFCFFF) GUICtrlSetBkColor($Label42, 0xBFCFFF) GUICtrlSetBkColor($Label51, 0xBFCFFF) GUICtrlSetBkColor($Label52, 0xBFCFFF) GUICtrlSetBkColor($Label61, 0xBFCFFF) GUICtrlSetBkColor($Label62, 0xBFCFFF) GUICtrlSetBkColor($Label71, 0xBFCFFF) GUICtrlSetBkColor($Label72, 0xBFCFFF) GUICtrlSetData($Label11, "User Name is:") GUICtrlSetData($Label12, 1) GUICtrlSetData($Label21, "Phone Number:") GUICtrlSetData($Label22, 2) GUICtrlSetData($Label31, "Location:") GUICtrlSetData($Label32, 3) GUICtrlSetData($Label41, "Department:") GUICtrlSetData($Label42, 4) GUICtrlSetData($Label51, "Function:") GUICtrlSetData($Label52, 5) GUICtrlSetData($Label61, "Line Manager:") GUICtrlSetData($Label62, 6) GUICtrlSetData($Label71, "You have typed:") GUICtrlSetData($Label72, 7) GUISetState() EndFunc ;==>ShowMsg You are not making anyone terribly anxious to help you when you ignore simple advice like this You should know by now that when posting code use the "[autoit][/autoit]" tags. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now