-
Posts
47 -
Joined
-
Last visited
Everything posted by CodeTinkerer
-
Hello, Before I begin, let me mention I have indeed looked through various posts and examples of anything pertaining to WebSocket. One thread Thread had some motivation long ago but never took off. Another Thread ended in hits and lack of support. Any insight would be welcomed and appreciated In my current progress, I end up with a 400 bad request response, which is indicative that my message is not understood. #include "WinHttp.au3" #include <WinAPI.au3>;_WinAPI_GetLastError #include "JSON.au3" #include "JSON_Translate.au3" Global Const $ERROR_NOT_ENOUGH_MEMORY = 8 Global Const $ERROR_INVALID_PARAMETER = 87 Global Const $WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET = 114 Global Const $WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE = 0 Global Const $WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1 Global Const $WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000 Global $hOpen = 0, $hConnect = 0, $hRequest = 0, $hWebSocket = 0 Global $iError = 0 Example() Exit Func Example() Local $sServerName = "104.16.107.31" Local $sMessage = "Hello world" ; Create session, connection and request handles. $hOpen = _WinHttpOpen("WebSocket sample", $WINHTTP_ACCESS_TYPE_DEFAULT_PROXY) If $hOpen = 0 Then $iError = _WinAPI_GetLastError() ConsoleWrite("Open error" & @CRLF) Return False EndIf $hConnect = _WinHttpConnect($hOpen, "104.16.107.31", $INTERNET_DEFAULT_HTTP_PORT) If $hConnect = 0 Then $iError = _WinAPI_GetLastError() ConsoleWrite("Connect error" & @CRLF) Return False EndIf $hRequest = _WinHttpOpenRequest($hConnect, "POST", $sPath, "") If $hRequest = 0 Then $iError = _WinAPI_GetLastError() ConsoleWrite("OpenRequest error" & @CRLF) Return False EndIf ; Add header fields to the request _WinHttpAddRequestHeaders($hRequest, "Connection: Upgrade") _WinHttpAddRequestHeaders($hRequest, "Upgrade: websocket") ; Request protocol upgrade from http to websocket. ;~ Local $fStatus = _WinHttpSetOptionNoParams($hRequest, $WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET) ;~ If Not $fStatus Then ;~ $iError = _WinAPI_GetLastError() ;~ ConsoleWrite("SetOption error" & @CRLF) ;~ Return False ;~ EndIf ; Perform websocket handshake by sending a request and receiving server's response. ; Application may specify additional headers if needed. $fStatus = _WinHttpSendRequest($hRequest) If Not $fStatus Then $iError = _WinAPI_GetLastError() ConsoleWrite("SendRequest error" & @CRLF) Return False EndIf $fStatus = _WinHttpReceiveResponse($hRequest) If Not $fStatus Then $iError = _WinAPI_GetLastError() ConsoleWrite("SendRequest error" & @CRLF) Return False EndIf ConsoleWrite("HTTPResp: " & $fStatus & @CRLF) TCPStartup() Local $iSocket = TCPConnect($sServerName, 80) If @error Then ConsoleWrite("Error in TCP Connection" & @CRLF) Else ConsoleWrite("Connected to Socket: " & $iSocket & @CRLF) EndIf Local $s = '{' _ & '"type": "subscribe", ' _ & '"channels": [{"name": "ticker", ' _ & '"product_ids": ["ETH-EUR"]}]' _ & '}' $s = String($s) Local $t = _JSONEncode(_JSONDecode($s)) ConsoleWrite("RawJson: " & $s & @CRLF) ConsoleWrite("Encoded: " & $t & @CRLF) ;_CWrite("_JSONEncode:" & $s) TCPSend($iSocket, $t) If @error Then ConsoleWrite("Error in TCP Send " & @error & @CRLF) EndIf Local $irecv = TCPRecv($iSocket, 2048) If @error Then ConsoleWrite("Error in TCP Recv " & @error & @CRLF) Else ConsoleWrite("$irecv: >>> " & @CRLF & $irecv & @CRLF) Local $iListen = TCPListen($sServerName, 80) If @error Then ConsoleWrite("Error in TCP Listen " & @error & @CRLF) Else Do $iSocket = TCPAccept($iSocket) If @error Then ConsoleWrite("Error in TCP Accept" & @CRLF) ExitLoop Else ConsoleWrite("Recv: " & $iSocket & @CRLF) EndIf Until $iSocket < 0 EndIf EndIf EndFunc ;==>Example
-
Resizable Frame-less/Border-less GUI
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
Still attempting a solution for getting rid of this flicker issue. Would anyone know of an efficient way to have the window Re sized AFTER the drag operation on the window edges? -
Resizable Frame-less/Border-less GUI
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
I have attached the progress. to achieve full expand ability of the window I have altered the XSkin.au3 to my requirements such that vertical images are of a height at 1080px and horizontal images are a width of 1920px. the window also includes a listview with a background image of 1920x1080. Looks great! Functions well! But, there is a slight flickering problem when resizing the window and its much worse in an MDI environment with a background image on the parent window. This causes bright white flashes at a frequent interval when resizing the image. I am afraid that one of my users of the application I am working on might have epilepsy and I dont want to trigger that. Is there no way to rezise the window AFTER the drag is complete? sort of like Linux style window resizing? or even windows does it at some points but I could not re-create. skinnedWindow.zip -
Resizable Frame-less/Border-less GUI
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
Yes, I was just showing you what I was coming up with while I waited for a response. I did in fact take your example and assimilate it into my script. after close study and documentation of corse! I really appreciate it ! I plan to post the final result with resources once all the fine tuning is finished -
Resizable Frame-less/Border-less GUI
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
Melba, Thanks for your assistance and pointing me in the right direction. I was lost. I did however attempt to do as you said and identify which window was under the cursor and modify accordingly but alas my result was sloppy dysfunctional code lol. Here is what I tried: #include <GuiConstantsEx.au3> #include <Windowsconstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> #include <WinAPIsys.au3> #include <Misc.au3> Local $stPoint = DllStructCreate($tagPOINT), $aPos, $hControl, $hWin, $aLastPos[2] = [-1, -1], $sLastStr = '', $sStr HotKeySet("{ESC}", "On_Exit") ; Set distance from edge of window where resizing is possible Global Const $iMargin = 4 ; Set max and min GUI sizes Global Const $iGUIMinX = 50, $iGUIMinY = 50, $iGUIMaxX = 300, $iGUIMaxY = 300 ; Create GUI Global $hGUI = GUICreate("Y", 100, 100, -1, -1, $WS_POPUP) GUISetBkColor(0x00FFF0) GUISetState() Local $wPos = WinGetPos($hGUI) ; Create GUI Global $hGUI2 = GUICreate("Z", 100, 100, $wPos[0] + 101, -1, $WS_POPUP) GUISetBkColor(0x00FF00) GUISetState() ; Register message handlers GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") ; For resize/drag GUIRegisterMsg($WM_MOUSEMOVE, "_SetCursor") ; For cursor type change ;GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO") ; For GUI size limits $hCurr_HhWnd = 0 While 1 Sleep(10) WEnd ; Set cursor to correct resizing form if mouse is over a border Func _SetCursor() Local $iCursorID Local $iCursorID2 If _GethWndhWnd() = WinGetTitle($hGUI) Then Switch _GetBorder($hGUI) Case 0 $iCursorID = 2 Case 1, 2 $iCursorID = 13 Case 3, 6 $iCursorID = 11 Case 5, 7 $iCursorID = 10 Case 4, 8 $iCursorID = 12 EndSwitch GUISetCursor($iCursorID, 1) ElseIf _GethWndhWnd() = WinGetTitle($hGUI2) Then Switch _GetBorderOther($hGUI2) Case 0 $iCursorID2 = 2 Case 1, 2 $iCursorID2 = 13 Case 3, 6 $iCursorID2 = 11 Case 5, 7 $iCursorID2 = 10 Case 4, 8 $iCursorID2 = 12 EndSwitch GUISetCursor($iCursorID2, 1) EndIf EndFunc ;==>_SetCursor ; Check cursor type and resize/drag window as required Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Switch WinGetTitle($hWnd) Case WinGetTitle($hGUI) DragResize($hGUI) Case WinGetTitle($hGUI2) DragResize($hGUI2) EndSwitch EndFunc ;==>_WM_LBUTTONDOWN Func DragResize($hWndSample) Local $iResizeType = "" Switch WinGetTitle($hWndSample) Case WinGetTitle($hGUI) Local $iCursorType = _GetBorder($hGUI) If $iCursorType > 0 Then ; Cursor is set to resizing style $iResizeType = 0xF000 + $iCursorType _SendMessage($hGUI, $WM_SYSCOMMAND, $iResizeType, 0) Else Local $aCurInfo = GUIGetCursorInfo($hGUI) If $aCurInfo[4] = 0 Then ; Mouse not over a control DllCall("user32.dll", "int", "ReleaseCapture") _SendMessage($hGUI, $WM_NCLBUTTONDOWN, $HTCAPTION, 0) EndIf EndIf Case WinGetTitle($hGUI2) Local $iCursorType = _GetBorderOther($hGUI2) If $iCursorType > 0 Then ; Cursor is set to resizing style $iResizeType = 0xF000 + $iCursorType _SendMessage($hGUI2, $WM_SYSCOMMAND, $iResizeType, 0) Else Local $aCurInfo = GUIGetCursorInfo($hGUI2) If $aCurInfo[4] = 0 Then ; Mouse not over a control DllCall("user32.dll", "int", "ReleaseCapture") _SendMessage($hGUI2, $WM_NCLBUTTONDOWN, $HTCAPTION, 0) EndIf EndIf EndSwitch EndFunc ;==>DragResize Func _GethWndhWnd() $aPos = MouseGetPos() If $aPos[0] <> $aLastPos[0] Or $aPos[1] <> $aLastPos[1] Then DllStructSetData($stPoint, 1, $aPos[0]) DllStructSetData($stPoint, 2, $aPos[1]) $hControl = _WinAPI_WindowFromPoint($stPoint) $hWin = _WinAPI_GetAncestor($hControl, 2) $sStr = WinGetTitle($hWin) If $sLastStr <> $sStr Then ;ToolTip($sStr) ;ConsoleWrite($sStr) Return $sStr $sLastStr = $sStr EndIf $aLastPos = $aPos EndIf Sleep(15) EndFunc ;==>_GethWndhWnd ; Determines if mouse cursor over a border Func _GetBorder($blank) Local $aCurInfo = GUIGetCursorInfo() If @error Then Return -1 Local $aWinPos = WinGetPos($hGUI) Local $iSide = 0 Local $iTopBot = 0 ;x Coords If $aCurInfo[0] < $iMargin Then $iSide = 1 If $aCurInfo[0] > $aWinPos[2] - $iMargin Then $iSide = 2 ;y Coords If $aCurInfo[1] < $iMargin Then $iTopBot = 3 If $aCurInfo[1] > $aWinPos[3] - $iMargin Then $iTopBot = 6 If $iSide + $iTopBot > 0 Then ConsoleWrite("Side " & $iSide & " + TopBot " & $iTopBot & @CRLF) Return $iSide + $iTopBot EndFunc ;==>_GetBorder ; Determines if mouse cursor over a border Func _GetBorderOther($blank) Local $aCurInfo = GUIGetCursorInfo() If @error Then Return -1 Local $aWinPos = WinGetPos($hGUI2) Local $iSide = 0 Local $iTopBot = 0 ;x Coords If $aCurInfo[0] < $iMargin Then $iSide = 1 If $aCurInfo[0] > $aWinPos[2] - $iMargin Then $iSide = 2 ;y Coords If $aCurInfo[1] < $iMargin Then $iTopBot = 3 If $aCurInfo[1] > $aWinPos[3] - $iMargin Then $iTopBot = 6 If $iSide + $iTopBot > 0 Then ConsoleWrite("b - " & $iSide & " + " & $iTopBot & @CRLF) Return $iSide + $iTopBot EndFunc ;==>_GetBorderOther ; Set min and max GUI sizes Func _WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) $tMinMaxInfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tMinMaxInfo, 7, $iGUIMinX) DllStructSetData($tMinMaxInfo, 8, $iGUIMinY) DllStructSetData($tMinMaxInfo, 9, $iGUIMaxX) DllStructSetData($tMinMaxInfo, 10, $iGUIMaxY) Return 0 EndFunc ;==>_WM_GETMINMAXINFO Func On_Exit() Exit EndFunc ;==>On_Exit -
Resizable Frame-less/Border-less GUI
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
So in an amature fashion I have been trying to understand the functionality Currently I am using this script to try to get the results I want. Looks like segregation between the two windows is not going to work, leaning towards the DLL calls to be the main pivotal point in the issue. probably not utilizing it right. Thoughts? #include <GuiConstants.au3> #include <windowsconstants.au3> ;Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $margin = 12; distance from edge of window where dragging is possible Global $gui1, $gui2 Global $Gui = GUICreate("Win1", 420, 200, -1, -1, $WS_POPUP) GUISetBkColor(0xf1f100) Global $chk1 = GUICtrlCreateCheckbox("allow resizing and dragging", 140, 40) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH) Global $Button = GUICtrlCreateButton("Exit", 140, 90, 150, 30) GUISetState(@SW_SHOW, $Gui) Local $MainWinPos = WinGetPos($gui1) Local $locFix = $MainWinPos[0] + $MainWinPos[2] Global $gui2 = GUICreate("Win2", 420, 200, $locFix, -1, $WS_POPUP) Global $chk2 = GUICtrlCreateCheckbox("allow resizing and dragging", 140, 40) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH) Global $Button2 = GUICtrlCreateButton("Exit", 140, 90, 150, 30) GUISetState(@SW_SHOW, $gui2) GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") GUIRegisterMsg($WM_MOUSEMOVE, "SetCursor") While 1 $msg = GUIGetMsg() Select Case $msg = $Button Exit Case $msg = $Button2 Exit EndSelect WEnd ;GetMousePosType returns a code depending on the border the mouse cursor is near Func GetMousePosType() Local $cp = GUIGetCursorInfo() Local $wp1 = WinGetPos($gui1) Local $wp2 = WinGetPos($gui2) Local $sidea = 0 Local $TopBota = 0 Local $sideb = 0 Local $TopBotb = 0 If $cp Then If WinActive($gui1) Then If $cp[0] < $margin Then $sidea = 1 If $cp[0] > $wp1[2] - $margin Then $sidea = 2 If $cp[1] < $margin Then $TopBota = 3 If $cp[1] > $wp1[3] - $margin Then $TopBota = 6 Return $sidea + $TopBota ElseIf WinActive($gui2) Then If $cp[0] < $margin Then $sideb = 1 If $cp[0] > $wp2[2] - $margin Then $sideb = 2 If $cp[1] < $margin Then $TopBotb = 3 If $cp[1] > $wp2[3] - $margin Then $TopBotb = 6 Return $sideb + $TopBotb EndIf EndIf EndFunc ;==>GetMousePosType Func SetCursor() Local $curs Local $curs2 If WinActive($gui1) Then If GUICtrlRead($chk1) <> $GUI_CHECKED Then Return Switch GetMousePosType() Case 0 $curs = 2 Case 1, 2 $curs = 13 Case 3, 6 $curs = 11 Case 5, 7 $curs = 10 Case 4, 8 $curs = 12 EndSwitch GUISetCursor($curs, 1) ElseIf WinActive($gui2) Then If GUICtrlRead($chk2) <> $GUI_CHECKED Then Return Switch GetMousePosType() Case 0 $curs2 = 2 Case 1, 2 $curs2 = 13 Case 3, 6 $curs2 = 11 Case 5, 7 $curs2 = 10 Case 4, 8 $curs2 = 12 EndSwitch GUISetCursor($curs2, 1) EndIf EndFunc ;==>SetCursor Func WM_LBUTTONDOWN($hWnd, $iMsg, $StartWIndowPosaram, $lParam) Local $w1 = WinGetHandle($gui1) Local $w2 = WinGetHandle($gui2) If WinActive($gui1) Then If GUICtrlRead($chk1) <> $GUI_CHECKED Then Return $GUI_RUNDEFMSG Local $drag = GetMousePosType() If $drag > 0 Then DllCall("user32.dll", "long", "SendMessage", "hwnd", $w1, "int", $WM_SYSCOMMAND, "int", 0xF000 + $drag, "int", 0) Else DllCall("user32.dll", "long", "SendMessage", "hwnd", $w1, "int", $WM_SYSCOMMAND, "int", 0xF012, "int", 0) EndIf ElseIf WinActive($gui2) Then If GUICtrlRead($chk2) <> $GUI_CHECKED Then Return $GUI_RUNDEFMSG Local $drag = GetMousePosType() If $drag > 0 Then DllCall("user32.dll", "long", "SendMessage", "hwnd", $w2, "int", $WM_SYSCOMMAND, "int", 0xF000 + $drag, "int", 0) Else DllCall("user32.dll", "long", "SendMessage", "hwnd", $w2, "int", $WM_SYSCOMMAND, "int", 0xF012, "int", 0) EndIf Else Return $GUI_RUNDEFMSG EndIf ;F001 = LHS, F002 = RHS, F003 = top, F004 = TopLeft, F005 = TopRight, F006 = Bottom, F007 = BL, F008 = BR ;F009 = move gui, same as F011 F012 to F01F ;F010, moves cursor to centre top of gui - no idea what that is useful for. ;F020 minimizes ;F030 maximizes EndFunc ;==>WM_LBUTTONDOWN -
Hello again! Im looking for a way to create a Resizable Frame-less/Border-less GUI window. Using the methods found here: https://www.autoitscript.com/wiki/Moving_and_Resizing_PopUp_GUIs I can get the desired outcome I want but only for a single window. My application will be using Multiple windows I would like to have this same resizable functionality. Also when using the above linked methods when the GUI loses focus, it sometime causes a crash. Is there fast-track way to simplify getting my desired outcome? Currently I have also experimented with Bitor($WS_POPUP, $WS_SIZEBOX) Which gets me the closest without using listeners/registers but still leaves me with a nasty skinny frame. i'll be using this with XSkin if that helps any also, I have re-calibrated XSkin to get the proper image formating on the GUI and now i need the window to be resizable without a Frame/Border. Perhaps there is a way to hook the resize to the Images..... lots more thinking to do, I appreciate any assistance you would have to offer. Thanks!
-
GUICtrlCreateListView and Background Image
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
It seems the image I was trying to use was corrupted in some form as I used a different image and it works with both methods. Thank you both! -
GUICtrlCreateListView and Background Image
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
Thanks for your suggestion, but it did not bring me much closer a solution -
So I have a massive script going. one particular part invoving an MDI Child window I want to have an image in the ListView Background. using the GUICtrlCreateListView Method I am not able to Utilize the _GUICtrlListView_SetBkImage() to set the Background image. Although if I use the _GUICtrlListView_Create() Method the image sets fine. But they way my script is set up currently would take hours to adjust the script to work properly through _GUICtrlListView_Create(). Any thoughts on how I can achieve setting the BG of the ListView Without having to change my ListView Creation Method? Here is an Example Script of what I am trying to achieve. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Local $Winx = 10 Local $Winy = 100 Local $WinW = 405 Local $WinH = 210 $hNew_ChildTech = GUICreate("UNPRODUCTIVE TECHNICIANS", $WinW, $WinH, $Winx, $Winy, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_TABSTOP)) $TechStatusFeed = GUICtrlCreateListView("TECH #|STATUS|First Name|Last Name ", 5, 5, $WinW - 12, $WinH - 10, -1) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 0, 55) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 1, 117) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 2, 100) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 3, 150) _GUICtrlListView_SetBkImage($TechStatusFeed, @ScriptDir & "\img\img.jpg") GUISetState() While 1 Sleep(100) WEnd
-
MDI Child of Child Window
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
amazing this is just the way I was hoping it would work!! Thank you! -
Hello, I have been working on an application for quite some time now that involves an MDI style setup. I am running into an Issue with custom graphics as a background with static positions for custom buttons as a "tool bar". When a child window is maximized it will maximize the entire inside region of the parent window as it should. I would like to set a custom region which a child window will maximize to so that it does not cover up my toolbar. My first thought on the approach was to create another GUI as a container for all the child windows. which would also mean it would too be a child of the parent window. is this achievable? Does anyone have any examples of what I am trying to achieve?
-
Amazing, got my desired outcome with: Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x2, $i_y2, $i_x3, $i_y3) Local $XS_pos, $XS_reta, $XS_retb, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_reta = _WinAPI_CreateRoundRectRgn ( 0, 0, $XS_pos[2], $XS_pos[3]-30, $i_x3, $i_y3 ) $XS_retb = _WinAPI_CreateRectRgn (0, $XS_pos[2]-$XS_pos[1]/2, $XS_pos[2], $XS_pos[3] ) $XS_retc = _WinAPI_CombineRgn ( $XS_reta, $XS_reta, $XS_retb, $RGN_OR ) _WinAPI_DeleteObject($XS_retb) _WinAPI_SetWindowRgn($h_win, $XS_reta) EndFunc ;==>_GuiRoundCorners Thank you for your assistance!
-
Yes, I understand _WinAPI_CreateRoundRectRgn() does the same thing as : DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)But that doesnt answer my question, it adjusts the region as a rectangle meaning it will always adjust for 4 corners. Is there a system used for point to point corners or single corners?
-
I am developing an application with some custom graphics. I found this function here. it works perfectly but I was wondering; is there a way to round only the top or bottom two corners?
-
How would I go about keeping a child window in the same position it was closed inside the parent window. I use WinMove to move it back to the previous location recorded into ini but each time it saves the previous coodinates it multiplys the result and the child window is restored off-screen. Func _RecordIni($ChildWin) If WinExists("UNPRODUCTIVE TECHNICIANS") Then Local $TechStatWinPos = WinGetPos(ControlGetHandle($WMTCLiveFeed, "", $ChildWin)) IniWrite(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSposX", INT($TechStatWinPos[0])) IniWrite(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSposY", INT($TechStatWinPos[1])) IniWrite(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSsizeW", INT($TechStatWinPos[2])) IniWrite(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSsizeH", INT($TechStatWinPos[3])) EndIf EndFunc #REGION====NEWBORNS===================================== Func CreateChildTechStats($wintitle) Local $Winx = IniRead(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSposX", "DEFAULT VALUE") Local $Winy = IniRead(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSposy", "DEFAULT VALUE") Local $WinW = IniRead(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSsizeW", "DEFAULT VALUE") Local $WinH = IniRead(@ScriptDir & "\LFConfig.ini", "TechStatsWinPos", "TECHSTATSsizeH", "DEFAULT VALUE") If Not WinExists($wintitle) Then Global $hNew_ChildTech = GUICreate($wintitle, 405, 210, 10, 100, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_TABSTOP)) Global $TechStatusFeed = GuiCtrlCreateListView("TECH #|STATUS|First Name|Last Name ", 5, 5, 393, 200) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 0, 55) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 1, 117) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 2, 100) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 3, 150) _WinAPI_SetParent($hNew_ChildTech, $WMTCLiveFeed) Add($ahChild, $hNew_ChildTech) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseTechStats", $hNew_ChildTech) GUISetState() Sleep(1000) If WinExists($hNew_ChildTech) Then WinMove($hNew_ChildTech, "", $WinX, $WinY, $WinW, $WinH) Else CloseTechStats() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idTStats, True) EndIf EndFunc ;==>CreateChild Func CloseTechStats() _RecordIni($hNew_ChildTech) GUIDelete($hNew_ChildTech) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idTStats, False) EndFunc
-
GUI Background image in an MDI setup
CodeTinkerer replied to CodeTinkerer's topic in AutoIt GUI Help and Support
Ok, so I have added $WS_CLIPCHILDREN to GUICreate. Took care of the Child Windows from inheriting the background image when drawn. Still cant get around the toolbar issue though. Ive tried a bunch of different style combonations to try to get my desired result. -
Im creating a rather large application involving an MDI style GUI setup. I want to have an image for the background of the parent window. I followed the typical route of: GUICtrlCreatePic GUICtrlSetState($var, $GUI_DISABLE) but to no avail. I am still having issues with the toolbar not properly drawing in and any child windows that are created. Is there a way to get my desired result or should I stop wasting time and continue development? #Include <Array.au3> #Include <GetXML.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <Date.au3> #include <MultiMon.au3> #include <StaticConstants.au3> #include <IE.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3>; this is where the magic happens, people #include <GuiButton.au3> #include <GuiImageList.au3> #include <Math.au3> #Include <GetMonName.au3> #include <GuiToolbar.au3> #REGION===IMAGE LISTS==================================================================================== ;EXIT BUTTON $ExitImgs = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($ExitImgs, @ScriptDir & "\Img\ExitBtnneu.bmp") ;NORMAL _GUIImageList_AddBitMap($ExitImgs, @ScriptDir & "\Img\ExitBtnrd.bmp") ;HOVER _GUIImageList_AddBitMap($ExitImgs, @ScriptDir & "\Img\ExitBtnrddwn.bmp") ;DOWN _GUIImageList_AddBitMap($ExitImgs, @ScriptDir & "\Img\ExitBtnneu.bmp") ;DISABLED _GUIImageList_AddBitMap($ExitImgs, @ScriptDir & "\Img\ExitBtnneu.bmp") ;DEFAULTED _GUIImageList_AddBitMap($ExitImgs, @ScriptDir & "\Img\ExitBtnneu.bmp") ;STYLUS HOT (TABLET COMPUTERS) $TechMForm = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($TechMForm, @ScriptDir & "\Img\MonForm.bmp") ;NORMAL _GUIImageList_AddBitMap($TechMForm, @ScriptDir & "\Img\MonForm.bmp") ;HOVER _GUIImageList_AddBitMap($TechMForm, @ScriptDir & "\Img\MonFormdwn.bmp") ;DOWN _GUIImageList_AddBitMap($TechMForm, @ScriptDir & "\Img\MonForm.bmp") ;DISABLED _GUIImageList_AddBitMap($TechMForm, @ScriptDir & "\Img\MonForm.bmp") ;DEFAULTED _GUIImageList_AddBitMap($TechMForm, @ScriptDir & "\Img\MonForm.bmp") ;STYLUS HOT (TABLET COMPUTERS) $GMapsImg = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($GMapsImg, @ScriptDir & "\Img\GMaps.bmp") ;NORMAL _GUIImageList_AddBitMap($GMapsImg, @ScriptDir & "\Img\GMaps.bmp") ;HOVER _GUIImageList_AddBitMap($GMapsImg, @ScriptDir & "\Img\GMapsdwn.bmp") ;DOWN _GUIImageList_AddBitMap($GMapsImg, @ScriptDir & "\Img\GMaps.bmp") ;DISABLED _GUIImageList_AddBitMap($GMapsImg, @ScriptDir & "\Img\GMaps.bmp") ;DEFAULTED _GUIImageList_AddBitMap($GMapsImg, @ScriptDir & "\Img\GMaps.bmp") ;STYLUS HOT (TABLET COMPUTERS) $TechJImg = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($TechJImg, @ScriptDir & "\Img\Jobs.bmp") ;NORMAL _GUIImageList_AddBitMap($TechJImg, @ScriptDir & "\Img\Jobs.bmp") ;HOVER _GUIImageList_AddBitMap($TechJImg, @ScriptDir & "\Img\Jobsdwn.bmp") ;DOWN _GUIImageList_AddBitMap($TechJImg, @ScriptDir & "\Img\Jobs.bmp") ;DISABLED _GUIImageList_AddBitMap($TechJImg, @ScriptDir & "\Img\Jobs.bmp") ;DEFAULTED _GUIImageList_AddBitMap($TechJImg, @ScriptDir & "\Img\Jobs.bmp") ;STYLUS HOT (TABLET COMPUTERS) $SpreadImgs = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($SpreadImgs, @ScriptDir & "\Img\Spread1.bmp") ;NORMAL _GUIImageList_AddBitMap($SpreadImgs, @ScriptDir & "\Img\Spread1.bmp") ;HOVER _GUIImageList_AddBitMap($SpreadImgs, @ScriptDir & "\Img\Spread1dwn.bmp") ;DOWN _GUIImageList_AddBitMap($SpreadImgs, @ScriptDir & "\Img\Spread1.bmp") ;DISABLED _GUIImageList_AddBitMap($SpreadImgs, @ScriptDir & "\Img\Spread1.bmp") ;DEFAULTED _GUIImageList_AddBitMap($SpreadImgs, @ScriptDir & "\Img\Spread1.bmp") ;STYLUS HOT (TABLET COMPUTERS) $WFXBoardImg = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($WFXBoardImg, @ScriptDir & "\Img\TheBoard.bmp") ;NORMAL _GUIImageList_AddBitMap($WFXBoardImg, @ScriptDir & "\Img\TheBoard.bmp") ;HOVER _GUIImageList_AddBitMap($WFXBoardImg, @ScriptDir & "\Img\TheBoarddwn.bmp") ;DOWN _GUIImageList_AddBitMap($WFXBoardImg, @ScriptDir & "\Img\TheBoard.bmp") ;DISABLED _GUIImageList_AddBitMap($WFXBoardImg, @ScriptDir & "\Img\TheBoard.bmp") ;DEFAULTED _GUIImageList_AddBitMap($WFXBoardImg, @ScriptDir & "\Img\TheBoard.bmp") ;STYLUS HOT (TABLET COMPUTERS) $SupCalImg = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($SupCalImg, @ScriptDir & "\Img\SupCal.bmp") ;NORMAL _GUIImageList_AddBitMap($SupCalImg, @ScriptDir & "\Img\SupCal.bmp") ;HOVER _GUIImageList_AddBitMap($SupCalImg, @ScriptDir & "\Img\SupCaldwn.bmp") ;DOWN _GUIImageList_AddBitMap($SupCalImg, @ScriptDir & "\Img\SupCal.bmp") ;DISABLED _GUIImageList_AddBitMap($SupCalImg, @ScriptDir & "\Img\SupCal.bmp") ;DEFAULTED _GUIImageList_AddBitMap($SupCalImg, @ScriptDir & "\Img\SupCal.bmp") ;STYLUS HOT (TABLET COMPUTERS) $OpIdImg = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddBitMap($OpIdImg, @ScriptDir & "\Img\corpop.bmp") ;NORMAL _GUIImageList_AddBitMap($OpIdImg, @ScriptDir & "\Img\corpop.bmp") ;HOVER _GUIImageList_AddBitMap($OpIdImg, @ScriptDir & "\Img\corpopdwn.bmp") ;DOWN _GUIImageList_AddBitMap($OpIdImg, @ScriptDir & "\Img\corpop.bmp") ;DISABLED _GUIImageList_AddBitMap($OpIdImg, @ScriptDir & "\Img\corpop.bmp") ;DEFAULTED _GUIImageList_AddBitMap($OpIdImg, @ScriptDir & "\Img\corpop.bmp") ;STYLUS HOT (TABLET COMPUTERS) $TStatImg = _GUIImageList_Create(18, 18, 5) _GUIImageList_AddBitMap($TStatImg, @ScriptDir & "\Img\NewStat.Bmp") _GUIImageList_AddBitMap($TStatImg, @ScriptDir & "\Img\ToastStat.Bmp") _GUIImageList_AddBitMap($TStatImg, @ScriptDir & "\Img\BurtStat.Bmp") #ENDREGION===IMAGE LISTS================================================================================= Global $iEventError = 0 ; to be checked to know if com error occurs. Must be reset after handling. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler $VersionVariable = "0.9.4 (beta)" Global $iniFile = FileOpen(@ScriptDir & "\LFConfig.ini", $FO_READ) Global $iniWrit = FileOpen(@ScriptDir & "\LFConfig.ini", $FO_OVERWRITE) $FirstRunToken = FileReadLine($iniFile, 1) Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("WinSearchChildren", 1) Local $oIE1, $GUI_Button_Back, $GUI_Button_Forward Local $GUI_Button_Home, $GUI_Button_Stop, $msg Global $WFXStatusBuffer[5][5] ; Keeps previous caputed information to compare, keeps from having to update the GUICtrlListView EVERY time. Global $TechFrmsBuffer[10][10] Global $JobFrmsBuffer[3][3] Global $TSTrap = 0 Global $PopTop = True Global $FirstRunDone = 0 Global $zImg = _GUIImageList_Create(18, 18, 5) Global $MonSelect = 2 Global $GCoin = $MonSelect Global $ahChild[1][2] = [[0, 0]], $SC_MOVE = 0xF010 $oIE1 = ObjCreate("Shell.Explorer.2") Global $WMTCLiveFeed = GUICreate("WMTC Live Feeds", 1024, 768, 192, 200, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) Global $BGPic = GUICtrlCreatePic(@ScriptDir & "\bBlue.jpg", 0, 0, 0, 0) GUICtrlSetState($BGPic, $GUI_DISABLE ) ;GUICtrlSetState($BGPic, $GUI_HIDE ) Local $hDumbLabel = GUICtrlCreateLabel("", 0, 0, 0, 0) #REGION====MENU===================================================== $mMain = GUICtrlCreateMenu("Menu") $mChild = GUICtrlCreateMenuItem("New Child Window Test", $mMain) $mReporter = GUICtrlCreateMenuItem("WMTCLF FeedBack", $mMain) #ENDREGION====MENU================================================== #REGION====APPLICATION=SYSTEM=EVENTS GUISetOnEvent($GUI_EVENT_CLOSE, "ExitFeeds", $WMTCLiveFeed) #ENDREGION========================== #REGION===TOOLBAR============================================ Global $g_hToolbar, $g_idMemo Global $g_iItem ; Command identifier of the button associated with the notification. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ;ORDERED ARRANGEMENT OF BELOW DECLARATIONS DETERMINE THE ID NUMBER THAT WILL BE ASSIGNED TO THAT VARIABLE=- Global Enum $e_idTStats = 1000, $e_idTForms, $e_idJForms, $e_idEForms, $e_idBlank1, $e_idMonForms, $e_idWFXBoard If WinExists("WMTC Live Feeds") Then Local $Maintoolbar = _GUICtrlToolbar_Create($WMTCLiveFeed, $TBSTYLE_TRANSPARENT, $TBSTYLE_EX_DOUBLEBUFFER ) ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($Maintoolbar, 1, -1, $IDB_STD_LARGE_COLOR) ;REGISTER TOOLBAR MESSAGES GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add text strings for buttons (0-based indexing) _GUICtrlToolbar_AddString($MainToolBar, "Tech Status") _GUICtrlToolbar_AddString($MainToolBar, "Tech Forms") _GUICtrlToolbar_AddString($MainToolBar, "Job Forms") _GUICtrlToolbar_AddString($MainToolBar, "Escalations") _GUICtrlToolbar_AddString($MainToolBar, "Job Assignments") _GUICtrlToolbar_AddString($MainToolBar, "Monitor Feedback") _GUICtrlToolbar_AddString($MainToolBar, "WFX Board") ; Add buttons _GUICtrlToolbar_AddButton($Maintoolbar, $e_idTStats, $STD_HELP, 0, $BTNS_CHECK ) ; Tech Stats _GUICtrlToolbar_AddButton($Maintoolbar, $e_idTForms, $STD_HELP, 1, $BTNS_CHECK) ; Tech Forms _GUICtrlToolbar_AddButton($Maintoolbar, $e_idJForms, $STD_HELP, 2, $BTNS_CHECK) ; Job Forms _GUICtrlToolbar_AddButton($Maintoolbar, $e_idEForms, $STD_HELP, 3, $BTNS_CHECK) ; ETD Forms _GUICtrlToolbar_AddButton($Maintoolbar, $e_idBlank1, $STD_HELP, 4, $BTNS_CHECK) ; Job Assignement Forms _GUICtrlToolbar_AddButtonSep($Maintoolbar) ;spacer _GUICtrlToolbar_AddButton($Maintoolbar, $e_idMonForms, $STD_HELP, 5, $BTNS_CHECK) ; Monitor Feedback Forms _GUICtrlToolbar_AddButtonSep($Maintoolbar) ;spacer _GUICtrlToolbar_AddButton($Maintoolbar, $e_idWFXBoard, $STD_FILENEW, 6, $BTNS_CHECK) ; WFX Board ;_GUICtrlToolbar_AddButton($Maintoolbar, $e_idBlank1, $STD_FILENEW, 4) ; Blank ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $iMsgID, $wParam, $lParam) #forceref $hWndGUI, $iMsgID, $wParam Local $tNMHDR, $hWndFrom, $iCode, $iNew, $iFlags, $iOld Local $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $Maintoolbar Switch $iCode Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- Switch $g_iItem Case 1000 ; Toolbar Button 1 CreateChildTechStats("UNPRODUCTIVE TECHNICIANS") Case 1001 ; Toolbar Button 2 CreateChildTechTickets("SAME DAY TECH FORMS") Case 1002 ; Toolbar Button 3 CreateChildJobForms("JOB RESCHEDULING FORMS") Case 1003 ; Toolbar Button 4 CreateChildETDBrowser() Case 1004 ; Job Assignement Req Forms MsgBox(0, "Error", "That button is unused at this time..." & $g_iItem) Case 1005 ; Monitor Forms CreateChildMonForms() Case 1006 ; WFX Board (May need to move) CreateChildWFXBoard() Case Else MsgBox(0, "Error", "That button is unused at this time") EndSwitch ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $iOld = DllStructGetData($tNMTBHOTITEM, "idOld") $iNew = DllStructGetData($tNMTBHOTITEM, "idNew") $g_iItem = $iNew $iFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY #ENDREGION===TOOLBAR============================================ ;GUICtrlSetState($BGPic, $GUI_SHOW ) ;GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND") $StartCoin = 0 Global $TechFormsXML Global $JobFormsXML Global $TechTicketFeed, $JobFormFeed, $WFXStatusBuffer, $TechStatusFeed While 1 Sleep(5000) If $StartCoin = 0 Then ;DelLoader() _MaxOnMonitor("WMTC Live Feeds", "", $MonSelect) $StartCoin = 1 EndIf WEnd Func Add(ByRef $aArray, $hHandle) ; Increase the number of children $aArray[0][0] += 1 ; Resize the array ReDim $aArray[$aArray[0][0] + 1][2] ; Add the child details $aArray[$aArray[0][0]][0] = $hHandle $aArray[$aArray[0][1]][1] = False EndFunc ;==>Add ;====================================================================================================================================== ; - - - FUNCTIONS BELOW THIS LINE ONLY - - - FUNCTIONS BELOW THIS LINE ONLY - - - FUNCTIONS BELOW THIS LINE ONLY - - - ;====================================================================================================================================== #REGION====NEWBORNS===================================== Func CreateChildTechStats($wintitle) If Not WinExists($wintitle) Then Global $hNew_ChildTech = GUICreate($wintitle, 405, 210, 1920, 1080, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) Global $TechStatusFeed = GuiCtrlCreateListView("TECH #|STATUS|First Name|Last Name ", 5, 5, 393, 200) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 0, 55) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 1, 117) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 2, 100) _GUICtrlListView_SetColumnWidth($TechStatusFeed, 3, 150) _WinAPI_SetParent($hNew_ChildTech, $WMTCLiveFeed) Add($ahChild, $hNew_ChildTech) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseTechStats", $hNew_ChildTech) GUISetState() Sleep(1000) WinMove($hNew_ChildTech, "" , 10, 100) Else CloseTechStats() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idTStats, True) EndIf EndFunc ;==>CreateChild Func CloseTechStats() GUIDelete($hNew_ChildTech) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idTStats, False) EndFunc Func CreateChildTechtickets($wintitle) If Not WinExists($wintitle) Then Global $hNew_ChildTechTickets = GUICreate($wintitle, 405, 210, 10, 100, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) Global $TechTicketFeed = GuiCtrlCreateListView("CREATED|SP Co|SUP|TECH #|TECH NAME|AREA", 5, 5, 393, 200) _GUICtrlListView_SetColumnWidth($TechTicketFeed, 0, 45) _GUICtrlListView_SetColumnWidth($TechTicketFeed, 1, 65) _GUICtrlListView_SetColumnWidth($TechTicketFeed, 2, 75) _GUICtrlListView_SetColumnWidth($TechTicketFeed, 3, 55) _WinAPI_SetParent($hNew_ChildTechTickets, $WMTCLiveFeed) Add($ahChild, $hNew_ChildTechTickets) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseTechForms", $hNew_ChildTechTickets) GUISetState() Else CloseTechForms() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idTForms, True) EndIf EndFunc ;==>CreateChild Func CloseTechForms() GUIDelete($hNew_ChildTechTickets) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idTForms, False) EndFunc Func CreateChildJobForms($wintitle) If Not WinExists($wintitle) Then Global $hNew_ChildJobForms = GUICreate($wintitle, 405, 210, 10, 100, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) Global $JobFormFeed = GuiCtrlCreateListView("JOB # | REASON | SUP | TECH #", 5, 5, 393, 200) _WinAPI_SetParent($hNew_ChildJobForms, $WMTCLiveFeed) Add($ahChild, $hNew_ChildJobForms) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseJobForms", $hNew_ChildJobForms) GUISetState() Else CloseJobForms() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idJForms, True) EndIf EndFunc ;==>CreateChild Func CloseJobForms() GUIDelete($hNew_ChildJobForms) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idJForms, False) EndFunc Func CreateChildETDBrowser() If Not WinExists("ETD Tickets") Then Global $hNew_ChildETDBrowser = GUICreate("ETD Tickets", 1070, 250, 10, 100, $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW) Global $GUIActiveX1 = GUICtrlCreateObj ($oIE1, -60, -100, 1200, 350) $oIE1.navigate("www.google.com") _WinAPI_SetParent($hNew_ChildETDBrowser, $WMTCLiveFeed) Add($ahChild, $hNew_ChildETDBrowser) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseETDForms", $hNew_ChildETDBrowser) GUISetState() Else CloseETDForms() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idEForms, True) EndIf EndFunc ;==>CreateChild Func CloseETDForms() GUIDelete($hNew_ChildETDBrowser) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idEForms, False) EndFunc Func CreateChildMonForms() If Not WinExists("MONITOR FEEDBACK FORM") Then Global $hNew_ChildMonFormBrowser = GUICreate("MONITOR FEEDBACK FORM", 730, 405, 10, 100, $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW) Global $oIEMon = ObjCreate("Shell.Explorer.2") Global $GUIActiveX1 = GUICtrlCreateObj ($oIEMon, -155, -145, 900, 900) $oIEMon.navigate("www.google.com") _WinAPI_SetParent($hNew_ChildMonFormBrowser, $WMTCLiveFeed) Add($ahChild, $hNew_ChildMonFormBrowser) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseMon_Forms", $hNew_ChildMonFormBrowser) GUISetState() While not $oIEMon.LocationURL = "www.google.com" Sleep(100) WEnd ObjEvent($oIEMon, "IEEvent_", "DWebBrowserEvents") Else _CloseMon_Forms() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idMonForms, True) EndIf EndFunc ;==>CreateChild Func IEEvent_NavigateComplete() _CloseMon_Forms() EndFunc Func _CloseMon_Forms() GUIDelete($hNew_ChildMonFormBrowser) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idMonForms, False) EndFunc Func CreateChildWFXBoard() If Not WinExists("WFX BOARD") Then Global $hNew_ChildWFXBrowser = GUICreate("WFX BOARD", 1440, 800, 10, 100, $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW) Global $oIEWFX = ObjCreate("Shell.Explorer.2") Global $GUIActiveX1 = GUICtrlCreateObj ($oIEWFX, 5, 5, 1420, 780) $oIEWFX.navigate("www.google.com") _WinAPI_SetParent($hNew_ChildWFXBrowser, $WMTCLiveFeed) Add($ahChild, $hNew_ChildWFXBrowser) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseWFXBoard", $hNew_ChildWFXBrowser) GUISetState() While not $oIEWFX.LocationURL = "www.google.com" Sleep(100) WEnd Else CloseWFXBoard() _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idWFXBoard, True) EndIf EndFunc ;==>CreateChild Func CloseWFXBoard() GUIDelete($hNew_ChildWFXBrowser) _GUICtrlToolbar_CheckButton($Maintoolbar, $e_idWFXBoard, False) EndFunc #ENDREGION====NEWBORNS===================================== Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ "Hex Number is: " & $HexNumber & @CRLF & _ "Error Number is: " & $oMyError.number & @CRLF & _ "WinDescription is: " & $oMyError.windescription & @CRLF & _ "Error Source: " & $oMyError.Source & @CRLF & _ "Error Location: " & $oMyError.Scriptline) $iEventError = 1 ; Use to check when a COM Error occurs EndFunc Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) For $i = 1 To $ahChild[0][0] ; Does the message come from a child? If $hWnd = $ahChild[$i][0] Then ; Is the child maximized? If $ahChild[$i][1] Then ;Is it a MOVE mesage? If BitAND($wParam, 0xFFF0) = $SC_MOVE Then Return False ExitLoop EndIf EndIf Next Return $GUI_RUNDEFMSG EndFunc ;==>On_WM_SYSCOMMAND Func ExitFeeds() Exit EndFunc
-
GDI+ Text Transparency
CodeTinkerer replied to CodeTinkerer's topic in AutoIt General Help and Support
Thank you UEZ. So Using _GDIPlus_BitmapCreateFromFile, How would I as you had said "copy" it to the $backbuffer? looking through the help I couldnt find a "copy" func per say -
So Im trying to work with GDI and marquee text. I have a string drawn and is animated via loop to move from right, stop mid breifly, then resume and reset. Im trying to add an additional string below it but I cant get it to draw, Any help on how I could go about accomplishing this?
-
Selecting Options in Cascading Combo Boxes
CodeTinkerer replied to kmaclamore's topic in AutoIt General Help and Support
Ive had luck in the past with 3rd party apps and mouse clicking buttons. I got around it with ControlClick then MouseClick on top of that. Perpaps try ControlClick on the combobox, then _GUICtrlComboBox_SetCurSel? Understandably the automation speed might not be quite as fast but.... thats my thoughts. -
How to tell a UI to refresh from another script
CodeTinkerer replied to c.haslam's topic in AutoIt General Help and Support
Pass the message through a file, read the file from the second script? -
How would I go about getting a Transparent background for this _GDIPlus_GraphicsDrawStringEx ?, Ive already tried multiple UDF's that would work properly with the standard controls. #include <GDIPlus.au3> Opt("GUIOnEventMode", 1) $hwnd = GUICreate("GDI+ Example", 400, 300) $label = GUICtrlCreateLabel("", 10, 10, 380, 40) GUICtrlCreateButton("Start/Stop scrolling",150,50,100,30) GUICtrlSetOnEvent(-1,"startstop") GUISetOnEvent(-3, "close") GUICtrlCreatePic(@ScriptDir & '\Img\Main2.jpg' ,0 ,0 ,0 ,0 ,0 ,0 ) GUISetState() _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND(ControlGetHandle($hwnd, "", $label)) $bitmap = _GDIPlus_BitmapCreateFromGraphics(380, 40, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $ffamily = _GDIPlus_FontFamilyCreate("Arial") $arial = _GDIPlus_FontCreate($ffamily, 24) $sformat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($sformat, 1) $blackbrush = _GDIPlus_BrushCreateSolid() $pos = 0 $speed=0 Do _GDIPlus_GraphicsClear($backbuffer, 0xFFF0F0F0) $pos -= $speed $rectf = _GDIPlus_RectFCreate($pos, 0, 380, 40) If $pos < -300 Then $pos = 300 _GDIPlus_GraphicsDrawStringEx($backbuffer, "Scrolling text", $arial, $rectf, $sformat, $blackbrush) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, 380, 40) Sleep(10) Until False Func startstop() $speed=Not $speed EndFunc Func close() _GDIPlus_BrushDispose($blackbrush) _GDIPlus_StringFormatDispose($sformat) _GDIPlus_FontDispose($arial) _GDIPlus_FontFamilyDispose($ffamily) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc ;==>close
-
Hello Again, So this time around with GDI Im trying to get a text with a transparent background (And none of that white outline around the text either) and have it move from left to right, or right to left. This script I found gives me the desired text rendering, no outline no background, now How would I go about moving the string around? #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") Global $hGUI=0,$bRunning=True Example() Func Example() $hGUI = GUICreate("GDI+ test", 800, 400,-1,-1,$WS_POPUP,$WS_EX_LAYERED) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hGUI,0xABCDEF) GUISetState() _GDIPlus_Startup() If @OSBuild < 6000 Then MsgBox($MB_SYSTEMMODAL, "", "Antialiasing is automatically turned on for your operating system - no visible differences!") Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawString($hGraphics, "AutoIt rulez!", 0, 0, "Impact", 110) While $bRunning Sleep(10) WEnd ;cleanup resources _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc ;==>Example Func Terminate() $bRunning=False EndFunc
-
Array Tripple Filter
CodeTinkerer replied to CodeTinkerer's topic in AutoIt General Help and Support
I Managed to get the desired outcome with this setup: ; Return Status Time Difference from when the status was placed to now, for Comparison in _TechStatusSorter() Func _RtrnTimeDifference($hString) Local $hTime Local $mTime Local $NowDay = @YEAR & "/" & @Mon & "/" & @MDay $hTime = StringTrimRight(StringRight($hString, 5), 3) $mTime = StringTrimLeft(StringRight($hString, 5), 3) Return _DateDiff('n', $NowDay & " " & $hTime & ":" & $mTime, _NowCalc()) EndFunc ; Sort statuses and appropriate images Func _TechStatusSorter($WFXArry) Local $StrBffr Local $CopArr[UBound($WFXArry, 1)][UBound($WFXArry, 2)] Local $TempBuffer[UBound($WFXArry, 1)][UBound($WFXArry, 2)] Local $Marker Local $TimeSet Local $StatArr[8] $StatArr[0] = "SUP" $StatArr[1] = "AVAIL" $StatArr[2] = "ENROUTE" $StatArr[3] = "BREAK" $StatArr[4] = "FUEL" $StatArr[5] = "TRAIN" $StatArr[6] = "WAR" $StatArr[7] = "TRUCKMAINT" ;filter by priority For $j = 0 To UBound($StatArr, 1) - 1 For $a = 0 to UBound($WFXArry, 1) - 1 If StringInStr($WFXArry[$a][1], $StatArr[$j]) Then For $b = 0 to UBound($WFXArry, 2) - 1 If $b = 8 Then $CopArr[$Marker][$b] = _RtrnTimeDifference($WFXArry[$A][1]) Else $CopArr[$Marker][$b] = $WFXArry[$a][$b] Endif Next $Marker += 1 EndIf Next Next $Marker = 0 ;_ArrayDisplay($CopArr) Local $ab, $sb, $tB, $bb, $trb, $wb, $eb, $fb Local $StatusBank[UBound($CopArr, 1)] For $g = 0 to UBound($CopArr, 1) - 1 $StatusBank[$g] = $CopArr[$g][8] Next _ArraySort($StatusBank) For $ix = 0 to UBound($StatusBank, 1) - 1 For $Ordos = 0 to UBound($CopArr, 1) - 1 If $StatusBank[$ix] = $CopArr[$Ordos][8] Then For $Fin = 0 to UBound($CopArr, 2) - 1 $TempBuffer[$Marker][$fin] = $CopArr[$Ordos][$Fin] Next $Marker += 1 EndIf Next Next $Marker = 0 For $q = 0 to UBound($StatArr, 1) - 1 For $uu = 0 to Ubound($TempBuffer, 1) - 1 If StringInStr($TempBuffer[$uu][1], $StatArr[$q]) Then For $w = 0 to UBound($TempBuffer, 2) - 1 $CopArr[$Marker][$w] = $TempBuffer[$uu][$w] Next $Marker += 1 EndIf Next Next Return $CopArr EndFunc $SortedStats = _TechStatusSorter($WFXTextArray) For $x = 0 to UBound($SortedStats, 1) - 1 _GUICtrlListView_AddItem($LstID, $SortedStats[$x][0], $x) _GUICtrlListView_AddSubItem($LstID, $x, $SortedStats[$x][1], 1, 1) _GUICtrlListView_AddSubItem($LstID, $x, $SortedStats[$x][6], 2, 2) _GUICtrlListView_AddSubItem($LstID, $x, $SortedStats[$x][7], 3, 3) NextI guess my next question would be: Can this be any more efficient/simplified?