Sign in to follow this  
Followers 0
ZanaxNL

How can i make 2x GuiCreate work?

4 posts in this topic

Hey,

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hGui, $guiPos, $pic, $picPos
Global $n, $msg, $aM

$hGUI = GUICreate("test1", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
; ///// Here must a anothere GUICreate, like ($hGUI = GUICreate("test1", 100, 100, -100, -100, $WS_POPUP, $WS_EX_TOPMOST))
; ///// How can i make that work? what i tried didnt work : (

GUISetBkColor(0xFB0000)

GUISetState()

HotKeySet("{ESC}", "_Exit")
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then _Exit()
    $aM = MouseGetPos()
    WinMove($hGUI, "", $aM[0] + 5, $aM[1] + 5)
WEnd

Func _Exit()
    GUIDelete()
    Exit
EndFunc

How can i make it work?

for me its a hard to find out i tried and failed.

i gues its easy for the must of u

but i dont got expierence with it : (

thx

Zanax

Share this post


Link to post
Share on other sites



With Multiple GUI's I would recommend looking at the Wiki page >> http://www.autoitscript.com/wiki/Managing_Multiple_GUIs

But for the code above this will show both GUI's >>

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hGUI_1, $hGUI_2
Global $aMouseGetPos

$hGUI_1 = GUICreate("Test_1", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$hGUI_2 = GUICreate("Test_2", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)

GUISetBkColor(0xFB0000, $hGUI_1)

GUISetState(@SW_SHOW, $hGUI_1) ; Show both GUI's
GUISetState(@SW_SHOW, $hGUI_2)

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

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then
        _Exit()
    EndIf
    $aMouseGetPos = MouseGetPos()
    WinMove($hGUI_1, "", $aMouseGetPos[0] + 5, $aMouseGetPos[1] + 5)
    WinMove($hGUI_2, "", ($aMouseGetPos[0] + 5) - 100, ($aMouseGetPos[1] + 5) - 100) ; Offset by -100.
WEnd

Func _Exit()
    GUIDelete($hGUI_1)
    GUIDelete($hGUI_2)
    Exit
EndFunc   ;==>_Exit

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Or for a multicoloured effect >>

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hGUI_1, $hGUI_2, $hGUI_3, $hGUI_4
Global $aMouseGetPos

$hGUI_1 = GUICreate("Test_1", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$hGUI_2 = GUICreate("Test_2", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$hGUI_3 = GUICreate("Test_3", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$hGUI_4 = GUICreate("Test_4", 100, 100, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)

GUISetBkColor(0xFB0000, $hGUI_1)
GUISetBkColor(0x00FF00, $hGUI_2)
GUISetBkColor(0x00FFB9, $hGUI_3)
GUISetBkColor(0x00FFFF, $hGUI_4)

GUISetState(@SW_SHOW, $hGUI_1) ; Show All GUI's
GUISetState(@SW_SHOW, $hGUI_2)
GUISetState(@SW_SHOW, $hGUI_3)
GUISetState(@SW_SHOW, $hGUI_4)

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

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then
        _Exit()
    EndIf
    $aMouseGetPos = MouseGetPos()
    WinMove($hGUI_1, "", $aMouseGetPos[0] + 5, $aMouseGetPos[1] + 5)
    WinMove($hGUI_2, "", ($aMouseGetPos[0] + 5) - 100, ($aMouseGetPos[1] + 5) - 100)
    WinMove($hGUI_3, "", ($aMouseGetPos[0] + 5) - 100, ($aMouseGetPos[1] + 5))
    WinMove($hGUI_4, "", ($aMouseGetPos[0] + 5), ($aMouseGetPos[1] + 5) -100)
WEnd

Func _Exit()
    GUIDelete($hGUI_1)
    GUIDelete($hGUI_2)
    GUIDelete($hGUI_3)
    GUIDelete($hGUI_4)
    Exit
EndFunc   ;==>_Exit
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Got it thank u : )

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