Jump to content

All Activity

This stream auto-updates

  1. Yesterday
  2. A spaced line is the delimitator between header ( the top ) and body ( the rest ). It would be best you get acquainted with HTTP and HTML.
  3. This is in the wrappers with propertyvalue, property and most likely when I wrote the library I had to deal with textboxes from java or other not fully iUIAutomation compatible textboxes and choosed to do it by keyboard commands and have another way to get to the propertys by a property command action. Case "propertyvalue", "property" Local $i = _UIA_getPropertyIndex($p1) If Not @error <> 0 Then $retValue = _UIA_getPropertyValue($obj2ActOn, $UIA_propertiesSupportedArray[$i][1]) Else $retValue = _UIA_getPropertyValue($obj2ActOn, $p1) EndIf and implemented like Func _UIA_getPropertyValue($UIA_oUIElement, $id) Local $tmpValue, $tmpStr, $iProperty If Not _UIA_IsElement($UIA_oUIElement) Then Return SetError($_UIASTATUS_GeneralError, $_UIASTATUS_GeneralError, "** NO PROPERTYVALUE DUE TO NONEXISTING OBJECT **") EndIf $UIA_oUIElement.GetCurrentPropertyValue($id, $tmpValue) $tmpStr = "" & $tmpValue If IsArray($tmpValue) Then $tmpStr = "" For $iProperty = 0 To UBound($tmpValue) - 1 $tmpStr = $tmpStr & StringStripWS($tmpValue[$iProperty], $STR_STRIPLEADING + $STR_STRIPTRAILING) If $iProperty <> UBound($tmpValue) - 1 Then $tmpStr = $tmpStr & ";" EndIf Next Return $tmpStr EndIf Return SetError($_UIASTATUS_GeneralError, $_UIASTATUS_GeneralError, $tmpStr) EndFunc ;==>_UIA_getPropertyValue And setting your keyboard focus back to begin or end could be done with keys like ctrl+home and ctrl+end. There are to many aspects in remotely controlling different applications and all kinds of different textboxes from different programming languages. Nowadays probably more and more html frontend applications but in 2010-2015 dealing with many windows UX technologies (Visual Basic, Java, Win32 forms, Delphi, HTML, QWidgets, ....)
  4. maybe findbmp is an alternative. Wrote that long time ago but still works.
  5. Hello can anyone please explain where i can get the POST request data that the browser sends to the server? I have made the following example index.au3 wich displays a string a date picker and a submit button. When i press the post button the server gets the post request and i see the post key:data pair in the scite debug window, but how do i read it from withing the target au3 script that i call cmd.au3? I tryed to read the server code but its to complex for me. ConsoleWrite("X-Powered-By: AutoIt/"&@AutoItVersion&@LF) ConsoleWrite("Content-type: text/html; charset=window-1252"&@LF) ConsoleWrite(@LF) ConsoleWrite("<html>") ConsoleWrite("<head>") ConsoleWrite("</head>") ConsoleWrite("<body>") ConsoleWrite("<h1>This is a test</h1>") ConsoleWrite('<form action="/cmd.au3" method="post">' & _ '<input type="date" id="ch_date" name="ch_date" value="John">' & _ '<input type="submit" value="Submit">' & _ '</form>') ConsoleWrite("</body>") ConsoleWrite("</html>") And this is what i get in console when i press the submit: (0067) Server created on http://0.0.0.0:80/ +0ms (0076) Accepted new request on position: 0 +4799ms (0086) (800)Getting request information on position: 0 +4800ms (0099) String(600): POST / HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br, zstd Referer: http://localhost/ Content-Type: application/x-www-form-urlencoded Content-Length: 18 Origin: http://localhost DNT: 1 Connection: keep-alive Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: same-origin Sec-Fetch-User: ?1 Priority: u=0, i ch_date=2025-04-01 +4801ms (0110) Starting processing request on position: 0 +4801ms (0635) aUri[Path]: / +4802ms As i can see i get "ch_date=2025-04-01" wich is what i chose in the page before submiting now i just need to know where to read it from inside of cmd.au3
  6. Thanks. The main reason why i have put the opposite colors as the foreground color is to see when the text becomes visible and thus having some kind of an idea on which "distance" number would be ok to use. In my version of the Chip8 emulator, you are able to select colors. So i have, accidentally selected the same color and thus the game was not visible anymore. So i had the idea to first check if the color is the same (like both 0x000000) and to reset the colors to the default value. But this approach would not count for the colors that are very similar like 0x000000 and 0x000001, which is , while technically not the same color, it is hardly distinguishable from each other. Therefore i have tried to invent some kind of 'distance' measurement.
  7. @Ghost_Line If the array is not too big, you could pass a string (use _ArrayToString to create it). Using WCD-IPC might be a little unnecessary complex. Here a simple example : #include "..\Files\PMT-UDF.au3" #include <Array.au3> Local $aArray = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] _PMT_Init() $sString = _ArrayToString($aArray) _PMT_Start("DisplayArray", $sString) While Sleep(100) WEnd Func DisplayArray($sStr) Local $aArr = _ArrayFromString($sStr) _ArrayDisplay($aArr) EndFunc
  8. Hello @Nine, I'm sorry to ask, but could you please give a small example on how give the content of an array as an argument ? I'm not sure to understand how WCD-IPC is working :(
  9. Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam WM_DRAWITEM_forSomethingElse($hWnd, $iMsg, $wParam, $lParam) ... ... Return $GUI_RUNDEFMSG EndFunc Func WM_DRAWITEM_forSomethingElse($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ... ... EndFunc if merging them is hard, then get creative
  10. @Parsix The WebView2 object does need a UDF (User Data Folder) to store cached info / cookies etc. https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/user-data-folder?tabs=win32 So it will always look for a custom user folder to store this information.
  11. Here is a start Local $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") Local $hTlb = ControlGetHandle($hTrayWnd, "", "ToolbarWindow324") Local $aWPos = WinGetPos($hTrayWnd) Local $aTPos = ControlGetPos($hTrayWnd, "", $hTlb) ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF) ; Find a blue pixel from the autoit icon Local $aCoord = PixelSearch($aWPos[0] + $aTPos[0], $aWPos[1] + $aTPos[1], $aWPos[0] + $aTPos[0] + $aTPos[2], $aWPos[1] + $aTPos[1] + $aTPos[3], 0x5D83AC) If Not @error Then ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1]) MouseMove($aCoord[0], $aCoord[1], 1) ; * <-- for debugging purposes only EndIf Sleep(5000)
  12. Just simple useful improvement to previous script "Color Selector": -> set foreground color of testing label "@@##TEST##@@" to inverse color of its background color: GUICtrlSetBkColor($BTNCOLL, "0X" & $1RH & $1GH & $1BH) GUICtrlSetBkColor($BTNCOLR, "0X" & $2RH & $2GH & $2BH) ;GUICtrlSetColor($BTNCOLR, "0X" & $1RH & $1GH & $1BH) ;GUICtrlSetColor($BTNCOLL, "0X" & $2RH & $2GH & $2BH) GUICtrlSetColor($BTNCOLL, "0X" & Hex(16777215 - Dec($1RH&$1GH&$1BH),6)) ; 16777215 = Dec("FFFFFF") GUICtrlSetColor($BTNCOLR, "0X" & Hex(16777215 - Dec($2RH&$2GH&$2BH),6)) ; 16777215 = Dec("FFFFFF")
  13. Google : AutoIt read system tray. There is multiple threads discussing this. Pick one that is the most appropriate to you and bring back the code here if you need help.
  14. Enjoy this time anytime you can, absolutely!
  15. I didn't get a chance to say this earlier but I wanted to say that your fake it 'till you make it label-type status bar is absolutely worthy of a UDF, someday. I understand that you are busy lately. But someday in the future. Your examples for very nice looking and functionally great. In many ways, they are easier to size and manage in comparison to the real status bars. Also, the real status bars do not play as nicely with theming such as the Dark Mode UDF. Yours does. Thank you for your time on this as well. The current reality is, I think that I will end up using your fake it 'till you make it label-type status bar in my current project. The problem is that my current project already has a UDF which uses $WM_DRAWITEM and it conflicts with the $WM_DRAWITEM used with the other status bar examples here. I tried everything possible during the past few days with no luck.
  16. Hi. I have some light indicator in my cubic (Minecraft torch with addressed led strip and esp32). I have read Teams status from some Team's log file and send command to torch by BT. Some weeks before my IT updated my Teams to some new version and now there is no any log file with Teams status. I found several solutions like MS Graph AP , or reading process details (to read status from process title) , but all this not good solutions : MS Graph AP require Azure account/permissions/.. , since my Teams corporative version - no chance, about reading the status from process title - works until I "close" Teams (it stays run and moves to system try) . I didn't find option to read menu or status from Teams when it in system try. So , I think , maybe I can to read the icon of Teams from system try by AutoIt and from the icon to get color (changing with status) and by color to get the status. How can I read icons from System Try ? Thank you in advance.
  17. to me, is because it behaves well as -1, while setting a set size it does not anchor as it should while resizing. 280 = , while -1 = resizing to a wider GUI
  18. imho it may be a breaking script change, for example those who already scripted like this during the last years... Local $aParts[3] = [75, 150, 230] ; user's code ...which was seen like this inside Gary's function... Local $aParts[3] = [75, 150, -1] ; UDF's code ...then they had a status bar which used all the GUI width and maybe they were happy with this display. If today you change Gary's function, they'll have a much smaller status bar and won't be happy at all, unless they rework their code. No it is not, because my function _MyGUICtrlStatusBar_SetParts got only 2 parameters (Gary got 3 in _GUICtrlStatusBar_SetParts) Even the following line I added in my last script won't help in the UDF : it seems to solve everything in the script (I tested the 4 possibilities and @WildByDesign kindly re-tested them in his last post, confirming all possibilities passed the test) : If $aParts[Ubound($aParts) - 1] = -1 Then $aParts[Ubound($aParts) - 1] = $iW ; client width size I think it's a bit late to change Gary's function and it's not really important after all. My one and only regret is this : I've always been told and read that AutoIt was a "wrapper" for msdn, so I don't understand why did Gary force the last parameters to be -1 in any case, when msdn never said it was mandatory. I understand that a status bar should use all the GUI width, but as msdn didn't make it mandatory (on their SB_SETPARTS web page) then AutoIt should have done same, years ago, no more, no less and no big deal. So please let's not change anything in the UDF, noone ever complained about it... until we started this thread
  19. Last week
  20. Delighted to hear this, thanks for the 4 tests ! By the way, I'll try to find a way to solve this : while we resize the GUI, the distance between the right side of the last statusbar part and the sizebox should stay constant. Actually, this distance increases a bit while we enlarge the GUI ( due to the calculation which uses $g_aRatioW ) but it would probably display better if this particular distance was constant, with the sizebox always "stuck" to the right size of the last statusbar part during resizing. It's not really important, we'll see... Meanwhile, I tried to group several examples from the help file, so I'll be able to have results not only from my computer, but also from a Win11 computer in a few days. These results may help to understand better what should exactly be the height/width of the sizebox etc... I'll have a bit less time to do this, as family is coming tomorrow and we'll spend some time together
  21. Here is my latest script: Color Selector and a simple color distance calculation. #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #Region ### START Koda GUI section ### Form= #NoTrayIcon $color1="" $color2="" _TwoColorSelection($color1,$color2) ConsoleWrite ($color1 & " / " & $color2 & @CRLF) Exit Func _TwoColorSelection(ByRef $col1, ByRef $col2) Local $upd=1, $tmp Local $SL[6][2] Local $ColorForm1 = GUICreate("Color Selector:", 323, 302, -1, -1) For $x=0 to 2 $SL[$x][0] = GUICtrlCreateSlider(8+($x*46), 14, 31, 208, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_VERT)) GUICtrlSetLimit(-1, 255, 0) $SL[$x+3][0] = GUICtrlCreateSlider(187+($x*46), 14, 31, 208, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_VERT)) GUICtrlSetLimit(-1, 255, 0) Next GUICtrlCreateLabel("R G B", 14, 3, 128, 15) GUICtrlCreateLabel("R G B", 192, 3, 128, 15) Local $BTNCOLL = GUICtrlCreateButton("@@##TEST##@@", 8, 225, 124, 30) Local $BTNCOLR = GUICtrlCreateButton("@@##TEST##@@", 187, 224, 127, 30) Local $InpLeftH = GUICtrlCreateInput("", 24, 260, 84, 16, 9) ;9 = Centered + Uppercase Local $InpRightH = GUICtrlCreateInput("", 207, 260, 84, 16, 9) ;9 = Centered + Uppercase Local $InpLeft = GUICtrlCreateInput("", 24, 279, 84, 16, 9) ;9 = Centered + Uppercase Local $InpRight = GUICtrlCreateInput("", 207, 279, 84, 16, 9) ;9 = Centered + Uppercase GUICtrlCreateLabel("Distance:", 135, 255, 44, 24) Local $labelDistance = GUICtrlCreateLabel("", 134, 270, 64, 24) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() $SL="" Return ;Case $SL[0][0], $SL[1][0], $SL[2][0], $SL[3][0], $SL[4][0], $SL[5][0] ;Probably not needed because of the loop ; $upd=1 EndSwitch For $x=0 to 5 ;Check if the sliders have been changed with keyboard or mousewheel movement $tmp=GuiCtrlRead($SL[$x][0],2) if $SL[$x][1]<>$tmp then $upd=1 $SL[$x][1]=$tmp ExitLoop EndIf Next If $upd=1 Then Local $1R = 255 - GUICtrlRead($SL[0][0], 2), $1G = 255 - GUICtrlRead($SL[1][0], 2), $1B = 255 - GUICtrlRead($SL[2][0], 2) Local $2R = 255 - GUICtrlRead($SL[3][0], 2), $2G = 255 - GUICtrlRead($SL[4][0], 2), $2B = 255 - GUICtrlRead($SL[5][0], 2) Local $1RH = Hex($1R, 2), $1GH = Hex($1G, 2), $1BH = Hex($1B, 2) Local $2RH = Hex($2R, 2), $2GH = Hex($2G, 2), $2BH = Hex($2B, 2) $color1=$1RH & $1GH & $1BH $color2=$2RH & $2GH & $2BH GUICtrlSetData($InpLeftH, $color1) GUICtrlSetData($InpRightH, $color2 ) GUICtrlSetData($InpLeft, $1R & "," & $1G & "," & $1B) GUICtrlSetData($InpRight, $2R & "," & $2G & "," & $2B) GUICtrlSetBkColor($BTNCOLL, "0X" & $1RH & $1GH & $1BH) GUICtrlSetBkColor($BTNCOLR, "0X" & $2RH & $2GH & $2BH) GUICtrlSetColor($BTNCOLR, "0X" & $1RH & $1GH & $1BH) GUICtrlSetColor($BTNCOLL, "0X" & $2RH & $2GH & $2BH) $CD = CalculateColorDistance(GUICtrlRead($InpLeftH), GUICtrlRead($InpRightH)) GUICtrlSetData($labelDistance, $CD & " 0x" & Hex($CD, 4)) $upd=0 EndIf WEnd EndFunc ;==>_ColorSelection Func CalculateColorDistance($RGB1 = "000000", $RGB2 = "FFFFFF") ;Format RGB as hex string If IsString($RGB1) = 1 Then $RGB1 = StringReplace($RGB1, "0x", "") Else $RGB1=Hex($RGB1,6) EndIf If IsString($RGB2) = 1 Then $RGB2 = StringReplace($RGB2, "0x", "") Else $RGB2=Hex($RGB2,6) EndIf If StringLen($RGB1) < 6 Then Return -1 If StringLen($RGB2) < 6 Then Return -1 If StringLen($RGB1) > 6 Then $RGB1 = StringRight($RGB1, 6) ;Assuming the ARGB format If StringLen($RGB2) > 6 Then $RGB2 = StringRight($RGB2, 6) ;Assuming the ARGB format Local $1R = Int("0x" & StringMid($RGB1, 1, 2)), $1G = Int("0x" & StringMid($RGB1, 3, 2)), $1B = Int("0x" & StringMid($RGB1, 5, 2)) Local $2R = Int("0x" & StringMid($RGB2, 1, 2)), $2G = Int("0x" & StringMid($RGB2, 3, 2)), $2B = Int("0x" & StringMid($RGB2, 5, 2)) ;$DR = $1R - $2R ;$DG = $1G - $2G ;$DB = $1B - $2B Return Int(Abs($1R - $2R) + Abs($1G - $2G) + Abs($1B - $2B)) EndFunc ;==>CalculateColorDistance The distance calculations is very basic. Provide 2 color values in RGB format (e.g. "FF10FF" or 0x12FCD4). Each pair of R,G and B values is first substracted then the distance is calculated by adding them. As an extra feature: The color values are calculated even when the slider is changed by the mouse wheel (or arrow keys).
  22. I just tested the latest update with all variations and did not experience any issues.
  23. @pixelsearch I don't kown if the fact that the last part is not forcing filling to end of status bar will be a breaking script Do you think your solution is good for every body?
  24. Is the OrdoRC6 folder needed or is only the ocx enough to be compiled with the program? edit: some of files are needed, OrdoRC6 folder do not be renamed 😔 How to prevent show this message without create OrdoWebView folder in ProgramData ?
  25. I just rewrote the WM_SIZE function to accomplish this, in the 3rd script amended just above (my preceding post) By the way, there is something I didn't like a lot with this one-liner... _WinAPI_ShowWindow($g_hSizebox, (BitAND(WinGetState($g_hGui), $WIN_STATE_MAXIMIZED) ? @SW_HIDE : @SW_SHOW)) ...because the function _WinAPI_ShowWindow was constantly called (to show the sizebox) while the GUI was resizing, meaning dozen of superfluous calls for nothing, when 1 call should be enough. That's why I'm adding this local static variable... Local Static $bIsSizeBoxShown = True ...now _WinAPI_ShowWindow (to show the sizebox) will be called only once, when necessary. Also, as -1 for last $aParts[] could now create some issues, to be consistent with the script, I added this line : If $aParts[Ubound($aParts) - 1] = -1 Then $aParts[Ubound($aParts) - 1] = $iW ; client width size So now any of these 4 combinations seem to work, please be kind to try them, thanks. Local $aParts[3] = [90, 180, 280] ; the actual script Dim $g_aText[Ubound($aParts)] = ["Part 0", "Part 1", "Part 2"] Local $aParts[3] = [90, 180, -1] Dim $g_aText[Ubound($aParts)] = ["Part 0", "Part 1", "Part 2"] Local $aParts[1] = [280] Dim $g_aText[Ubound($aParts)] = ["Part 0"] Local $aParts[1] = [-1] Dim $g_aText[Ubound($aParts)] = ["Part 0"] It should run fine in any case, fingers crossed
  26. This latest version of your script is beautiful. I like how you have the option of full length status bar or not. I have one suggestion: If BitAND($iState, $WIN_STATE_MAXIMIZED) Then _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) EndIf Add that to your WM_MOVE function so that when the window is maximized, it will stretch the status bar full length which makes sense. When the window is no longer maximized, it goes back to regular _MyGUICtrlStatusBar_SetParts() automatically.
  27. Hellooo @jpm thanks for your answer, it's always nice to hear from you. So I did well not opening a trac ticket Done and done, without label, thanks to @Andreik and @argumentum for the inspiration. The status bar doesn't reach the right side of the window, because a function named _MyGUICtrlStatusBar_SetParts is called, with this result : If someone wants the status bar to reach the right side of the window, then just call (twice) the original function _GUICtrlStatusBar_SetParts instead, with the little artefact display found in the preceding pics, no big deal. [edit 5 hours after : this has been simplified and amended with the new code below] #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $g_hGui, $g_hSizebox, $g_hOldProc, $g_hBrush, $g_hStatus, $g_iHeight, $g_aText, $g_aRatioW, $g_iBkColor, $g_iTextColor, $g_hDots Example() ;============================================== Func Example() _GDIPlus_Startup() Local Const $SBS_SIZEBOX = 0x08, $SBS_SIZEGRIP = 0x10 Local $iW = 300, $iH = 100 Dim $g_iBkColor = 0x383838, $g_iTextColor = 0xFFFFFF $g_hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor($g_iBkColor) ;----------------- ; Create a sizebox window (Scrollbar class) BEFORE creating the StatusBar control $g_hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 0, 0, 0, 0, $g_hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP ; Subclass the sizebox (by changing the window procedure associated with the Scrollbar class) Local $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam') $g_hOldProc = _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc)) Local $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZENWSE) _WinAPI_SetClassLongEx($g_hSizebox, -12, $hCursor) ; $GCL_HCURSOR = -12 $g_hBrush = _WinAPI_CreateSolidBrush($g_iBkColor) ;----------------- $g_hStatus = _GUICtrlStatusBar_Create($g_hGui, -1, "", $WS_CLIPSIBLINGS) ; ClipSiblings style +++ Local $aParts[3] = [90, 180, 280] If $aParts[Ubound($aParts) - 1] = -1 Then $aParts[Ubound($aParts) - 1] = $iW ; client width size _MyGUICtrlStatusBar_SetParts($g_hStatus, $aParts) Dim $g_aText[Ubound($aParts)] = ["Part 0", "Part 1", "Part 2"] Dim $g_aRatioW[Ubound($aParts)] For $i = 0 To UBound($g_aText) - 1 _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW) ; _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW + $SBT_NOBORDERS) ; interesting ? $g_aRatioW[$i] = $aParts[$i] / $iW Next Local $idChangeText = GUICtrlCreateLabel("Change Text", 110, 25, 80, 30, $SS_CENTER + $SS_CENTERIMAGE), $iInc GUICtrlSetColor(-1, 0xFFFF00) ; yellow ; to allow the setting of StatusBar BkColor at least under Windows 10 _WinAPI_SetWindowTheme($g_hStatus, "", "") ; Set status bar background color _GUICtrlStatusBar_SetBkColor($g_hStatus, $g_iBkColor) $g_iHeight = _GUICtrlStatusBar_GetHeight($g_hStatus) + 3 ; change the constant (+3) if necessary $g_hDots = CreateDots($g_iHeight, $g_iHeight, 0xFF000000 + $g_iBkColor, 0xFF000000 + $g_iTextColor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_MOVE, "WM_MOVE") GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idChangeText $iInc += 1 For $i = 0 To UBound($g_aText) - 1 $g_aText[$i] = "Part " & $i & " : Inc " & $iInc Next _WinAPI_RedrawWindow($g_hStatus) EndSwitch WEnd _GDIPlus_BitmapDispose($g_hDots) _GUICtrlStatusBar_Destroy($g_hStatus) _WinAPI_DestroyCursor($hCursor) _WinAPI_DeleteObject($g_hBrush) _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, $g_hOldProc) DllCallbackFree($hProc) _GDIPlus_Shutdown() EndFunc ;==>Example ;============================================== Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) ; Andreik If $hWnd = $g_hSizebox And $iMsg = $WM_PAINT Then Local $tPAINTSTRUCT Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) Local $iWidth = DllStructGetData($tPAINTSTRUCT, 'rPaint', 3) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 1) Local $iHeight = DllStructGetData($tPAINTSTRUCT, 'rPaint', 4) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 2) Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsDrawImageRect($hGraphics, $g_hDots, 0, 0, $iWidth, $iHeight) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndIf Return _WinAPI_CallWindowProc($g_hOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ScrollbarProc ;============================================== Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor) ; Andreik Local $iDotSize = Int($iHeight / 10) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor) _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor) Local $a[6][2] = [[2,6], [2,4], [2,2], [4,4], [4,2], [6,2]] For $i = 0 To UBound($a) - 1 _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - $iDotSize * $a[$i][0], $iHeight - $iDotSize * $a[$i][1], $iDotSize, $iDotSize, $hBrush) Next _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap EndFunc ;==>CreateDots ;============================================== Func _MyGUICtrlStatusBar_SetParts($hWnd, $aPartEdge) ; Pixelsearch If Not IsArray($aPartEdge) Then Return False Local $iParts = UBound($aPartEdge) Local $tParts = DllStructCreate("int[" & $iParts & "]") For $i = 0 To $iParts - 1 DllStructSetData($tParts, 1, $aPartEdge[$i], $i + 1) Next DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $SB_SETPARTS, "wparam", $iParts, "struct*", $tParts) _GUICtrlStatusBar_Resize($hWnd) Return True EndFunc ;==>_MyGUICtrlStatusBar_SetParts ;============================================== Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; Pixelsearch #forceref $iMsg, $wParam, $lParam If $hWnd = $g_hGUI Then Local Static $bIsSizeBoxShown = True Local $aSize = WinGetClientSize($g_hGui) Local $aGetParts = _GUICtrlStatusBar_GetParts($g_hStatus) Local $aParts[$aGetParts[0]] For $i = 0 To $aGetParts[0] - 1 $aParts[$i] = Int($aSize[0] * $g_aRatioW[$i]) Next If BitAND(WinGetState($g_hGui), $WIN_STATE_MAXIMIZED) Then _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) ; set parts until GUI right border _WinAPI_ShowWindow($g_hSizebox, @SW_HIDE) $bIsSizeBoxShown = False Else _MyGUICtrlStatusBar_SetParts($g_hStatus, $aParts) ; set parts as user scripted them WinMove($g_hSizebox, "", $aSize[0] - $g_iHeight, $aSize[1] - $g_iHeight, $g_iHeight, $g_iHeight) If Not $bIsSizeBoxShown Then _WinAPI_ShowWindow($g_hSizebox, @SW_SHOW) $bIsSizeBoxShown = True EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE ;============================================== Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam If $hWnd = $g_hGUI Then _WinAPI_RedrawWindow($g_hSizebox) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOVE ;============================================== Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) ; Kafu #forceref $hWnd, $iMsg, $wParam Local Static $tagDRAWITEM = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;hwnd hwndItem;handle hDC;long rcItem[4];ulong_ptr itemData" Local $tDRAWITEM = DllStructCreate($tagDRAWITEM, $lParam) If $tDRAWITEM.hwndItem <> $g_hStatus Then Return $GUI_RUNDEFMSG ; only process the statusbar Local $itemID = $tDRAWITEM.itemID ; status bar part number (0, 1, ...) Local $hDC = $tDRAWITEM.hDC Local $tRect = DllStructCreate("long left;long top;long right;long bottom", DllStructGetPtr($tDRAWITEM, "rcItem")) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $g_hBrush) ; backgound color _WinAPI_SetTextColor($hDC, $g_iTextColor) ; text color _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $tRect.top + 1) DllStructSetData($tRect, "left", $tRect.left + 1) _WinAPI_DrawText($hDC, $g_aText[$itemID], $tRect, $DT_LEFT) Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM
  1. Load more activity
×
×
  • Create New...