Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 10/16/2025 in all areas

  1. Hi @Gianni, Thanks you, glad to see the interest in the code Yes, the $data variable contains a pointer to a array of NOTIFICATION_USER_INPUT_DATA elements. The length of the array is given via the $count variable. Something like this should do it (not tested yet) $pData = $data For $i = 1 To $count $tData = DllStructCreate('PTR Key;PTR Value;', $pData) $key = _WinAPI_GetString($tData.Key) $value = _WinAPI_GetString($tData.Value) ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value)) $pData += DllStructGetSize($tData) Next I think I'll update the example with inputs to demonstrate later, and I'll also add a helper function to convert the data array into a Map I'll update the post later, when i have time to test the code, if something does not work
    4 points
  2. Progress! ... Click the form button beside of the cursor button (more than once if you want to). Now the windows are clipped to the left too! #include-once Opt("WinTitleMatchMode", 4) ; advanced Opt("MouseCoordMode" , 2) #include <WindowsStylesConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> Global $formList[], $formCount = 0 Global Const $main_width = 815 Global Const $main_height = 860 Global Const $main_left = (@DesktopWidth / 2) - ($main_width / 2) Global Const $main_top = (@DesktopHeight / 2) - ($main_height / 2) Global Const $guiCanvas = GuiCreate("GUI Canvas", $main_width, $main_height, $main_left, $main_top) Global Const $canvas = GuiCreate('', ($main_width - 105), ($main_height - 35), 95, 5, $WS_CHILD, $WS_EX_OVERLAPPEDWINDOW, $guiCanvas) GUISetFont(10, -1, -1, "Segoe UI", $guiCanvas) #region ; menu items Global Const $menu_file = GUICtrlCreateMenu ("File") Global Const $menu_save_definition = GUICtrlCreateMenuitem("Save", $menu_file) ; Roy add-on Global Const $menu_load_definition = GUICtrlCreateMenuitem("Load", $menu_file) ; Roy add-on GUICtrlCreateMenuitem('' , $menu_file) ; Roy add-on Global Const $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_file) Global Const $menu_edit = GUICtrlCreateMenu ("Edit") Global Const $menu_vals = GUICtrlCreateMenuitem("Vals" , $menu_edit) ; added by: TheSaint Global Const $menu_wipe = GUICtrlCreateMenuitem("Clear all controls", $menu_edit) Global Const $menu_about = GUICtrlCreateMenuitem("About" , $menu_edit) ; added by: TheSaint GUICtrlSetState($menu_wipe, $GUI_DISABLE) Global Const $menu_settings = GUICtrlCreateMenu ("Settings") Global Const $menu_show_grid = GUICtrlCreateMenuItem("Show grid" , $menu_settings) Global Const $menu_grid_snap = GUICtrlCreateMenuItem("Snap to grid" , $menu_settings) Global Const $menu_paste_pos = GUICtrlCreateMenuItem("Paste at mouse position" , $menu_settings) Global Const $menu_show_ctrl = GUICtrlCreateMenuItem("Show control when moving", $menu_settings) Global Const $menu_show_hidden = GUICtrlCreateMenuItem("Show hidden controls" , $menu_settings) GUICtrlSetState($menu_show_grid , $GUI_CHECKED ) GUICtrlSetState($menu_grid_snap , $GUI_CHECKED ) GUICtrlSetState($menu_paste_pos , $GUI_CHECKED ) GUICtrlSetState($menu_show_ctrl , $GUI_CHECKED ) GUICtrlSetState($menu_show_hidden, $GUI_UNCHECKED) #endregion ; menu items #region ; toolbar Global Const $default_cursor = CreateToolButton("Cursor" , 5, 5) Global Const $toolForm = CreateToolButton("Form" , 45, 5) Global Const $toolGroup = CreateToolButton("Group" , 5, 45) Global Const $toolButton = CreateToolButton("Button" , 45, 45) Global Const $toolCheckbox = CreateToolButton("Checkbox" , 5, 85) Global Const $toolRadio = CreateToolButton("Radio" , 45, 85) Global Const $toolEdit = CreateToolButton("Edit" , 5, 125) Global Const $toolInput = CreateToolButton("Input" , 45, 125) Global Const $toolLabel = CreateToolButton("Label" , 5, 165) Global Const $toolUpDown = CreateToolButton("UpDown" , 45, 165) Global Const $toolList = CreateToolButton("List" , 5, 205) Global Const $toolCombo = CreateToolButton("Combo" , 45, 205) Global Const $toolDate = CreateToolButton("Date" , 5, 245) Global Const $toolTreeview = CreateToolButton("Treeview" , 45, 245) Global Const $toolProgress = CreateToolButton("Progress" , 5, 285) Global Const $toolAvi = CreateToolButton("Avi" , 45, 285) Global Const $toolIcon = CreateToolButton("Icon" , 5, 325) Global Const $toolPic = CreateToolButton("Pic" , 45, 325) Global Const $toolSlider = CreateToolButton("Slider" , 5, 365) Global Const $toolMenu = CreateToolButton("Menu" , 45, 365) Global Const $toolContextMenu = CreateToolButton("Context Menu", 5, 405) Global Const $toolTab = CreateToolButton("Tab" , 45, 405) #endregion ; toolbar main() Func main() GUISetState(@SW_SHOWNORMAL, $guiCanvas) GUISetState(@SW_SHOWNORMAL, $canvas) Local $msg Do $msg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $msg[1] Case $guiCanvas Switch $msg[0] Case $toolForm CreateForm() Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch Until False EndFunc Func CreateForm() GUISwitch($canvas) $formCount += 1 Local Const $form = GuiCreate("Form " & $formCount, 400, 600, 5, 5, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $canvas) $formList["Form" & $formCount] = $form GUISetState(@SW_SHOWNORMAL, $form) GUISwitch($guiCanvas) Return $form EndFunc Func CreateToolButton(Const $name, Const $left, Const $top) Local Const $tool = GUICtrlCreateRadio($name, $left, $top, 40, 40, BitOR($BS_PUSHLIKE, $BS_ICON)) GUICtrlSetImage($tool, @ScriptDir & "\resources\Icons\" & $name & ".ico") GUICtrlSetTip($tool, $name) Return $tool EndFunc
    3 points
  3. I just wanted to take a moment to thank everyone again who helped with this issue. I've completed the part of the project that relates to the menubar. I actually ended up coloring that line in such a way that it gives the GUI some depth and also made the statusbar sizing and style to match it. When I started learning AutoIt a little over a year ago, I never thought that such beautiful GUIs could be made. I was able to make that line semi-transparent along with the rest of the GUI so that it does the blur behind well and also the Windows 11 materials (Mica, Acrylic, etc.) Cheers everyone! 🍷
    3 points
  4. I am sure he's happy after 5 years!!! 😉
    3 points
  5. Hi @genius257 Your input data reader works great! I added several inputs and buttons for a quick, rough test, and the values entered into the "toast" are returned to the callback and parsed correctly by your function. It appears that a notification toast doesn't allow more than 5 inputs; each selector input can't contain more than 5 options, and buttons can't exceed 5. Text inputs allow about 2,000 characters. But these limitations are due to the inherent features of Microsoft notification toasts, not your code. ... these toasts are funny... Bye and thanks again! cheers #include "./src/toast.au3" #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <InetConstants.au3> #include <WinApiReg.au3> #include <WinApiIcons.au3> #include <GDIPlus.au3> #include <WinAPIConv.au3> If Not FileExists(@TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Then _GDIPlus_Startup() $thIcons = DllStructCreate("HWND") $x = _WinAPI_ExtractIconEx(@AutoItExe, 0, 0, $thIcons, 1) ConsoleWrite($x & @CRLF) $hBitmap = _GDIPlus_BitmapCreateFromHICON(DllStructGetData($thIcons, 1)) _GDIPlus_ImageSaveToFileEx($hBitmap, @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png", _GDIPlus_EncodersGetCLSID("PNG")) _GDIPlus_BitmapDispose($hBitmap) ConsoleWrite(@error & @CRLF) _GDIPlus_Shutdown() _WinAPI_DestroyIcon(DllStructGetData($thIcons, 1)) EndIf Global Const $sAppName = @ScriptName Global $tCLSID = _Toast_CoCreateGuid() Global $sGUID = _WinAPI_StringFromGUID($tCLSID) ConsoleWrite("app CLSID: " & $sGUID & @CRLF) _Toast_Initialize($sAppName, $tCLSID, OnToastActivation, "AutoIt Toast Example", @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Opt("GuiOnEventMode", 1) Global $hWnd = GUICreate("Toast example", 700, 320) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE") Global $hButton01 = GUICtrlCreateButton("From template", 10, 10, 200, 120) GUICtrlSetOnEvent(-1, "ToastFromTemplateExample") Global $hButton02 = GUICtrlCreateButton("From XML string", 10, 140, 200, 120) GUICtrlSetOnEvent(-1, "ToastFromXmlString") Global $hRich = _GUICtrlRichEdit_Create($hWnd, "", 220, 10, 470, 300) GUISetState() While 1 Sleep(10) WEnd Func ToastFromTemplateExample() Local $oXml = _Toast_CreateToastTemplateXmlDocument() Local $pToast = _Toast_CreateToastNotificationFromXmlObject($oXml) _Toast_Show($pToast) EndFunc ;==>ToastFromTemplateExample Func DownloadImage() If FileExists(@TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg") Then Return _GUICtrlRichEdit_AppendText($hRich, "Trying to download avatar image from gravatar..." & @CRLF) Local $iBytes = InetGet("https://gravatar.com/avatar/e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778", @TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg", $INET_FORCEBYPASS) Local $error = @error If @error <> 0 Then _GUICtrlRichEdit_AppendText($hRich, "Failed to download image" & @CRLF) Return EndIf _GUICtrlRichEdit_AppendText($hRich, "Done! " & $iBytes & " bytes downloaded" & @CRLF) EndFunc ;==>DownloadImage Func ToastFromXmlString() DownloadImage() ; https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml Local $sToast = "" $sToast &= "<toast activationType=""foreground"" launch=""action=viewAlarm&amp;alarmId=3"" scenario=""alarm"">" ; action=mainContent;alarmId=3 $sToast &= "" $sToast &= " <visual>" $sToast &= " <binding template=""ToastGeneric"">" $sToast &= " <text>Time to wake up!</text>" $sToast &= " <text>To prove you're awake, select which of the following fruits is yellow...</text>" $sToast &= ' <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>' $sToast &= " </binding>" $sToast &= " </visual>" $sToast &= "" $sToast &= " <actions>" $sToast &= "<!-- #1 First input-->" $sToast &= " <input id=""Options"" type=""selection"" defaultInput=""Selection1"">" $sToast &= " <selection id=""Selection1"" content=""Option 1/5""/>" $sToast &= " <selection id=""Selection2"" content=""Option 2/5""/>" $sToast &= " <selection id=""Selection3"" content=""Option 3/5""/>" $sToast &= " <selection id=""Selection4"" content=""Option 4/5""/>" $sToast &= " <selection id=""Selection5"" content=""Option 5/5""/>" ; $sToast &= " <selection id=""Selection6"" content=""Option 6/6""/>" ; No more than 5 options allowed $sToast &= " </input>" $sToast &= "<!-- #2 Second input-->" $sToast &= " <input id=""Poem"" type=""text"" placeHolderContent=""Please write a poem"" />" $sToast &= "<!-- #3 Third input-->" $sToast &= " <input id=""Season"" type=""selection"" defaultInput=""Autumn"">" $sToast &= " <selection id=""Spring"" content=""Spring""/>" $sToast &= " <selection id=""Summer"" content=""Summer""/>" $sToast &= " <selection id=""Autumn"" content=""Autumn""/>" $sToast &= " <selection id=""Winter"" content=""Winter""/>" $sToast &= " </input>" $sToast &= "<!-- #4 Fourth input-->" $sToast &= " <input id=""Mood"" type=""selection"" defaultInput=""Love"">" $sToast &= " <selection id=""Happy"" content=""I'm Happy 😀""/>" $sToast &= " <selection id=""Sad"" content=""I'm Sad 😢""/>" $sToast &= " <selection id=""Love"" content=""I'm in love ❤️""/>" $sToast &= " <selection id=""Angry"" content=""I'm mad at the whole world 🖕""/>" $sToast &= " </input>" $sToast &= "<!-- #5 Fifth input-->" $sToast &= " <input id=""Gender"" type=""selection"" defaultInput=""Female"">" $sToast &= " <selection id=""Male"" content=""I'm a man""/>" $sToast &= " <selection id=""Female"" content=""I'm a woman""/>" $sToast &= " </input>" #cs ; --- No more than 5 inputs allowed and no more than 5 entry --- $sToast &= "<!-- #6 Sixth input-->" $sToast &= " <input id=""WeekDay"" type=""selection"" defaultInput=""Wednesday"">" $sToast &= " <selection id=""Monday"" content=""Monday""/>" $sToast &= " <selection id=""Tuesday"" content=""5 Sincronizza contatti""/>" $sToast &= " <selection id=""Wednesday"" content=""Wednesday""/>" $sToast &= " <selection id=""Thursday"" content=""Thursday""/>" $sToast &= " <selection id=""Friday"" content=""Friday""/>" $sToast &= " <selection id=""Saturday"" content=""Saturday""/>" $sToast &= " <selection id=""Sunday"" content=""Sunday""/>" $sToast &= " </input>" #ce ; --- No more than 5 inputs allowed and no more than 5 entry --- $sToast &= "" $sToast &= " <!-- Button 1 -->" $sToast &= " <action content=""Yes, I agree""" $sToast &= " arguments=""action=Agree""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 2 -->" $sToast &= " <action content=""No, I disagree""" $sToast &= " arguments=""action=Disagree""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 3 -->" $sToast &= " <action content=""Save data""" $sToast &= " arguments=""action=Save""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 4 -->" $sToast &= " <action content=""Open settings""" $sToast &= " arguments=""action=Open""" $sToast &= " activationType=""background""/>" $sToast &= " <!-- Button 5 -->" $sToast &= " <action content=""Dismiss""" $sToast &= " arguments=""action=Dismiss""" $sToast &= " activationType=""background""/>" #cs ; --- No more than 5 buttons allowed --- $sToast &= " <!-- Button 6 -->" $sToast &= " <action content=""Snooze""" $sToast &= " arguments=""action=Snooze""" $sToast &= " activationType=""background""/>" #ce ; --- No more than 5 buttons allowed --- $sToast &= " </actions>" $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>' $sToast &= "</toast>" ;#ce Local $pToast = _Toast_CreateToastNotificationFromXmlString($sToast) If @error <> 0 Then _GUICtrlRichEdit_AppendText($hRich, _WinAPI_GetErrorMessage(@error)) Return EndIf _Toast_Show($pToast) _GUICtrlRichEdit_AppendText($hRich, $pToast & @TAB & "VarGetType: " & VarGetType($pToast) & @CRLF) EndFunc ;==>ToastFromXmlString ; https://learn.microsoft.com/en-us/windows/win32/api/notificationactivationcallback/nf-notificationactivationcallback-inotificationactivationcallback-activate Func OnToastActivation($pSelf, $appUserModelId, $invokedArgs, $data, $count) _GUICtrlRichEdit_AppendText($hRich, _ "Toast activated!" & @CRLF _ & " " & "appUserModelId: " & $appUserModelId & @TAB & "VarGetType: " & VarGetType($appUserModelId) & @CRLF _ & " " & "invokedArgs: " & $invokedArgs & @TAB & "VarGetType: " & VarGetType($invokedArgs) & @CRLF _ & " " & "$data: " & $data & @TAB & "VarGetType: " & VarGetType($data) & @TAB & DllStructGetData($data, 1) & @CRLF _ ; ??? also _WinAPI_GetString ... no good as well & " " & "$count: " & $count & @TAB & "VarGetType: " & VarGetType($count) & @CRLF _ ) _GUICtrlRichEdit_AppendText($hRich, @CRLF & "-----------------------------" & @CRLF) Local $pData = $data For $i = 1 To $count $tData = DllStructCreate('PTR Key;PTR Value;', $pData) $key = _WinAPI_GetString($tData.Key) $value = _WinAPI_GetString($tData.Value) ; ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value)) _GUICtrlRichEdit_AppendText($hRich, StringFormat('"%s"="%s"\n', $key, $value)) $pData += DllStructGetSize($tData) Next Return $_Toast_S_OK EndFunc ;==>OnToastActivation Func GUI_CLOSE() Exit EndFunc ;==>GUI_CLOSE
    2 points
  6. Tremendous! Thank you, this gives me something to tinker with!
    2 points
  7. When you parse the GIF anim you will get a handle to the current frame which you can resize and display appropriatly.
    2 points
  8. I came across this issue in one of my projects and decided to recreate a smaller script to reproduce the issue and see if anyone knows how I can get around this issue. The main GUI script has the ability to hide to it's system tray icon Clicking on the tray icon will show the GUI again In this case, the menu items (Help > About) and controls still work I have a situation where I use another script to show the GUI again since it is normally hidden in the system tray. GUI is already hidden in system tray This second script runs to show the GUI GUI does show and everything appears visually correct In this case, the menu items (Help > About) and controls do NOT work Yet if I hide the GUI again during the same run, and show itself again from the tray icon, everything works again. Therefore, it only seems to happen when showing the GUI from another process. Script1: #NoTrayIcon #include <AutoItConstants.au3> #include <TrayConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> Global $hGUI Opt("TrayMenuMode", 3) Opt("TrayAutoPause", 0) Opt("TrayOnEventMode", 1) TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, 'idGUI') TraySetClick(16) $idGUI = TrayCreateItem("Show GUI") TrayItemSetOnEvent($idGUI, "idGUI") TrayCreateItem("") $idExit = TrayCreateItem('Exit') TrayItemSetOnEvent($idExit, "_Exit") TraySetIcon(@AutoItExe, 1) TraySetToolTip("Show GUI") Example() Func Example() Local $sDefaultstatus = "Ready" $hGUI = GUICreate("My GUI menu", 300, 200) Local $idMnu_File = GUICtrlCreateMenu("&File") Local $idMnu_Help = GUICtrlCreateMenu("Help") Local $idMni_Info = GUICtrlCreateMenuItem("About", $idMnu_Help) Local $idMnu_View = GUICtrlCreateMenu("View", -1, 1) Local $idBtn_Hide = GUICtrlCreateButton("Hide GUI", 50, 130, 70, 20) GUICtrlSetState(-1, $GUI_FOCUS) Local $idBtn_Cancel = GUICtrlCreateButton("Exit", 180, 130, 70, 20) Local $idLbl_Status = GUICtrlCreateLabel($sDefaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN)) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $idBtn_Hide GUISetState(@SW_HIDE, $hGUI) Case $idBtn_Cancel, $GUI_EVENT_CLOSE ExitLoop Case $idMni_Info MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") EndSwitch WEnd GUIDelete() EndFunc ;==>Example Func _Exit() Exit EndFunc Func idGUI() ; get GUI window state Local $iState = WinGetState($hGUI) If $iState <> $WIN_STATE_VISIBLE Then GUISetState(@SW_SHOW, $hGUI) EndFunc Script2: #include <WinAPISysWin.au3> ; show and activate the GUI window $hWnd = WinGetHandle("My GUI menu") _WinAPI_ShowWindow($hWnd, @SW_SHOW) _WinAPI_SetForegroundWindow($hWnd) By the way, I have tried all of the other functions such as WinActivate and various WinAPI to show and give focus to the GUI window. They all still work to show the GUI but also still have controls and menu items that fail. Does anyone know why this issue occurs or what I can do to fix it? Thank you for your time.
    2 points
  9. You could have more instances looking for it and report via IPC ( my take on "how" here ) and there are a few in the WiKi that you can try. This way if you run 8 chunks of screen, it'll 8 times faster of whatever technique you use.
    2 points
  10. User Interface Builder Overview Use this tool to visually design Windows applications with a focus on Metro windows, standard windows, and Tool windows. This is for users who want a faster and simpler development tool. Drag-and-drop GUI creation, code generation, and easy control alignment tools. No more clicking through property sheets to set variable names, sizes, and the control’s text. Please replace "MetroUDF-Required\SSCtrlHover.au3" within the metro UDF files to see more meaningful messages in the console. The following line was inserted into the function. This prevents crashing on syntax and logical errors while Metro buttons are in use. Func _cHvr_Register($idCtrl, $fnHovOff = '', $fnHoverOn = '', $fnClick = '', $fnDblClk = '', $HoverData = 0,$ClickData = 0,$fnRightClick = '') If $BLOCK_HOVER_REGISTRATION Then Return Unfortunately, the following will have to added to your scripts if you already use Metro UDF and you replace "SSCtrlHover.au3". Global $BLOCK_HOVER_REGISTRATION = False #include "MetroGUI_UDF.au3" #include "MetroGUI_UDF_xpk.au3" #include "_GUIDisable.au3" ; For dim effects when msgbox is displayed Features Metro Controls for all window types WYSIWYG real-time preview Generates AutoIt GUI and message loop code Multiple control selection and manipulation Make additional selections with the CTRL key Accelerated control movements with the SHIFT key Change controls position with mouse or arrow keys Double click a control to precisely set its size and text Save/load GUI layouts and Control layouts to files Custom styles/themes and Controls using Metro Snap-to-guide, and toolbar alignment aids Drag down guides from the top and left sides of the Designer window Copy-n-paste between different window types Technical Details .Gui/.Ctrls file is a simple delimited text file Copy-n-paste is a similar file without the window specifications The application is meant to be portable, so it is one file The only Custom UDFs in use is Metro 5.1, and my Metro Expansion pack The script uses Label controls for everything. No GDI was used. Every control handle is saved in an array Maps are used in Metro and in future UDFs containing new controls You need Metro 5.1 UDF Limitations and known issues Resizing the Metro window with the mouse is flaky Changing control and window styles is not implemented Window size cannot be changed precisely Undo functionality might cause problems with code generation No Redo implemented Thank you BB19 and everyone that contributed to Metro UDF. MetroGUI_UDF_xpk.au3 SSCtrlHover.au3 UserInterfaceBuilder.au3
    2 points
  11. #NoTrayIcon #include <AutoItConstants.au3> #include <TrayConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> Global $hGUI Opt("TrayMenuMode", 3) Opt("TrayAutoPause", 0) Opt("TrayOnEventMode", 1) TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, 'idGUI') TraySetClick(16) Global $idGUI = TrayCreateItem("Show GUI") TrayItemSetOnEvent($idGUI, "idGUI") TrayCreateItem("") Global $idExit = TrayCreateItem('Exit') TrayItemSetOnEvent($idExit, "_Exit") TraySetIcon(@AutoItExe, 1) TraySetToolTip("Show GUI") Example() Func Example() Local $sDefaultstatus = "Ready" $hGUI = GUICreate("My GUI menu", 300, 200) Local $idMnu_File = GUICtrlCreateMenu("&File") Local $idMnu_Help = GUICtrlCreateMenu("Help") Local $idMni_Info = GUICtrlCreateMenuItem("About", $idMnu_Help) Local $idMnu_View = GUICtrlCreateMenu("View", -1, 1) Local $idBtn_Hide = GUICtrlCreateButton("Hide GUI", 50, 130, 70, 20) GUICtrlSetState(-1, $GUI_FOCUS) Local $idBtn_Cancel = GUICtrlCreateButton("Exit", 180, 130, 70, 20) Local $idLbl_Status = GUICtrlCreateLabel($sDefaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN)) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $idBtn_Hide ;~ GUISetState(@SW_HIDE, $hGUI) WinSetState($hGUI, "", @SW_HIDE) Case $idBtn_Cancel, $GUI_EVENT_CLOSE ExitLoop Case $idMni_Info MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") EndSwitch WEnd GUIDelete() EndFunc ;==>Example Func _Exit() Exit EndFunc Func idGUI() If Not BitAND(WinGetState($hGUI), $WIN_STATE_VISIBLE) Then WinSetState($hGUI, "", @SW_SHOW) ;~ ; get GUI window state ;~ Local $iState = WinGetState($hGUI) ;~ If $iState <> $WIN_STATE_VISIBLE Then GUISetState(@SW_SHOW, $hGUI) EndFunc yes, is an old bug, and the way it is. Fortunately you can get around it.
    2 points
  12. I tried to apply dark mode to the SampleControls.au3 example. What I did so far: ; Coded by UEZ build 2025-10-17 beta ;not DPI aware! #include <APIConstants.au3> #include <AVIConstants.au3> #include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <GuiMenu.au3> #include <GuiMonthCal.au3> #include <GuiScrollBars.au3> #include <GuiTab.au3> #include <TreeViewConstants.au3> #include <ListViewConstants.au3> #include <WinAPIConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIRes.au3> #include <WinAPIShellEx.au3> #include <WinAPISys.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> Enum $IHCM_USE_CACHED_VALUE, $IHCM_REFRESH Enum $APPMODE_DEFAULT = 0, $APPMODE_ALLOWDARK, $APPMODE_FORCEDARK, $APPMODE_FORCELIGHT, $APPMODE_MAX Const $PRF_CLIENT = 0x04 ; Dark Mode Colors (RGB) Global Const $COLOR_BG_DARK = 0x202020 Global Const $COLOR_TEXT_LIGHT = 0xFFFFFF Global Const $COLOR_CONTROL_BG = 0x2B2B2B Global Const $COLOR_EDIT_BG = 0x1E1E1E Global Const $COLOR_BUTTON_BG = 0x333333 Global Const $COLOR_BORDER = 0x3F3F3F ; Global variables for subclassing (MUST be declared before _Example()!) Global $g_hGUI = 0, $g_hTab, $g_ListView Global $g_aControls[50][3] = [[0, 0, 0]] ; [ControlID, hWnd, OldWndProc] Global $g_iControlCount = 0 Global $g_pSubclassProc = 0 ; Global brushes for _WM_CTLCOLOR (avoids memory leaks) Global $g_hBrushEdit = 0 Global $g_hBrushButton = 0 Global $g_hBrushBg = 0 Global $g_hBrushGreen Global $g_hLabelGreen = 0, $g_idLabelGreen Global $g_idLabelPic, $g_hLabelPic Global $g_hMenu = 0 Global $g_idDate = 0, $g_hDate = 0 ; Global variable for tab subclassing Global $g_hTab_CB, $g_pTab_CB, $g_hProc ; Structure for NM_CUSTOMDRAW notification Global Const $tagNMCUSTOMDRAW = _ $tagNMHDR & ";" & _ ; Contains NM_CUSTOMDRAW / NMHDR header among other things "dword dwDrawStage;" & _ ; Current drawing stage (CDDS_*) "handle hdc;" & _ ; Device Context Handle "long left;long top;long right;long bottom;" & _ ; Drawing rectangle "dword_ptr dwItemSpec;" & _ ; Item index or other info (depending on the control) "uint uItemState;" & _ ; State Flags (CDIS_SELECTED, CDIS_FOCUS etc.) "lparam lItemlParam" ; lParam set by the item (e.g., via LVITEM.lParam) Global $g_hMenu = 0, $hMenuFont Global $g_aMenuText = [] ; dynamic array for top-level menu texts Global $arMenuItems[1][8] $arMenuItems[0][0] = 0 Global $arSideItems[1][10] $arSideItems[0][0] = 0 Const $ODT_MENU = 1 Const $ODS_SELECTED = 0x0001 Const $ODS_DISABLED = 0x0004 _Example() Func _Example() ; Create global brushes $g_hBrushEdit = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_EDIT_BG)) $g_hBrushButton = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BUTTON_BG)) $g_hBrushBg = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) #Region GUI $g_hGUI = GUICreate("Sample GUI with Dark Mode", 400, 400) GUISetIcon(@SystemDir & "\mspaint.exe", 0) GUISetBkColor($COLOR_BG_DARK, $g_hGUI) ; Register GUI-level WM_CTLCOLOR messages GUIRegisterMsg($WM_CTLCOLOREDIT, "_WM_CTLCOLOR") GUIRegisterMsg($WM_CTLCOLORLISTBOX, "_WM_CTLCOLOR") GUIRegisterMsg($WM_CTLCOLORBTN, "_WM_CTLCOLOR") GUIRegisterMsg($WM_CTLCOLORSTATIC, "_WM_CTLCOLOR") GUIRegisterMsg($WM_INITMENUPOPUP, "_OnInitMenuPopup") GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM_Handler") GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM_Handler") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_ACTIVATE, "_WM_ACTIVATE_OverpaintLine") GUIRegisterMsg($WM_WINDOWPOSCHANGED, "_WM_WINDOWPOSCHANGED_OverpaintLine") #EndRegion GUI #Region MENU Global $g_aMenuText[4] $g_aMenuText[0] = "Menu &One" $g_aMenuText[1] = "Menu &Two" $g_aMenuText[2] = "Menu Th&ree" $g_aMenuText[3] = "Menu &Four" Local $idMenu1 = GUICtrlCreateMenu($g_aMenuText[0]) Local $idMenu2 = GUICtrlCreateMenu($g_aMenuText[1]) GUICtrlCreateMenu($g_aMenuText[2]) GUICtrlCreateMenu($g_aMenuText[3]) GUICtrlCreateMenuItem('SubMenu One &A', $idMenu1) GUICtrlCreateMenuItem('SubMenu One &B', $idMenu1) ; Owner-draw Top-Level Menu einrichten _MakeMenuOwnerDraw($g_hGUI) #EndRegion MENU #Region CONTEXT MENU Local $idContextMenu = GUICtrlCreateContextMenu() GUICtrlCreateMenuItem("Context Menu", $idContextMenu) GUICtrlCreateMenuItem("", $idContextMenu) GUICtrlCreateMenuItem("&Properties", $idContextMenu) #EndRegion CONTEXT MENU #Region PIC Local $idPic = GUICtrlCreatePic("", 0, 0, 169, 68) GUICtrlSetImage($idPic, "C:\Program Files (x86)\AutoIt3\Examples\GUI\logo4.gif") GUICtrlSetTip(-1, '#Region PIC') $g_idLabelPic = GUICtrlCreateLabel("Sample Pic", 75, 1, 53, 15) $g_hLabelPic = GUICtrlGetHandle($g_idLabelPic) #EndRegion PIC #Region AVI Local $idAvi = GUICtrlCreateAvi("C:\Program Files (x86)\AutoIt3\Examples\GUI\SampleAVI.avi", 0, 180, 10, 32, 32, $ACS_AUTOPLAY) GUICtrlSetTip(-1, '#Region AVI') GUICtrlCreateLabel("Sample avi", 175, 50) #EndRegion AVI #Region TAB Local $idTab = GUICtrlCreateTab(240, 0, 150, 70), $g_hTab = GUICtrlGetHandle($idTab) _AddControlForSubclass($idTab) GUICtrlCreateTabItem("One") GUICtrlSetTip(-1, '#Region TAB1') GUICtrlCreateLabel("Sample Tab", 250, 40) GUICtrlCreateTabItem("Two") GUICtrlSetTip(-1, '#Region TAB2') GUICtrlCreateTabItem("Three") GUICtrlSetTip(-1, '#Region TAB3') GUICtrlCreateTabItem("") $g_hTab = GUICtrlGetHandle($idTab) #EndRegion TAB #Region COMBO Local $idCombo = GUICtrlCreateCombo("Sample Combo", 250, 80, 120, 100) GUICtrlSetData($idCombo, "Item 2|Item 3", "Sample Combo") _AddControlForSubclass($idCombo) GUICtrlSetTip(-1, '#Region COMBO') #EndRegion COMBO #Region PROGRESS Local $idProgress = GUICtrlCreateProgress(60, 80, 150, 20) _AddControlForSubclass($idProgress) GUICtrlSetTip(-1, '#Region PROGRESS') GUICtrlSetData(-1, 60) GUICtrlCreateLabel("Progress:", 5, 82) #EndRegion PROGRESS #Region EDIT Local $idEdit = GUICtrlCreateEdit(@CRLF & " Sample Edit Control", 10, 110, 150, 70) _AddControlForSubclass($idEdit) GUICtrlSetTip(-1, '#Region EDIT') #EndRegion EDIT #Region LIST Local $idList = GUICtrlCreateList("", 5, 190, 100, 90) _AddControlForSubclass($idList) GUICtrlSetTip(-1, '#Region LIST') GUICtrlSetData(-1, "A.Sample|B.List|C.Control|D.Here", "B.List") #EndRegion LIST #Region ICON GUICtrlCreateIcon("explorer.exe", 0, 175, 120) GUICtrlSetTip(-1, '#Region ICON') GUICtrlCreateLabel("Icon", 180, 160, 50, 20) #EndRegion ICON #Region LIST VIEW Local $idListView = GUICtrlCreateListView("Sample|ListView|", 110, 190, 110, 80, $LVS_REPORT) _AddControlForSubclass($idListView) GUICtrlSetBkColor($idListView, $COLOR_EDIT_BG) GUICtrlSetColor($idListView, $COLOR_TEXT_LIGHT) GUICtrlSetTip(-1, '#Region LIST VIEW') GUICtrlCreateListViewItem("A|One", $idListView) GUICtrlCreateListViewItem("B|Two", $idListView) GUICtrlCreateListViewItem("C|Three", $idListView) $g_ListView = GUICtrlGetHandle($idListView) #EndRegion LIST VIEW #Region GROUP WITH RADIO BUTTONS Local $idGroup = GUICtrlCreateGroup("Sample Group", 230, 120) GUICtrlSetColor($idGroup, $COLOR_TEXT_LIGHT) Local $idRadio1 = GUICtrlCreateRadio("Radio One", 250, 140, 80) GUICtrlSetTip($idRadio1, '#Region RADIO1') GUICtrlSetState($idRadio1, $GUI_CHECKED) Local $idRadio2 = GUICtrlCreateRadio("Radio Two", 250, 165, 80) GUICtrlSetTip($idRadio2, '#Region RADIO2') GUICtrlCreateGroup("", -99, -99, 1, 1) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idGroup), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idRadio1), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idRadio2), "wstr", 0, "wstr", 0) #EndRegion GROUP WITH RADIO BUTTONS #Region UPDOWN GUICtrlCreateLabel("UpDown", 350, 115) GUICtrlSetColor(-1, $COLOR_TEXT_LIGHT) Local $idInput = GUICtrlCreateInput("42", 350, 130, 40, 20) _AddControlForSubclass($idInput) Local $idUpDown = GUICtrlCreateUpdown(-1) _AddControlForSubclass($idUpDown) #EndRegion UPDOWN #Region LABEL $g_idLabelGreen = GUICtrlCreateLabel("Green" & @CRLF & "Label", 350, 165, 40, 40) $g_hLabelGreen = GUICtrlGetHandle($g_idLabelGreen) GUICtrlSetTip($g_idLabelGreen, '#Region LABEL') $g_hBrushGreen = _WinAPI_CreateSolidBrush(_ColorToCOLORREF(0x00FF00)) ; green background #Region SLIDER GUICtrlCreateLabel("Slider:", 235, 215) Local $idSlider = GUICtrlCreateSlider(270, 210, 120, 30) _AddControlForSubclass($idSlider) GUICtrlSetTip(-1, '#Region SLIDER') GUICtrlSetData(-1, 30) #EndRegion SLIDER #Region INPUT Local $idInput2 = GUICtrlCreateInput("Sample Input Box", 235, 255, 130, 20) _AddControlForSubclass($idInput2) GUICtrlSetTip(-1, '#Region INPUT') #EndRegion INPUT #Region DATE $g_idDate = GUICtrlCreateDate("", 5, 280, 200, 20) $g_hDate = GUICtrlGetHandle($g_idDate) _AddControlForSubclass($g_idDate) GUICtrlSetTip(-1, '#Region DATE') GUICtrlCreateLabel("(Date control expands into a calendar)", 10, 305, 200, 20) #EndRegion DATE #Region BUTTON Local $idButton = GUICtrlCreateButton("Sample Button", 10, 330, 100, 30) _AddControlForSubclass($idButton) GUICtrlSetTip(-1, '#Region BUTTON') #EndRegion BUTTON #Region CHECKBOX Local $idCheckBox = GUICtrlCreateCheckbox("Checkbox", 130, 335, 80, 20) GUICtrlSetTip(-1, '#Region CHECKBOX') DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idCheckBox), "wstr", 0, "wstr", 0) #EndRegion CHECKBOX #Region TREEVIEW ONE Local $idTreeView1 = GUICtrlCreateTreeView(210, 290, 80, 80) _AddControlForSubclass($idTreeView1) GUICtrlSetBkColor($idTreeView1, $COLOR_EDIT_BG) GUICtrlSetColor($idTreeView1, $COLOR_TEXT_LIGHT) GUICtrlSetTip(-1, '#Region TREEVIEW ONE') Local $idTreeViewItem = GUICtrlCreateTreeViewItem("TreeView", $idTreeView1) GUICtrlCreateTreeViewItem("Item1", $idTreeViewItem) GUICtrlCreateTreeViewItem("Item2", $idTreeViewItem) GUICtrlCreateTreeViewItem("Foo", -1) GUICtrlSetState($idTreeViewItem, $GUI_EXPAND) #EndRegion TREEVIEW ONE #Region TREEVIEW TWO Local $idTreeView2 = GUICtrlCreateTreeView(295, 290, 103, 80, $TVS_CHECKBOXES) _AddControlForSubclass($idTreeView2) GUICtrlSetBkColor($idTreeView2, $COLOR_EDIT_BG) GUICtrlSetColor($idTreeView2, $COLOR_TEXT_LIGHT) GUICtrlSetTip(-1, '#Region TREEVIEW TWO') GUICtrlCreateTreeViewItem("TreeView", $idTreeView2) GUICtrlCreateTreeViewItem("With", $idTreeView2) GUICtrlCreateTreeViewItem("$TVS_CHECKBOXES", $idTreeView2) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateTreeViewItem("Style", $idTreeView2) #EndRegion TREEVIEW TWO ; Apply Dark Mode _ApplyDarkModeToAllControls() ; Handle scrollbars for windows that have them _EnableDarkScrollBars() ; Register a custom window procedure for the tab control for owner-drawing $g_hTab_CB = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam') $g_pTab_CB = DllCallbackGetPtr($g_hTab_CB) $g_hProc = _WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_pTab_CB) GUISetState(@SW_SHOW) _OverpaintWhiteLine() _WinAPI_RedrawWindow($g_hGUI, 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _CleanupSubclassing() _CleanupBrushes() ExitLoop EndSwitch WEnd ; Restore the original window procedure for the tab control _WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_hProc) DllCallbackFree($g_hTab_CB) GUIDelete() EndFunc ;==>_Example Func _OverpaintWhiteLine() Local $hDC = _WinAPI_GetWindowDC($g_hGUI) If Not $hDC Then Return Local $tWndRect = _WinAPI_GetWindowRect($g_hGUI) Local $iWndWidth = $tWndRect.right - $tWndRect.left ; 1. Caption height Local $iCaptionHeight = _WinAPI_GetSystemMetrics($SM_CYCAPTION) ; 2. Border height (top) Local $iBorderHeight = _WinAPI_GetSystemMetrics($SM_CYSIZEFRAME) If $iBorderHeight = 0 Then $iBorderHeight = _WinAPI_GetSystemMetrics($SM_CYFIXEDFRAME) ; 3. Determine menu height dynamically Local $iMenuHeight = _WinAPI_GetSystemMetrics($SM_CYMENU) ; standard menu height ; Alternative: get menu height via GetMenuBarInfo Local $tMenuBarInfo = DllStructCreate("dword cbSize;long left;long top;long right;long bottom;handle hwndMenu;handle hwndItem;bool fBarFocused;bool fFocused") DllStructSetData($tMenuBarInfo, "cbSize", DllStructGetSize($tMenuBarInfo)) Local $aResult = DllCall("user32.dll", "bool", "GetMenuBarInfo", "hwnd", $g_hGUI, "long", 0xFFFFFFFD, "long", 0, "ptr", DllStructGetPtr($tMenuBarInfo)) If IsArray($aResult) And $aResult[0] Then ; Calculate the actual menu height from the coordinates Local $iMenuTop = $tMenuBarInfo.top Local $iMenuBottom = $tMenuBarInfo.bottom ; Convert to window coordinates $iMenuHeight = ($iMenuBottom - $iMenuTop) EndIf ; The white line is directly below the menu Local $iWhiteLineY = $iCaptionHeight + $iBorderHeight + $iMenuHeight - _WinAPI_GetSystemMetrics($SM_CYFIXEDFRAME) * 2 ;~ ConsoleWrite("Caption: " & $iCaptionHeight & ", Border: " & $iBorderHeight & ", Menu: " & $iMenuHeight & " -> White Line at Y=" & $iWhiteLineY & @CRLF) ; Overpaint the white line (1x2 pixels) Local $tRect = DllStructCreate($tagRECT) With $tRect .left = 0 .top = $iWhiteLineY .right = $iWndWidth .bottom = $iWhiteLineY + 2 ; 2 pixels high EndWith Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) ;~ Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF(0xFF0000)) _WinAPI_FillRect($hDC, $tRect, $hBrush) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($g_hGUI, $hDC) EndFunc ;==>_OverpaintWhiteLine Func _WM_ACTIVATE_OverpaintLine($hWnd, $iMsg, $wParam, $lParam) If $hWnd <> $g_hGUI Then Return $GUI_RUNDEFMSG _OverpaintWhiteLine() Return $GUI_RUNDEFMSG EndFunc ;==>_WM_ACTIVATE_OverpaintLine Func _WM_WINDOWPOSCHANGED_OverpaintLine($hWnd, $iMsg, $wParam, $lParam) If $hWnd <> $g_hGUI Then Return $GUI_RUNDEFMSG _OverpaintWhiteLine() Return $GUI_RUNDEFMSG EndFunc ;==>_WM_WINDOWPOSCHANGED_OverpaintLine Func _OnInitMenuPopup($hWnd, $iMsg, $wParam, $lParam) ; wParam = HMENU of the popup, lParam = position/index - not needed here ; A small delay sometimes helps to ensure the popup window exists Sleep(100) ; The foreground window is most likely the new menu popup Local $hPopup = _WinAPI_GetForegroundWindow() If Not $hPopup Then Return $GUI_RUNDEFMSG Local $sCls = StringLower(_WinAPI_GetClassName($hPopup)) If $sCls <> "#32768" And $sCls <> "popupmenu" Then ; if no menu popup is detected -> do nothing Return $GUI_RUNDEFMSG EndIf ; Set Theme + AllowDarkMode on the popup itself _WinAPI_SetWindowTheme($hPopup, "DarkMode_Explorer", "") _WinAPI_AllowDarkModeForWindow($hPopup, True) ; Also apply the theme to all child windows of the popup (e.g., scrollbars) Local $hChild = _WinAPI_GetWindow($hPopup, $GW_CHILD) While $hChild Local $sChildCls = StringLower(_WinAPI_GetClassName($hChild)) ; apply theme specifically for scrollbars, UpDown, etc. If $sChildCls = "scrollbar" Or $sChildCls = "msctls_updown32" Or $sChildCls = "traynotifywnd" Then _WinAPI_SetWindowTheme($hChild, "DarkMode_Explorer", "") _WinAPI_AllowDarkModeForWindow($hChild, True) Else ; try generically _WinAPI_SetWindowTheme($hChild, "DarkMode_Explorer", "") _WinAPI_AllowDarkModeForWindow($hChild, True) EndIf $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd ; Force refresh so the change is visible immediately _WinAPI_FlushMenuThemes() _WinAPI_RefreshImmersiveColorPolicyState() _WinAPI_RedrawWindow($hPopup, 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW)) Return $GUI_RUNDEFMSG EndFunc ;==>_OnInitMenuPopup Func _ColorToCOLORREF($iColor) ;RGB to BGR Local $iR = BitAND(BitShift($iColor, 16), 0xFF) Local $iG = BitAND(BitShift($iColor, 8), 0xFF) Local $iB = BitAND($iColor, 0xFF) Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR) EndFunc ;==>_ColorToCOLORREF Func _AddControlForSubclass($iCtrlID) Local $hCtrl = GUICtrlGetHandle($iCtrlID) If $hCtrl Then $g_aControls[$g_iControlCount][0] = $iCtrlID $g_aControls[$g_iControlCount][1] = $hCtrl $g_aControls[$g_iControlCount][2] = 0 ; Placeholder for OldWndProc $g_iControlCount += 1 EndIf EndFunc ;==>_AddControlForSubclass Func _ApplyDarkModeToAllControls() ; DWM Dark Mode for the main window _WinAPI_SetPreferredAppMode($APPMODE_FORCEDARK) ; Create subclass callback If Not $g_pSubclassProc Then $g_pSubclassProc = DllCallbackRegister("_SubclassProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") EndIf ; Subclass all controls For $i = 0 To $g_iControlCount - 1 Local $hCtrl = $g_aControls[$i][1] If $hCtrl Then Local $sClass = _WinAPI_GetClassName($hCtrl) ; Use SetWindowSubclass _WinAPI_SetWindowSubclass($hCtrl, DllCallbackGetPtr($g_pSubclassProc), $i, 0) ; Special themes for different control types Switch StringLower($sClass) Case "edit", "richedit", "richedit20a", "richedit20w" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_CFD", 0) Case "button" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) Case "combobox" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_CFD", 0) ; Handle ComboBox child-edit Local $hEdit = _WinAPI_FindWindowEx($hCtrl, 0, "Edit", "") If $hEdit Then _WinAPI_SetWindowTheme($hEdit, "DarkMode_CFD", 0) _WinAPI_AllowDarkModeForWindow($hEdit, True) EndIf ; ComboBox dropdown list Local $hComboLBox = _WinAPI_FindWindowEx($hCtrl, 0, "ComboLBox", "") If $hComboLBox Then _WinAPI_SetWindowTheme($hComboLBox, "DarkMode_Explorer", 0) _WinAPI_AllowDarkModeForWindow($hComboLBox, True) EndIf Case "syslistview32" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) ; ListView extended styles for better dark mode _SendMessage($hCtrl, $LVS_EX_DOUBLEBUFFER, 0x00010000, 0x00010000) ; Also make the ListView header dark Local $hHeader = _SendMessage($hCtrl, $LVM_GETHEADER, 0, 0) If $hHeader Then _WinAPI_SetWindowTheme($hHeader, "DarkMode_ItemsView", 0) EndIf Case "systreeview32" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) Case "msctls_trackbar32" ; Slider _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) Case "systabcontrol32" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", "") ;must be "" ; tab-Control background _SendMessage($hCtrl, 0x132D, 0, $COLOR_BG_DARK) ; TCM_SETBKCOLOR ; Try to make the UpDown (spinner for too many tabs) dark as well Local $hUpDown = _WinAPI_FindWindowEx($hCtrl, 0, "msctls_updown32", "") If $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, "DarkMode_Explorer", 0) Case "listbox" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) Case "msctls_progress32" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) Case "scrollbar" _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) Case Else _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) EndSwitch _WinAPI_AllowDarkModeForWindow($hCtrl, True) EndIf Next ; Update theme system _WinAPI_RefreshImmersiveColorPolicyState() _WinAPI_FlushMenuThemes() _WinAPI_DwmSetWindowAttribute($g_hGUI, $DWMWA_USE_IMMERSIVE_DARK_MODE, True) ; Redraw GUI _WinAPI_RedrawWindow($g_hGUI, 0, 0, $RDW_UPDATENOW) EndFunc ;==>_ApplyDarkModeToAllControls Func _CleanupSubclassing() ; Remove all subclasses If $g_pSubclassProc Then For $i = 0 To $g_iControlCount - 1 Local $hCtrl = $g_aControls[$i][1] If $hCtrl Then _WinAPI_RemoveWindowSubclass($hCtrl, DllCallbackGetPtr($g_pSubclassProc), $i) EndIf Next DllCallbackFree($g_pSubclassProc) $g_pSubclassProc = 0 EndIf EndFunc ;==>_CleanupSubclassing Func _SubclassProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData) Switch $iMsg Case $WM_NOTIFY Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hFrom = $tNMHDR.hWndFrom Local $iCode = $tNMHDR.Code ; --- Adjust ListView Header text color --- If $iCode = $NM_CUSTOMDRAW Then Local $tNMCUSTOMDRAW = DllStructCreate($tagNMCUSTOMDRAW, $lParam) Local $dwDrawStage = $tNMCUSTOMDRAW.dwDrawStage Local $hDC = $tNMCUSTOMDRAW.hdc Switch $dwDrawStage Case $CDDS_PREPAINT Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT _WinAPI_SetTextColor($hDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) ; White text _WinAPI_SetBkColor($hDC, _ColorToCOLORREF($COLOR_BG_DARK)) ; Dark background Return BitOR($CDRF_NEWFONT, $CDRF_NOTIFYPOSTPAINT) EndSwitch EndIf Case $WM_PAINT ; Custom Paint for better Dark Mode rendering Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndSwitch ; Forward standard message to DefSubclassProc Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_SubclassProc Func _MakeMenuOwnerDraw($hWnd) ; Get menu handle $g_hMenu = _GUICtrlMenu_GetMenu($hWnd) If Not $g_hMenu Then Return False Local $iCount = _GUICtrlMenu_GetItemCount($g_hMenu) If $iCount <= 0 Then Return False ReDim $g_aMenuText[$iCount] For $i = 0 To $iCount - 1 ; retrieve text via GetMenuStringW (works better than _GUICtrlMenu_GetItemText) Local $tText = DllStructCreate("wchar s[256]") Local $iLen = DllCall("user32.dll", "int", "GetMenuStringW", _ "handle", $g_hMenu, _ "uint", $i, _ "struct*", $tText, _ "int", 255, _ "uint", 0x0400) ; MF_BYPOSITION If IsArray($iLen) And $iLen[0] > 0 Then $g_aMenuText[$i] = $tText.s Else $g_aMenuText[$i] = "" EndIf ; set top-level item to owner-draw _GUICtrlMenu_SetItemType($g_hMenu, $i, $MFT_OWNERDRAW, True) Next ; redraw menu bar immediately _GUICtrlMenu_DrawMenuBar($hWnd) _WinAPI_RedrawWindow($hWnd, 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW)) Return True EndFunc ;==>_MakeMenuOwnerDraw Func WM_MEASUREITEM_Handler($hWnd, $iMsg, $wParam, $lParam) Local $tagMEASUREITEM = "uint CtlType;uint CtlID;uint itemID;uint itemWidth;uint itemHeight;ulong_ptr itemData" Local $t = DllStructCreate($tagMEASUREITEM, $lParam) If Not IsDllStruct($t) Then Return $GUI_RUNDEFMSG If $t.CtlType <> $ODT_MENU Then Return $GUI_RUNDEFMSG Local $itemID = $t.itemID ; itemID is the control ID, not the position! ; We must derive the position from the itemID Local $iPos = -1 For $i = 0 To UBound($g_aMenuText) - 1 If $itemID = ($i + 3) Then ; Offset of 3 due to internal IDs $iPos = $i ExitLoop EndIf Next ; Fallback: try the itemID directly If $iPos < 0 Then $iPos = $itemID If $iPos < 0 Or $iPos >= UBound($g_aMenuText) Then $iPos = 0 Local $sText = $g_aMenuText[$iPos] ; Calculate text dimensions Local $hDC = _WinAPI_GetDC($hWnd) Local $hFont = _SendMessage($hWnd, $WM_GETFONT, 0, 0) If Not $hFont Then $hFont = _WinAPI_GetStockObject($DEFAULT_GUI_FONT) Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont) Local $tSize = _WinAPI_GetTextExtentPoint32($hDC, $sText) Local $iTextWidth = $tSize.X Local $iTextHeight = $tSize.Y _WinAPI_SelectObject($hDC, $hOldFont) _WinAPI_ReleaseDC($hWnd, $hDC) ; Set dimensions with padding $t.itemWidth = $iTextWidth + 1 $t.itemHeight = $iTextHeight + 1 Return 1 EndFunc ;==>WM_MEASUREITEM_Handler Func WM_DRAWITEM_Handler($hWnd, $iMsg, $wParam, $lParam) Local $tagDRAWITEM = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;ptr hwndItem;handle hDC;" & _ "long left;long top;long right;long bottom;ulong_ptr itemData" Local $t = DllStructCreate($tagDRAWITEM, $lParam) If Not IsDllStruct($t) Then Return $GUI_RUNDEFMSG If $t.CtlType <> $ODT_MENU Then Return $GUI_RUNDEFMSG Local $hDC = $t.hDC Local $left = $t.left Local $top = $t.top Local $right = $t.right Local $bottom = $t.bottom Local $state = $t.itemState Local $itemID = $t.itemID ; convert itemID to position Local $iPos = -1 For $i = 0 To UBound($g_aMenuText) - 1 If $itemID = ($i + 3) Then $iPos = $i ExitLoop EndIf Next If $iPos < 0 Then $iPos = $itemID If $iPos < 0 Or $iPos >= UBound($g_aMenuText) Then $iPos = 0 Local $sText = $g_aMenuText[$iPos] $sText = StringReplace($sText, "&", "") ; Colors Local $clrBG = _ColorToCOLORREF($COLOR_BG_DARK) Local $clrSel = _ColorToCOLORREF(0x505050) Local $clrText = _ColorToCOLORREF($COLOR_TEXT_LIGHT) Static $iDrawCount = 0 Static $bFullBarDrawn = False ; Count how many items were drawn in this "draw cycle" $iDrawCount += 1 ; If we are at the first item AND the bar has not yet been drawn If $iPos = 0 And Not $bFullBarDrawn Then ; Get the full window width Local $tClient = _WinAPI_GetClientRect($hWnd) Local $iFullWidth = DllStructGetData($tClient, "right") ; Fill the entire menu bar Local $tFullMenuBar = DllStructCreate($tagRECT) With $tFullMenuBar .left = 0 .top = $top .right = $iFullWidth + 3 .bottom = $bottom EndWith Local $hFullBrush = _WinAPI_CreateSolidBrush($clrBG) _WinAPI_FillRect($hDC, $tFullMenuBar, $hFullBrush) _WinAPI_DeleteObject($hFullBrush) EndIf ; After drawing all items, mark as "drawn" If $iDrawCount >= UBound($g_aMenuText) Then $bFullBarDrawn = True $iDrawCount = 0 EndIf ; Draw background for the area AFTER the last menu item If $iPos = (UBound($g_aMenuText) - 1) Then ; Last menu Local $tClient = _WinAPI_GetClientRect($hWnd) Local $iFullWidth = DllStructGetData($tClient, "right") ; Fill only the area to the RIGHT of the last menu item If $right < $iFullWidth Then Local $tEmptyArea = DllStructCreate($tagRECT) With $tEmptyArea .left = $right .top = $top .right = $iFullWidth + _WinAPI_GetSystemMetrics(7) .bottom = $bottom EndWith Local $hEmptyBrush = _WinAPI_CreateSolidBrush($clrBG) _WinAPI_FillRect($hDC, $tEmptyArea, $hEmptyBrush) _WinAPI_DeleteObject($hEmptyBrush) EndIf EndIf ; Draw item background (selected = lighter) Local $bSelected = BitAND($state, $ODS_SELECTED) Local $hBrush = _WinAPI_CreateSolidBrush($bSelected ? $clrSel : $clrBG) Local $tItemRect = DllStructCreate($tagRECT) With $tItemRect .left = $left .top = $top .right = $right .bottom = $bottom EndWith _WinAPI_FillRect($hDC, $tItemRect, $hBrush) _WinAPI_DeleteObject($hBrush) ; Setup font Local $hFont = _SendMessage($hWnd, $WM_GETFONT, 0, 0) If Not $hFont Then $hFont = _WinAPI_GetStockObject($DEFAULT_GUI_FONT) Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont) _WinAPI_SetBkMode($hDC, $TRANSPARENT) _WinAPI_SetTextColor($hDC, $clrText) ; Draw text Local $tTextRect = DllStructCreate($tagRECT) With $tTextRect .left = $left + 10 .top = $top + 4 .right = $right - 10 .bottom = $bottom - 4 EndWith DllCall("user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $sText, "int", -1, "ptr", DllStructGetPtr($tTextRect), "uint", BitOR($DT_SINGLELINE, $DT_VCENTER, $DT_LEFT)) If $hOldFont Then _WinAPI_SelectObject($hDC, $hOldFont) Return 1 EndFunc ;==>WM_DRAWITEM_Handler Func _WM_CTLCOLOR($hWnd, $iMsg, $wParam, $lParam) Local $hDC = $wParam Local $hCtrl = $lParam ; If the control is the special green label -> return green background If $hCtrl = $g_hLabelGreen Then ; black text on a green background _WinAPI_SetTextColor($hDC, _ColorToCOLORREF(0x000000)) _WinAPI_SetBkColor($hDC, _ColorToCOLORREF(0x00FF00)) _WinAPI_SetBkMode($hDC, $OPAQUE) ; important, otherwise it remains transparent and you cannot see the background If $g_hBrushGreen Then Return $g_hBrushGreen EndIf ; --- Special case: Make "Sample Pic" label transparent --- If $hCtrl = $g_hLabelPic Then ; set transparent background _WinAPI_SetBkMode($hDC, $TRANSPARENT) ; set text color (if necessary) - e.g., white _WinAPI_SetTextColor($hDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) ; return NULL_BRUSH (stock object), so Windows does NOT fill with your dark brush Local $hNull = _WinAPI_GetStockObject(5) ; 5 = NULL_BRUSH If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG EndIf ; --- Default behavior for all other statics / controls --- _WinAPI_SetTextColor($hDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) Local $hBrush = $g_hBrushEdit Local $iColor = $COLOR_EDIT_BG Switch $iMsg Case $WM_CTLCOLORBTN $hBrush = $g_hBrushButton $iColor = $COLOR_BUTTON_BG Case $WM_CTLCOLORSTATIC $hBrush = $g_hBrushBg $iColor = $COLOR_BG_DARK EndSwitch _WinAPI_SetBkColor($hDC, _ColorToCOLORREF($iColor)) _WinAPI_SetBkMode($hDC, $TRANSPARENT) Return $hBrush EndFunc ;==>_WM_CTLCOLOR Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2, $iCtrl $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd($tNMHDR.hWndFrom) $iIDFrom = $tNMHDR.IDFrom $iCode = $tNMHDR.Code Switch $hWndFrom Case $g_hDate ;thanks to argumentum for the code :-) Switch $iCode Case $NM_SETFOCUS ; Disable the visual theme when the DateTime control receives focus _WinAPI_SetThemeAppProperties(0) Case $DTN_DROPDOWN ; Apply dark colors when the calendar dropdown appears _WinAPI_SetWindowTheme($iCtrl, "", "") Local $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT, $COLOR_TEXT_LIGHT) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK, $COLOR_BG_DARK) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT, $COLOR_TEXT_LIGHT) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK, $COLOR_BG_DARK) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, $COLOR_TEXT_LIGHT) Case $DTN_CLOSEUP ; Calendar will closed EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _CleanupBrushes() ; Delete all brushes If $g_hBrushEdit Then _WinAPI_DeleteObject($g_hBrushEdit) If $g_hBrushButton Then _WinAPI_DeleteObject($g_hBrushButton) If $g_hBrushBg Then _WinAPI_DeleteObject($g_hBrushBg) If $g_hBrushGreen Then _WinAPI_DeleteObject($g_hBrushGreen) EndFunc ;==>_CleanupBrushes Func _EnableDarkScrollBars() ; Try to enable Dark Mode for all scrollbars (also for TreeView with checkboxes) For $i = 0 To $g_iControlCount - 1 Local $hCtrl = $g_aControls[$i][1] If Not $hCtrl Then ContinueLoop ; 1️ Normal attempt (works for most controls) Local $tScrollInfo = _GUIScrollBars_GetScrollInfoEx($hCtrl, 1) If IsDllStruct($tScrollInfo) Then _WinAPI_SetWindowTheme($hCtrl, "DarkMode_Explorer", 0) EndIf ; 2️ Extension: If the control has its own scrollbar child windows (e.g., TreeView with $TVS_CHECKBOXES) Local $hChild = _WinAPI_GetWindow($hCtrl, $GW_CHILD) While $hChild Local $sClass = _WinAPI_GetClassName($hChild) If StringCompare($sClass, "ScrollBar") = 0 Then ; Set DarkMode on the ScrollBar itself _WinAPI_SetWindowTheme($hChild, "DarkMode_Explorer", 0) _WinAPI_AllowDarkModeForWindow($hChild, True) EndIf $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd Next EndFunc ;==>_EnableDarkScrollBars Func _WinProc($hWnd, $iMsg, $wParam, $lParam) ; Custom window procedure for tab control with Dark Mode Switch $iMsg Case $WM_ERASEBKGND Return 1 ; Prevent background erase to avoid flicker Case $WM_PAINT Local $tPaint = DllStructCreate($tagPAINTSTRUCT) Local $hDC = DllCall("user32.dll", "handle", "BeginPaint", "hwnd", $hWnd, "struct*", $tPaint) If @error Or Not $hDC[0] Then Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) $hDC = $hDC[0] ; Get client rectangle Local $tClient = _WinAPI_GetClientRect($hWnd) If Not IsDllStruct($tClient) Then _WinAPI_EndPaint($hWnd, $tPaint) Return 0 EndIf Local $iWidth = $tClient.Right Local $iHeight = $tClient.Bottom ; Create memory DC for double buffering Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap) ; Fill background Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) _WinAPI_FillRect($hMemDC, $tClient, $hBrush) _WinAPI_DeleteObject($hBrush) ; Get tab info Local $iTabCount = _SendMessage($hWnd, 0x1304, 0, 0) ; TCM_GETITEMCOUNT Local $iCurSel = _SendMessage($hWnd, 0x130B, 0, 0) ; TCM_GETCURSEL ; Setup font Local $hFont = _SendMessage($hWnd, $WM_GETFONT, 0, 0) If Not $hFont Then $hFont = _WinAPI_GetStockObject($DEFAULT_GUI_FONT) Local $hOldFont = _WinAPI_SelectObject($hMemDC, $hFont) _WinAPI_SetBkMode($hMemDC, $TRANSPARENT) _WinAPI_SetTextColor($hMemDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) ; Draw each tab Local $tRect, $tRect, $iLeft, $iTop, $iRight, $iBottom For $i = 0 To $iTabCount - 1 ; Get tab rectangle using TCM_GETITEMRECT $tRect = DllStructCreate($tagRECT) $aResult = DllCall("user32.dll", "lresult", "SendMessageW", _ "hwnd", $hWnd, _ "uint", 0x130A, _ ; TCM_GETITEMRECT "wparam", $i, _ "struct*", $tRect) If @error Or Not $aResult[0] Then ContinueLoop $iLeft = $tRect.Left $iTop = $tRect.Top $iRight = $tRect.Right $iBottom = $tRect.Bottom ; Skip if rectangle is invalid If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop ; Get tab text Local $tItem = DllStructCreate("uint Mask;dword dwState;dword dwStateMask;ptr pszText;int cchTextMax;int iImage;lparam lParam") Local $tText = DllStructCreate("wchar Text[256]") With $tItem .Mask = 0x0001 ; TCIF_TEXT .pszText = DllStructGetPtr($tText) .cchTextMax = 256 EndWith DllCall("user32.dll", "lresult", "SendMessageW", _ "hwnd", $hWnd, _ "uint", 0x133C, _ ; TCM_GETITEMW "wparam", $i, _ "struct*", $tItem) Local $sText = DllStructGetData($tText, "Text") ; Draw tab background Local $bSelected = ($i = $iCurSel) Local $iTabColor = $bSelected ? $COLOR_BUTTON_BG : $COLOR_BG_DARK Local $hTabBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($iTabColor)) Local $tTabRect = DllStructCreate($tagRECT) With $tTabRect .Left = $iLeft .Top = $iTop .Right = $iRight .Bottom = $iBottom EndWith _WinAPI_FillRect($hMemDC, $tTabRect, $hTabBrush) _WinAPI_DeleteObject($hTabBrush) ;~ Local $hTabPen = _WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_BORDER)) ;~ Local $hOldTabPen = _WinAPI_SelectObject($hMemDC, $hTabPen) ;~ _WinAPI_MoveTo($hMemDC, $iLeft, $iBottom) ;~ _WinAPI_LineTo($hMemDC, $iRight, $iBottom) ;~ _WinAPI_SelectObject($hMemDC, $hOldTabPen) ;~ _WinAPI_DeleteObject($hTabPen) ; Draw selection indicator (top border for selected tab) If $bSelected Then Local $hPen = _WinAPI_CreatePen(0, 2, _ColorToCOLORREF(0x0078D4)) ; Blue accent Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen) _WinAPI_MoveTo($hMemDC, $iLeft, $iTop) _WinAPI_LineTo($hMemDC, $iRight - 2, $iTop) _WinAPI_SelectObject($hMemDC, $hOldPen) _WinAPI_DeleteObject($hPen) EndIf ; Draw separator between tabs If $i < $iTabCount - 1 Then Local $hPenSep = _WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_BORDER)) Local $hOldPenSep = _WinAPI_SelectObject($hMemDC, $hPenSep) _WinAPI_MoveTo($hMemDC, $iRight - 1, $iTop + 4) _WinAPI_LineTo($hMemDC, $iRight - 1, $iBottom - 4) _WinAPI_SelectObject($hMemDC, $hOldPenSep) _WinAPI_DeleteObject($hPenSep) EndIf ; Draw text centered in tab Local $tTextRect = DllStructCreate($tagRECT) With $tTextRect .Left = $iLeft + 6 .Top = $iTop + 3 .Right = $iRight - 6 .Bottom = $iBottom - 3 EndWith DllCall("user32.dll", "int", "DrawTextW", _ "handle", $hMemDC, _ "wstr", $sText, _ "int", -1, _ "struct*", $tTextRect, _ "uint", BitOR($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE)) Next ; Draw border around entire control Local $hBorderPen = _WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_BORDER)) Local $hOldBorderPen = _WinAPI_SelectObject($hMemDC, $hBorderPen) Local $hNullBrush = _WinAPI_GetStockObject(5) ; NULL_BRUSH Local $hOldBorderBrush = _WinAPI_SelectObject($hMemDC, $hNullBrush) DllCall("gdi32.dll", "bool", "Rectangle", _ "handle", $hMemDC, _ "int", 0, _ "int", 0, _ "int", $iWidth, _ "int", $iHeight) _WinAPI_SelectObject($hMemDC, $hOldBorderPen) _WinAPI_SelectObject($hMemDC, $hOldBorderBrush) _WinAPI_DeleteObject($hBorderPen) ; Copy to screen _WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hMemDC, 0, 0, $SRCCOPY) ; Cleanup _WinAPI_SelectObject($hMemDC, $hOldFont) _WinAPI_SelectObject($hMemDC, $hOldBmp) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_EndPaint($hWnd, $tPaint) Return 0 EndSwitch Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func _WinAPI_FindWindowEx($hParent, $hAfter, $sClass, $sTitle = "") Local $ret = DllCall("user32.dll", "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle) If @error Or Not IsArray($ret) Then Return 0 Return $ret[0] EndFunc ;==>_WinAPI_FindWindowEx #Region DarkMode API Func _WinAPI_ShouldAppsUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 132) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldAppsUseDarkMode Func _WinAPI_AllowDarkModeForWindow($hWND, $bAllow = True) Local $aResult = DllCall("UxTheme.dll", "bool", 133, "hwnd", $hWND, "bool", $bAllow) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_AllowDarkModeForWindow Func _WinAPI_FlushMenuThemes() Local $aResult = DllCall("UxTheme.dll", "none", 136) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_FlushMenuThemes Func _WinAPI_RefreshImmersiveColorPolicyState() Local $aResult = DllCall("UxTheme.dll", "none", 104) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_RefreshImmersiveColorPolicyState Func _WinAPI_IsDarkModeAllowedForWindow($hWND) Local $aResult = DllCall("UxTheme.dll", "bool", 137, "hwnd", $hWND) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForWindow Func _WinAPI_GetIsImmersiveColorUsingHighContrast($iIMMERSIVE_HC_CACHE_MODE) Local $aResult = DllCall("UxTheme.dll", "bool", 106, "long", $iIMMERSIVE_HC_CACHE_MODE) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_GetIsImmersiveColorUsingHighContrast Func _WinAPI_OpenNcThemeData($hWND, $tClassList) Local $aResult = DllCall("UxTheme.dll", "hwnd", 49, "hwnd", $hWND, "struct*", $tClassList) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_OpenNcThemeData Func _WinAPI_ShouldSystemUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 138) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldSystemUseDarkMode Func _WinAPI_IsDarkModeAllowedForApp() Local $aResult = DllCall("UxTheme.dll", "bool", 139) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForApp Func _WinAPI_AllowDarkModeForApp($bAllow = True) ;Windows 10 Build 17763 Return _WinAPI_SetPreferredAppMode($bAllow ? 1 : 0) ; 1 = AllowDark, 0 = Default EndFunc ;==>_WinAPI_AllowDarkModeForApp Func _WinAPI_SetPreferredAppMode($iPreferredAppMode) ;Windows 10 Build 18362+ Local $aResult = DllCall("UxTheme.dll", "long", 135, "long", $iPreferredAppMode) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_SetPreferredAppMode #EndRegion DarkMode API Does anyone know how to switch the date picker to dark mode?
    2 points
  13. Finally! Latest version in the OP. Huge shoutout to Jos because I leaned very heavily on his AutoItGotoDefinition (you did write that I assume?).
    2 points
  14. Any of this code ( https://www.autoitscript.com/forum/topic/191058-datetime-pick-coloring ) useful ?
    2 points
  15. This works properly, yes. Thank you. It also worked once I applied DPI scaling of 125%. But once I tried 150% and higher the line did not line up anymore. But I understand that it is not supporting DPI yet. EDIT: By the way, I wanted to mention that not only is your coding incredible, but I really wanted to point out the fact that your code comments are also very easy to understand and therefore helpful for anyone reading your code. I appreciate the extra effort that you put into code comments.
    2 points
  16. You're supposed to be able to set #AutoIt3Wrapper_AU3Check_Parameters with the flags you want (which would be -w- 4 for turning off the local in global scope warning) but turns out there's a bug with reading them in for the diagnostics that I'm fixing right now. `
    2 points
  17. Hi everyone, that's exactly right ! I found the solution at work this morning! But I couldn't respond. Like you, I considered adding a variable : $iRet_Value, but I tried to overcomplicate things at the beginning and i lost time ! Case $g_idButton4 ConsoleWrite("GUI2: CANCEL=" & $g_idButton4 & @CRLF) $iRet_Value ="KO" ExitLoop and i put : if $iRet_Value ="KO" then return instead : if gui2()... I didn't know this way : Func Traitement_intermediaire()     ; display the listview     If gui2() Then Return     MsgBox(0, "Suite", "cela continue")  ;suite du script     ;.... EndFunc   ;==>Traitement_intermediair Thank you for your help 🙂
    2 points
  18. Sure it's enough and better, no need of the optional parameter when calling gui2() Well done !
    2 points
  19. wakillon

    enumicons.au3

    Last week I came across enumicons.au3 in the folder C:\Program Files (x86)\AutoIt3\Examples\GUI\Advanced and while testing it, I thought that a small update wouldn't hurt enumicons.au3
    2 points
  20. @pixelsearch thanks for the clarification, because I didn't think about/understand this case question, isn't that enough? Local $aMsg = 0, $iReturn = 0 While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] ; Switch from GUIs Case $g_hGUI2 Switch $aMsg[0] ; Switch from event ID Case $GUI_EVENT_CLOSE, $g_idButton4 ConsoleWrite("GUI2: $GUI_EVENT_CLOSE=" & $GUI_EVENT_CLOSE & @CRLF) If $aMsg[0] = $g_idButton4 Then ConsoleWrite(" with Cancel" & @CRLF) $iReturn = 1 EndIf ExitLoop Case $g_idButton3 ConsoleWrite("GUI2: $g_idButton3=" & $g_idButton3 & @CRLF) MessageBox(2) EndSwitch EndSwitch WEnd GUIDelete($g_hGUI2) GUICtrlSetState($g_idButton2, $GUI_ENABLE) Opt("GUIOnEventMode", 1) ; when out of $g_hGUI2 - enable <<<<<<<<<<<<<<< Return $iReturn EndFunc ;==>gui2 ... Func Traitement_intermediaire() ; display the listview If gui2() Then Return MsgBox(0, "Suite", "cela continue") ;suite du script ;.... EndFunc ;==>Traitement_intermediaire
    2 points
  21. @ioa747 hello Maybe ermar asks for this : when he clicks on button "Traitement" in GUI1, then the function Traitement_intermediaire() is called, which calls gui2() and creates the listview. Now he starts to modify the listview, but suddenly he would like to cancel everything. Unfortunately, when he clicks the button "Cancel" in GUI2, the function Traitement_intermediaire() continues with this line in Traitement_intermediaire() MsgBox(0, "Suite", "cela continue") ;suite du script So we should indicate a way so the Cancel button in GUI2 reacts differently, depending on the part of the script which called gui2() 1) If gui2() was called from the function On_Button() => Case $g_idButton2 => gui2() , then no change is required 2) If gui2() was called from the function Traitement_intermediaire() => gui2() , then some code is required in case the user clicks on button Cancel in GUI2 . The change could be like this : Func Traitement_intermediaire() ; gui2() If gui2(1) Then Return MsgBox(0, "Suite", "cela continue") ;suite du script ;.... EndFunc ; Func gui2() Func gui2($iCancelStopsAll = 0) Local $iReturn = 0 ... Case $GUI_EVENT_CLOSE, $g_idButton4 If $iCancelStopsAll Then $iReturn = 1 ... Return $iReturn ; 0 or 1 EndFunc Note : if the GUI2 Close button [X] should react differently than the GUI2 Cancel button, then the Case should be splitted in 2 (one Case for $GUI_EVENT_CLOSE, another Case for $g_idButton4) Hope it makes sense... if this is what ermar asked for !
    2 points
  22. But see that would make too much sense!
    1 point
  23. Nine

    GIF Animation (cached)

    I had this GIF animation script, but it was kind of slow when multiple GIFs were displayed. And then Bilgus posted a framework of how to use GDI+ Cached Bitmaps. I transformed my script and was very happy of the result. Hope you like it too. I enclosed the GIF, the UDF and the example into the zip file. ps. Hope KaFu won't mind as I used his avatar in the example Version 2025-02-16 * Solved an occasional crash after control deletion. Version 2023-08-15 * Added support for SetOnEvent GUI, while deletion of controls happens frequently * Optimized some minor code parts * Solved a possible stack overflow issue Version 2022-12-06 * Added support to transparent GIF over window background. The type of GIF that necessitate erasure between frames. Version 2022-04-07 * Added double buffering for all GIF * Added ability to erase each frame before repainting, thru a new optional parameter. This is required when the frames do not cover the whole area, leaving a trace of the previous frame. * Added support for the usage of the Default keyword for optional parameters Version 2020-12-20 * Changed frame delays from 0 to a minimum delay to prevent CPU overload Version 2020-12-02 * Reuse empty slots left by the deletion of GIF controls * Corrected bugs Version 2020-12-01 * Added support to delete a GIF control Version 2020-11-29 * Corrected bug on unregister adlib function (thanks to PixelSearch) Included in the zip file 2 examples. One with multiple GIF. Second with transparent GIF over a window background. Cached GIF Animation.zip
    1 point
  24. but I couldn't put it in the Tab control But as a thought if you want, you could replace the Tabs with buttons, which would represent the "pages", and depending on which button you pressed, the objects that don't belong to the "page" would be hidden, and the ones that belong to the "page" would be displayed ... ;~ GUICtrlCreateTab(95, 5, $main_width - 105, $main_height - 35) ;~ GUICtrlCreateTabItem("Form 1") ;~ GUICtrlCreateTabItem("Form 2") GUISetState(@SW_SHOWNORMAL) Global Const $hChildWnd = GuiCreate("ChildWnd", 400, 200, 100, 10, BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $toolbar) GUISetState(@SW_SHOWNORMAL, $hChildWnd) ...
    1 point
  25. I just came across this UDF now. I am really impressed with how low the CPU usage is. My first thought was to combine this UDF with an example from Move window behind desktop icons thread which puts an image above the desktop wallpaper but below the desktop icons; within Progman under a WorkerW window. It actually works quite well and was easy to do. I stretched the background image to fit the current desktop resolution. However, I was also hoping to be able to stretch the animated Gif as well. I understand that your UDF comments clearly state "(must be the actual size of the GIF)" for the height and width. Would it be technically possible and would you be willing to add an option to resize the dimensions of the Gif similar to how your example script uses _GDIPlus_ImageResize() to resize the background image? Anyway, here is what I have working so far if you want to mess around with it: ;Code by UEZ build 2025-07-18 beta #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include <Array.au3> #include <GDIPlus.au3> #include "Cached GIF Animation.au3" OnAutoItExitRegister(_GIF_Animation_Quit) DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -4) Global $aPrimary = GetPrimaryMonitorCoords() If @error Then Exit MsgBox(16, "Error", "Unable to get primary monitor") Global $hProgman = WinGetHandle("[CLASS:Progman]"), $hWorkerW, $i If Not $hProgman Then Exit MsgBox(16, "ERROR", "Couldn't find Progman", 30) _WinAPI_SendMessageTimeout($hProgman, 0x052C, 13, 1, 250, $SMTO_NORMAL) #cs _GDIPlus_Startup() Local $sFile = "C:\Program Files (x86)\AutoIt3\Examples\GUI\logo4.gif" Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) ;create an image object based on a file #ce Global $hWorkerW = _WinAPI_FindWindowEx($hProgman, 0, "WorkerW", "") If $hWorkerW = 0 Then Exit MsgBox(16, "ERROR", "Couldn't find WorkerW under Progman", 30) Local $aOrigin = GetDesktopOrigin() Local $iX = $aPrimary[0] - $aOrigin[0] Local $iY = $aPrimary[1] - $aOrigin[1] Global $hGUI = GUICreate("GUI behind Desktop icons", $aPrimary[4], $aPrimary[5], $iX, $iY, $WS_POPUP, $WS_EX_TOOLWINDOW) ;GUISetBkColor(0xff00ff) ;GUICtrlCreatePic("D:\Tools\PublicDomainTray\Rectify11TrayTool\.bordercolor\Source\aero.jpg", 0, 0, $aPrimary[4], $aPrimary[5]) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local $hOrig = _GDIPlus_ImageLoadFromFile("bg.png") Local $hImage = _GDIPlus_ImageResize($hOrig, $aPrimary[4], $aPrimary[5]) _GDIPlus_ImageDispose($hOrig) _WinAPI_SetParent($hGUI, $hWorkerW) _WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) _WinAPI_SetWindowLong($hGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE), $WS_EX_LAYERED, $WS_EX_TRANSPARENT)) _WinAPI_SetLayeredWindowAttributes($hGUI, 0, 180, $LWA_ALPHA) GUISetState(@SW_SHOWNOACTIVATE, $hGUI) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $aPrimary[4], $aPrimary[5]) _GUICtrlCreateAnimGIF("Counter.gif", 0, 0, 285, 280, -1, -1, False, $hImage, True) #cs _GDIPlus_Startup() ;Global $sFile = "c:\windows\web\screen\img101.jpg" Global $sFile = "D:\Tools\PublicDomainTray\Rectify11TrayTool\.bordercolor\Source\aero.jpg" Global $hImage = _GDIPlus_ImageLoadFromFile($sFile) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) GUISetState(@SW_SHOWNOACTIVATE, $hGUI) Global $hEffect = _GDIPlus_EffectCreateBlur(10, True) _GDIPlus_BitmapApplyEffect($hImage, $hEffect) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $aPrimary[4], $aPrimary[5]) #ce #cs Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a Graphics object from a window handle _GDIPlus_GraphicsClear($hGraphics, 0xFF000000) ;clear graphic handle with dark grey (background) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing) Local $hTexture = _GDIPlus_TextureCreate2($hImage, 5, 4, 59, 59) ;create texture brush only from a defined rectangle _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, $aPrimary[4], $aPrimary[5], $hTexture) #ce While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd #cs ;cleanup resources _GDIPlus_BrushDispose($hTexture) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() #ce #cs _GDIPlus_EffectDispose($hEffect) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() #ce _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) GUIDelete($hGUI) Func _WinAPI_FindWindowEx($hParent, $hAfter, $sClass, $sTitle = "") Local $ret = DllCall("user32.dll", "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle) If @error Or Not IsArray($ret) Then Return 0 Return $ret[0] EndFunc ;==>_WinAPI_FindWindowEx Func GetPrimaryMonitorCoords() Local $tPoint = DllStructCreate("int x;int y") $tPoint.x = 0 $tPoint.y = 0 Local $hMonitor = _WinAPI_MonitorFromPoint($tPoint, $MONITOR_DEFAULTTOPRIMARY) If Not $hMonitor Then Return SetError(1, 0, 0) Local $tMI = DllStructCreate("dword cbSize;long rcMonitor[4];long rcWork[4];dword dwFlags") DllStructSetData($tMI, "cbSize", DllStructGetSize($tMI)) Local $aCall = DllCall("user32.dll", "bool", "GetMonitorInfoW", "handle", $hMonitor, "ptr", DllStructGetPtr($tMI)) If @error Or Not $aCall[0] Then Return SetError(2, 0, 0) Local $iLeft = $tMI.rcMonitor(1) Local $iTop = $tMI.rcMonitor(2) Local $iRight = $tMI.rcMonitor(3) Local $iBottom = $tMI.rcMonitor(4) Local $iWidth = $iRight - $iLeft Local $iHeight = $iBottom - $iTop Local $a[6] = [$iLeft, $iTop, $iRight, $iBottom, $iWidth, $iHeight] Return $a EndFunc ;==>GetPrimaryMonitorCoords Func GetDesktopOrigin() Local $minX = 0, $minY = 0, $x, $y Local $i = 0, $tDevice, $aRet, $tDevMode, $aED While True $tDevice = DllStructCreate("dword cb; char DeviceName[32]; char DeviceString[128]; dword StateFlags; char DeviceID[128]; char DeviceKey[128]") $tDevice.cb = DllStructGetSize($tDevice) $aRet = DllCall("user32.dll", "bool", "EnumDisplayDevicesA", "ptr", 0, "dword", $i, "ptr", DllStructGetPtr($tDevice), "dword", 0) If @error Or Not $aRet[0] Then ExitLoop If BitAND($tDevice.StateFlags, 1) Then $tDevMode = DllStructCreate( _ "byte dmDeviceName[32]; word dmSpecVersion; word dmDriverVersion; word dmSize; word dmDriverExtra; dword dmFields;" & _ "long dmPositionX; long dmPositionY; dword dmDisplayOrientation; dword dmDisplayFixedOutput;" & _ "short dmColor; short dmDuplex; short dmYResolution; short dmTTOption; short dmCollate; char dmFormName[32];" & _ "ushort dmLogPixels; dword dmBitsPerPel; dword dmPelsWidth; dword dmPelsHeight;" & _ "dword dmDisplayFlags; dword dmDisplayFrequency; dword dmICMMethod; dword dmICMIntent;" & _ "dword dmMediaType; dword dmDitherType; dword dmReserved1; dword dmReserved2; dword dmPanningWidth; dword dmPanningHeight") $tDevMode.dmSize = DllStructGetSize($tDevMode) $aED = DllCall("user32.dll", "bool", "EnumDisplaySettingsA", "str", $tDevice.DeviceName, "dword", -1, "ptr", DllStructGetPtr($tDevMode)) If Not @error And $aED[0] Then $x = $tDevMode.dmPositionX $y = $tDevMode.dmPositionY If $x < $minX Then $minX = $x If $y < $minY Then $minY = $y EndIf EndIf $i += 1 WEnd Local $a[2] = [$minX, $minY] Return $a EndFunc ;==>GetDesktopOrigin
    1 point
  26. ioa747

    interesting accident

    I had an interesting accident. (I thing) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> _ColorsSelection() Func _ColorsSelection() Local $hGUI = GUICreate("Colors Selection", 500, 500, -1, -1, -1) GUISetFont(10) GUICtrlCreateLabel("Red", 10, 10, 101, 17, 0x0002) GUICtrlCreateLabel("Green", 10, 140, 101, 17, 0x0002) Local $Button1 = GUICtrlCreateButton("", 120, 5, 50, 25, 0xFF0000) ; instead of 0x8000 I paste 0xFF0000 GUICtrlSetBkColor(-1, 0xFF0000) Local $Button2 = GUICtrlCreateButton("", 120, 135, 50, 25, 0xFF0000) ; instead of 0x8000 I paste 0xFF0000 GUICtrlSetBkColor(-1, 0x00FF00) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 ConsoleWrite("$Button1=" & $Button1 & @CRLF) Case $Button2 ConsoleWrite("$Button2=" & $Button2 & @CRLF) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>_ColorsSelection
    1 point
  27. The reason why I decided to go with WM_COMMAND is because I already had it in place to do some things with comboboxes. So I only ended up having to add "Case $EN_CHANGE" for each Input box to deal with changes. Also, there are 13 input boxes plus 2 slider controls. So it just seemed like the best option for me. This is a good idea. I've used AdLibRegister before in a few projects. This should do the job, for sure. I'll wait a bit and see what other possible suggestions may come along. Although I feel like sliders aren't used a lot so there may not be too much to reference. I'll do some more reading into it as well. Best regards as well. Cheers!
    1 point
  28. Have you tried it? because I think it should be in this order ; from Case $idBtnAbout AboutMe() ; ----------------------------------------------- GUICtrlSetData($idLabel1, "To copy [" & $aArray[$idx][1] & "]...select [Continue]..." & @CRLF & "Select [Cancel] to exit...") ; to GUICtrlSetData($idLabel1, "To copy [" & $aArray[$idx][1] & "]...select [Continue]..." & @CRLF & "Select [Cancel] to exit...") ; ----------------------------------------------- Case $idBtnAbout AboutMe()
    1 point
  29. Interesting thread indeed. Based on WildByDesign and argumentum scripts, I just kept the minimum code in the following script, to reproduce the issue (no trayitem) 1) First script : we run it and click the Hide button => the gui is hidden ; ; 1st script : click button to hide the gui #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $hGUI = GUICreate("My GUI menu", 300, 200) Local $idMnu_File = GUICtrlCreateMenu("&File") Local $idMnu_Help = GUICtrlCreateMenu("Help") Local $idMni_Info = GUICtrlCreateMenuItem("About", $idMnu_Help) Local $idMnu_View = GUICtrlCreateMenu("View", -1, 1) Local $idBtn_Hide = GUICtrlCreateButton("Hide GUI", 50, 130, 70, 20) GUICtrlSetState(-1, $GUI_FOCUS) Local $idBtn_Cancel = GUICtrlCreateButton("Exit", 180, 130, 70, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $idBtn_Hide ; watch out, another script won't be able to activate correctly the hidden GUI if GUISetState is used here. GUISetState(@SW_HIDE, $hGUI) ; <=============================== ; another script will be able to activate correctly the hidden GUI if WinSetState is used here. ; WinSetState($hGUI, "", @SW_HIDE) ; <========================= Case $idBtn_Cancel, $GUI_EVENT_CLOSE ExitLoop Case $idMni_Info MsgBox($MB_TOPMOST, "Info", "Only a test...") EndSwitch WEnd GUIDelete() EndFunc ;==>Example 2) Second script : we run it and the gui reappears, but its controls/menu don't respond : ; 2nd script : show & activate the hidden GUI #include <WinAPISysWin.au3> ; show and activate the GUI window . Watch out: controls won't react if the GUI was hidden using GUISetState in the 1st script Local $hWnd = WinGetHandle("My GUI menu") _WinAPI_ShowWindow($hWnd, @SW_SHOW) _WinAPI_SetForegroundWindow($hWnd) As argumentum suggested (thanks !) everything works fine if we use in the 1st script WinSetState (instead of GuiSetState) to hide the GUI @Melba23 wrote comments about it in this post. Dear Melba, in case you have some free time, could you please share your opinion about this, e.g. the fact that we need to use WinSetState in the 1st script (which isn't recommended when working with GUI's) because the hidden GUI needs to be shown/activated by an external script ? Thanks
    1 point
  30. 0xC0FFEE, this is awesome and super useful! I'm so fed up by manual gui control positioning and this great project is the solution. Keep it up, I am excited to see more. Will you accept any improvements or advices? It's been so long I am using MetroGUI_UDF, that I've also did something to extend its functionality. For example, _Metro_CreateInput and _Metro_CreateComboBox. I could provide some code to help in development of a couple useful control elements. metro.mp4
    1 point
  31. 1 point
  32. Trong

    CHANGED LANGUAGE

    You should save the script in UTF-8 with BOM encoding, which is safer and more compatible than ISO-8859-5 when the script contains Cyrillic characters. Otherwise, those characters might appear as “????” in Notepad or any editor that doesn’t support UTF-8 by default. If you’ve already opened the file and the characters appear garbled or replaced, do not save it — closing the editor immediately is the only way to prevent irreversible data corruption. Reopen it with a proper Unicode-compatible editor such as SciTE or Notepad++, and the text should display correctly. Think of it as giving your script a universal translator — it’ll speak Cyrillic anywhere without turning into hieroglyphs or "?" . 😄
    1 point
  33. When i asked you to explain what you want to do, i have been thinking about something like this: Which means when one item is pasted, the another item is copied into the clipboard. In this case "CTRL B" would be used to paste and switch. another possible explanation would be like this: Which could mean that you are pasting one item several times until you decide to switch to the next item. All this can be done with a hotkey. Ctrl V pastes the item and "ctrl B" would switch to the next item.
    1 point
  34. If I understand your requirements correctly, here is my approach. ; ----------------------------------------------- ;~ #RequireAdmin ; ----------------------------------------------- #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> ; ----------------------------------------------- Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $hForm, $idFormLabel1, $idFormLabel2, $ArrayValue, $iReturnValue Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800 ; ----------------------------------------------- _Main() ; ----------------------------------------------- Func _Main() $hForm = GUICreate(" ", 130, 20, 730, 120) GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") ; --------------------- $idFormLabel1 = GUICtrlCreateButton("OK", 0, 0, 60, 20) GUICtrlSetOnEvent($idFormLabel1, "_ColRow") ; --------------------- $idFormLabel2 = GUICtrlCreateButton("Cancel", 70, 0, 60, 20) GUICtrlSetOnEvent($idFormLabel2, "_ColRow") ; ----------------------------------------------- GUISetState() ; ----------------------------------------------- While 1 Sleep(1000) WEnd EndFunc ;==>_Main ; ----------------------------------------------- Func _ColRow() Switch @GUI_CtrlId Case $idFormLabel1 OnOK() Case $idFormLabel2 Exit EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $hForm Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- Func OnOK() Local $sFilePath = @ScriptDir & "\SceneData.ini" ; "E:\Desktop\Working\Tests\ReadIni\SceneData.ini" Local $aArray = IniReadSection($sFilePath, "Scene Data") Run("notepad.exe") ; as Paste example Local $hNote = WinWaitActive("[CLASS:Notepad]", "", 3) Opt("GUIOnEventMode", 0) ; when in $hMsgForm - disable <<<<<<<<<<<<<<< Local $hMsgForm = GUICreate("ReadIniFile", 750, 90, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName) Local $idLabel_1 = GUICtrlCreateLabel("", 5, 5, 740, 40) Local $idBtnContinue = GUICtrlCreateButton("Continue", 280, 55, 85, 25) Local $idBtnCancel = GUICtrlCreateButton("Cancel", 375, 55, 85, 25) GUISetState(@SW_SHOW, $hMsgForm) Local $nMsg, $idx = 1 GUICtrlSetData($idLabel_1, $aArray[$idx][1] & @CRLF & "...will be copied to the Clipboard....continue...") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $idBtnCancel ExitLoop Case $idBtnContinue ClipPut($aArray[$idx][1]) WinActivate($hNote) Send("^v") Send("{ENTER}") $idx += 1 If $idx > $aArray[0][0] Then ExitLoop ; It means we have reached the end. GUICtrlSetData($idLabel_1, $aArray[$idx][1] & @CRLF & "...will be copied to the Clipboard....continue...") WinActivate($hMsgForm) EndSwitch WEnd GUIDelete($hMsgForm) Opt("GUIOnEventMode", 1) ; when out of $hMsgForm - enable <<<<<<<<<<<<<<< EndFunc ;==>OnOK
    1 point
  35. Maybe you should tell us what you want to achieve with this program ?! In your example, you are having a lot of message boxes popping up. After each message box, you have 1 item in the clipboard. So basically, you start the the message boxes after clicking on "OK". Then you're having a lot of boxes popping up, after each you have to use ctrl v to paste the content into an application (i assume). That is a lot of clicking on the buttons. That is how your script in the 1st post works. Now tell me, how should your script work after you have done your changes. describe it.
    1 point
  36. Good idea. I probably have to find out which build is going to have it for everyone and check based on OS build. Since MS is always doing that A/B testing these days for so many things, you never know if everyone else has the same features or not. Yes, and I'm quite shocked at how thorough it is. Better late than never. There's even a beautiful dark mode status bar finally. So no more needing to jump through so many hoops to achieve it. I added 'msctls_statusbar32' to the UDF and it automatically does dark mode now for statusbar. I really enjoy how your UDF cycles through all of the controls and everything to make it easy to apply. There are still probably a dozen more controls that I need to check and see if MS added dark mode. But I am short on time right now as well, unfortunately.
    1 point
  37. Yes, thanks 👍 Updated the code for the window when date pick icon was clicked. Still searching for a way to change the date control itself.
    1 point
  38. Can you please try this? Func _OverpaintWhiteLine() Local $hDC = _WinAPI_GetWindowDC($g_hGUI) If Not $hDC Then Return Local $tWndRect = _WinAPI_GetWindowRect($g_hGUI) Local $iWndWidth = $tWndRect.right - $tWndRect.left ; 1. Caption height Local $iCaptionHeight = _WinAPI_GetSystemMetrics($SM_CYCAPTION) ; 2. Border height (top) Local $iBorderHeight = _WinAPI_GetSystemMetrics($SM_CYSIZEFRAME) If $iBorderHeight = 0 Then $iBorderHeight = _WinAPI_GetSystemMetrics($SM_CYFIXEDFRAME) ; 3. Determine menu height dynamically Local $iMenuHeight = _WinAPI_GetSystemMetrics($SM_CYMENU) ; standard menu height ; Alternative: get menu height via GetMenuBarInfo Local $tMenuBarInfo = DllStructCreate("dword cbSize;long left;long top;long right;long bottom;handle hwndMenu;handle hwndItem;bool fBarFocused;bool fFocused") DllStructSetData($tMenuBarInfo, "cbSize", DllStructGetSize($tMenuBarInfo)) Local $aResult = DllCall("user32.dll", "bool", "GetMenuBarInfo", "hwnd", $g_hGUI, "long", 0xFFFFFFFD, "long", 0, "ptr", DllStructGetPtr($tMenuBarInfo)) If IsArray($aResult) And $aResult[0] Then ; Calculate the actual menu height from the coordinates Local $iMenuTop = $tMenuBarInfo.top Local $iMenuBottom = $tMenuBarInfo.bottom Local $tWndPos = _WinAPI_GetWindowRect($g_hGUI) Local $iWndTop = $tWndPos.top ; Convert to window coordinates $iMenuHeight = ($iMenuBottom - $iMenuTop) EndIf ; The white line is directly below the menu Local $iWhiteLineY = $iCaptionHeight + $iBorderHeight + $iMenuHeight - _WinAPI_GetSystemMetrics($SM_CYFIXEDFRAME) * 2 ConsoleWrite("Caption: " & $iCaptionHeight & ", Border: " & $iBorderHeight & ", Menu: " & $iMenuHeight & " -> White Line at Y=" & $iWhiteLineY & @CRLF) ; Overpaint the white line (1–2 pixels) Local $tRect = DllStructCreate($tagRECT) With $tRect .left = 0 .top = $iWhiteLineY .right = $iWndWidth .bottom = $iWhiteLineY + 2 ; 2 pixels high EndWith ;~ Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF(0xFF0000)) _WinAPI_FillRect($hDC, $tRect, $hBrush) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($g_hGUI, $hDC) EndFunc ;==>_OverpaintWhiteLine I marked the line in red to see where it is painted. Is it now calculated properly?
    1 point
  39. Absolutely. Thank you so much for confirming.
    1 point
  40. SciTE doesn't do high DPI scaling by default because it's very old software. And it's likely that your newer PC uses high DPI as they all do now. You need to set high DPI scaling for the SciTE.exe binary. Right-click on SciTE.exe, go to Properties, click on the Compatibility tab and click on the button that says Change high DPI settings. At the bottom, click on Override high DPI scaling behavior. I would choose Application as the option. Click OK to save that new setting. You will have to restart SciTE for the high DPI settings to take effect.
    1 point
  41. ioa747

    AutoIt Snippets

    trick for ToolTip with timer Func _ToolTip($sText, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iTimeout = 1500, $iOptions = 0) AdlibUnRegister("_ToolTipKiller") ; This prevents the previous timer from closing the new tooltip. ToolTip($sText, $iX, $iY, $sTitle, $iIcon, $iOptions) AdlibRegister("_ToolTipKiller", $iTimeout) EndFunc ;==>_ToolTip Func _ToolTipKiller() ToolTip("") ; Hide the tooltip AdlibUnRegister("_ToolTipKiller") ; unregister itself. EndFunc ;==>_ToolTipKiller Example ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/page/28/#findComment-1546696 ;---------------------------------------------------------------------------------------- ; Title...........: Trick for ToolTip with timer ; Description.....: Displays a native tooltip with timer. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.1 ; Note............: Testet in Win10 22H2 Date:16/10/2025 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> Forms() Func Forms() Local $hGui = GUICreate(@ScriptName, 250, 150, -1, -1) Local $idBtn1 = GUICtrlCreateButton("Button 1", 10, 10, 100, 25) Local $idBtn2 = GUICtrlCreateButton("Button 2", 10, 40, 100, 25) Local $idBtn3 = GUICtrlCreateButton("Button 3", 10, 70, 100, 25) Local $idBtn4 = GUICtrlCreateButton("Button 4", 10, 100, 100, 25) GUISetState(@SW_SHOW, $hGui) While 1 Local $aWPos = WinGetPos($hGui) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn1 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 1", 1) Case $idBtn2 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 2", 1) Case $idBtn3 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 3", 1) Case $idBtn4 _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 4", 1) EndSwitch WEnd GUIDelete($hGui) EndFunc ;==>Forms Func _ToolTip($sText, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iTimeout = 1500, $iOptions = 0) AdlibUnRegister("_ToolTipKiller") ; This prevents the previous timer from closing the new tooltip. ToolTip($sText, $iX, $iY, $sTitle, $iIcon, $iOptions) AdlibRegister("_ToolTipKiller", $iTimeout) EndFunc ;==>_ToolTip Func _ToolTipKiller() ToolTip("") ; Hide the tooltip AdlibUnRegister("_ToolTipKiller") ; unregister itself. EndFunc ;==>_ToolTipKiller
    1 point
  42. V1.0.0 released! 🎊 Event on toast interaction now works! 🎉
    1 point
  43. different approach, for 'exclusive mode' #AutoIt3Wrapper_UseX64=Y #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <MsgBoxConstants.au3> #include <Array.au3> #include <GuiMenu.au3> #include <GuiListView.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) Global $g_hGUI1, $g_hGUI2, $g_idButton1, $g_idButton2, $g_idButton3 Global $hListViewDatascope, $hDatabaseScope, $Button1, $Button2 ;a utiliser pour l'affichage de la 2eme fenetre Global $iEditMode = 0 gui1() Func gui1() $g_hGUI1 = GUICreate("GUI 1", 200, 200, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close") ; Call a common GUI close function $g_idButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30) GUICtrlSetOnEvent(-1, "On_Button") ; Call a common button function $g_idButton2 = GUICtrlCreateButton("Show GUI 2", 10, 60, 80, 30) GUICtrlSetOnEvent(-1, "On_Button") ; Call a common button function $g_idButton3 = GUICtrlCreateButton("Traitement", 10, 100, 80, 30) GUICtrlSetOnEvent(-1, "Traitement_intermediaire") ; Call a traitement GUISetState() While 1 Sleep(10) WEnd EndFunc ;==>gui1 Func gui2() ; exclusive mode GUICtrlSetState($g_idButton2, $GUI_DISABLE) Opt("GUIOnEventMode", 0) ; when in $g_hGUI2 - disable <<<<<<<<<<<<<<< $g_hGUI2 = GUICreate("GUI 2", 500, 500) ;~ GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close") ; Call a common GUI close function $g_idButton3 = GUICtrlCreateButton("GoOn", 10, 450, 100, 30) ;~ GUICtrlSetOnEvent(-1, "On_Button") ; Call a common button function $g_idButton4 = GUICtrlCreateButton("Cancel", 250, 450, 100, 30) ;~ GUICtrlSetOnEvent(-1, "On_Close") ; Call a common button function $hListViewDatascope = GUICtrlCreateListView("Tom|Dick|Harry", 10, 10, 400, 400, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($hListViewDatascope, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($hListViewDatascope, 0, 93) _GUICtrlListView_SetColumnWidth($hListViewDatascope, 1, 93) _GUICtrlListView_SetColumnWidth($hListViewDatascope, 2, 93) ; Set font GUICtrlSetFont($hListViewDatascope, 12, Default, Default, "Courier New") ; Note edit control will use same font ; Create array and fill listview Global $aLV_List[20] For $i = 0 To UBound($aLV_List) - 1 If Mod($i, 5) Then $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i Else $aLV_List[$i] = "Tom " & $i & "||Harry " & $i EndIf GUICtrlCreateListViewItem($aLV_List[$i], $hListViewDatascope) Next ;_GUIListViewEx_Init($hLV, $aArray = "", $iStart = 0, $iColour = 0, $fImage = False, $iAdded = 0) $iLVIndex_1 = _GUIListViewEx_Init($hListViewDatascope, $aLV_List, 0, 0, True, +1 + 4) ; Tri & modification possible ;_GUIListViewEx_SetEditStatus($iLV_Index, $vCol, $iMode = 1, $vParam1 = Default, $vParam2 = Default) _GUIListViewEx_SetEditStatus($iLVIndex_1, "1;2") ;modification des colonnes 1 & 2 _GUIListViewEx_SetActive($iLVIndex_1) ; Enregistrement des messages Windows _GUIListViewEx_MsgRegister(Default) GUIRegisterMsg($WM_NOTIFY, "_Events_WM_NOTIFY") GUISetState() Local $aMsg = 0 While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] ; Switch from GUIs Case $g_hGUI2 Switch $aMsg[0] ; Switch from event ID Case $GUI_EVENT_CLOSE, $g_idButton4 ConsoleWrite("GUI2: $GUI_EVENT_CLOSE=" & $GUI_EVENT_CLOSE & @CRLF) ExitLoop Case $g_idButton3 ConsoleWrite("GUI2: $g_idButton3=" & $g_idButton3 & @CRLF) MessageBox(2) EndSwitch EndSwitch WEnd GUIDelete($g_hGUI2) GUICtrlSetState($g_idButton2, $GUI_ENABLE) Opt("GUIOnEventMode", 1) ; when out of $g_hGUI2 - enable <<<<<<<<<<<<<<< EndFunc ;==>gui2 Func On_Close() Switch @GUI_WinHandle ; See which GUI sent the CLOSE message Case $g_hGUI1 Exit ; If it was this GUI - we exit <<<<<<<<<<<<<<< ;~ Case $g_hGUI2 ;~ GUIDelete($g_hGUI2) ; If it was this GUI - we just delete the GUI <<<<<<<<<<<<<<< EndSwitch EndFunc ;==>On_Close ;~ Func Off_Button() ;~ On_Close() ;~ EndFunc ;==>Off_Button Func On_Button() Switch @GUI_CtrlId ; See which button sent the message Case $g_idButton1 MessageBox(1) ; We can call a function with parameters here <<<<<<<<<<<<<<<<<<< Case $g_idButton2 gui2() ;~ Case $g_idButton3 ;~ MessageBox(2) ; We can call a function with parameters here <<<<<<<<<<<<<<<<<<< EndSwitch EndFunc ;==>On_Button Func MessageBox($iIndex) MsgBox($MB_OK, "MsgBox " & $iIndex, "Test from Gui " & $iIndex) EndFunc ;==>MessageBox Func Traitement_intermediaire() gui2() ; display the listview MsgBox(0, "Suite", "cela continue") ;suite du script ;.... EndFunc ;==>Traitement_intermediaire Func _Events_WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $Msg, $wParam, $lParam) Local $tInfo, $Code $tInfo = DllStructCreate($tagNMHDR, $lParam) $hWnd = HWnd(DllStructGetData($tInfo, "hWndFrom")) $Code = DllStructGetData($tInfo, "Code") $hWnd_ListViewDatascope = GUICtrlGetHandle($hListViewDatascope) If $hWnd = $hWnd_ListViewDatascope Then Switch $Code Case $NM_DBLCLK ; Double-clic sur un 鬩ment de la ListView Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $iIndex = DllStructGetData($tInfo, "Index") ; indique le numero de ligne Local $iSubItem = DllStructGetData($tInfo, "SubItem") ;indique le numero de colonne Local $sText = _GUICtrlListView_GetItemText($hListViewDatascope, $iIndex, $iSubItem) $vRet = _GUIListViewEx_EventMonitor($iEditMode) MsgBox(0, "valeur click", "$iSubItem :" & $iSubItem & @CRLF & "$iIndex:" & $iIndex & @CRLF & "$sText:" & $sText & @CRLF & $vRet & @CRLF & "ret:&$ret") ;&@CRLF&"$hEdit:"&$hEdit) Case $NM_RCLICK ; right button Local $aSelected = _GUICtrlListView_GetSelectedIndices($hWnd, True) If $aSelected[0] > 0 Then MsgBox(0, "test", "Right Button") EndIf EndSwitch Return $GUI_RUNDEFMSG ; EndIf ; Must be LAST line of the handler Return (_GUIListViewEx_WM_NOTIFY_Handler($hWnd, $Msg, $wParam, $lParam)) EndFunc ;==>_Events_WM_NOTIFY
    1 point
  44. Come checkout my Metro GUI designer. User Interface Builder
    1 point
  45. pixelsearch

    interesting accident

    Maybe this explanation ? 1) Button when no style is indicated at creation (-1) , WS_TABSTOP will be forced (help file) Button style becomes 0x50010000 WS_CHILD, WS_VISIBLE, WS_TABSTOP [0x40000000, 'WS_CHILD'] [0x10000000, 'WS_VISIBLE'] [0x00010000, 'WS_TABSTOP'] 2) Button created with 0xFF0000 style Button style becomes 0x50FF0000 WS_CHILD, WS_VISIBLE, WS_OVERLAPPEDWINDOW, WS_VSCROLL, WS_HSCROLL [0x40000000, 'WS_CHILD'] [0x10000000, 'WS_VISIBLE'] [0x00CF0000, 'WS_OVERLAPPEDWINDOW'] [0x00200000, 'WS_VSCROLL'] [0x00100000, 'WS_HSCROLL'] 'WS_OVERLAPPEDWINDOW' means (WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
    1 point
  46. You can use _GDIPlus_GIFAnim.au3: ;coded by UEZ build 2017-07-04 ;requires 3.3.11.5+ #AutoIt3Wrapper_Version=b #include-once #include <GDIPlus.au3> #include <Memory.au3> ;_GDIPlus_BitmapConvertTo8Bit ;_GDIPlus_GIFAnimCreateFile ;_GDIPlus_GIFAnimExtractAllFrames ;_GDIPlus_GIFAnimGetFrameCount ;_GDIPlus_GIFAnimGetFrameDelays ;_GDIPlus_GIFAnimGetFrameDelaysFromBinFile ;_GDIPlus_GIFAnimGetFrameDimensionsCount ;_GDIPlus_GIFAnimGetFrameDimensionsList ;_GDIPlus_GIFAnimSelectActiveFrame ;_GDIPlus_ImageGetColorPalette ;_GDIPlus_ImageGetColorPaletteSize ;_GDIPlus_ImageSaveAdd ;_GDIPlus_ImageSaveAddImage ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimGetFrameDimensionsCount ; Description ...: Gets the number of frame dimensions in this Image object. ; Syntax ........: _GDIPlus_GIFAnimGetFrameDimensionsCount($hImage) ; Parameters ....: $hImage - A handle to an image / bitmap object ; Return values .: The number of frame dimensions in this Image object. ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimGetFrameDimensionsCount($hImage) Local Const $aResult = DllCall($__g_hGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "handle", $hImage, "ulong*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $aResult[2] EndFunc ;==>_GDIPlus_GIFAnimGetFrameDimensionsCount ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimGetFrameDimensionsList ; Description ...: Gets the identifiers for the frame dimensions of this Image object which fills the GUID struct. ; Syntax ........: _GDIPlus_GIFAnimGetFrameDimensionsList($hImage, $iFramesCount) ; Parameters ....: $hImage - A handle to an image / bitmap object ; $iFramesCount - An integer value. ; Return values .: tagGUID struct ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimGetFrameDimensionsList($hImage, $iFramesCount) Local Const $tGUID = DllStructCreate($tagGUID) Local Const $aResult = DllCall($__g_hGDIPDll, "int", "GdipImageGetFrameDimensionsList", "handle", $hImage, "struct*", $tGUID, "uint", $iFramesCount) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $tGUID EndFunc ;==>_GDIPlus_GIFAnimGetFrameDimensionsList ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimGetFrameCount ; Description ...: Gets the frame count of the loaded gif by passing the GUID struct ; Syntax ........: _GDIPlus_GIFAnimGetFrameCount($hImage, $tGUID) ; Parameters ....: $hImage - A handle to an image / bitmap object ; $tGUID - A struct to a GUID that specifies the frame dimension. ; Return values .: The amount of frames from a GIF animated image handle ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: _GDIPlus_ImageLoadFromFile _GDIPlus_BitmapCreateFromFile ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimGetFrameCount($hImage, $tGUID) Local Const $aResult = DllCall($__g_hGDIPDll, "int", "GdipImageGetFrameCount", "handle", $hImage, "struct*", $tGUID, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return Int($aResult[3]) EndFunc ;==>_GDIPlus_GIFAnimGetFrameCount ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimSelectActiveFrame ; Description ...: Selects the frame in this Image object specified by passing the GUID struct and current frame. ; Syntax ........: _GDIPlus_GIFAnimSelectActiveFrame($hImage, $tGUID, $iCurrentFrame) ; Parameters ....: $hImage - A handle to an image / bitmap object ; $tGUID - A struct to a GUID that specifies the frame dimension. ; $iCurrentFrame - An integer value. ; Return values .: True or False on errors ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: _GDIPlus_ImageLoadFromFile _GDIPlus_BitmapCreateFromFile ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimSelectActiveFrame($hImage, $tGUID, $iCurrentFrame) Local Const $aResult = DllCall($__g_hGDIPDll, "int", "GdipImageSelectActiveFrame", "handle", $hImage, "struct*", $tGUID, "uint", $iCurrentFrame) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return True EndFunc ;==>_GDIPlus_GIFAnimSelectActiveFrame ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimGetFrameDelays ; Description ...: Gets the delay of each frame from an image handle ; Syntax ........: _GDIPlus_GIFAnimGetFrameDelays($hImage, $iAnimFrameCount) ; Parameters ....: $hImage - A handle to an image / bitmap object ; $iAnimFrameCount - An integer value. ; Return values .: An array with the information about the delay of each frame or the error code ; Author ........: UEZ ; Modified ......: ; Remarks .......: If frame delays cannot be read try _GDIPlus_GIFAnimGetFrameDelaysFromBinFile instead ; Related .......: _GDIPlus_ImageLoadFromFile _GDIPlus_BitmapCreateFromFile _GDIPlus_ImageGetPropertyItem ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimGetFrameDelays($hImage, $iAnimFrameCount) If $iAnimFrameCount < 2 Then Return SetError(1, 0, 0) Local Const $GDIP_PROPERTYTAGFRAMEDELAY = 0x5100 Local $tPropItem = __GDIPlus_ImageGetPropertyItem($hImage, $GDIP_PROPERTYTAGFRAMEDELAY) If IsDllStruct($tPropItem) And (Not @error) Then Local $iType = $tPropItem.type, $iLength, $tVal If $iType Then $iLength = $tPropItem.length Switch $iType Case 1 $tVal = DllStructCreate("byte delay[" & $iLength & "]", $tPropItem.value) Case 3 $tVal = DllStructCreate("short delay[" & Ceiling($iLength / 2) & "]", $tPropItem.value) Case 4 $tVal = DllStructCreate("long delay[" & Ceiling($iLength / 4) & "]", $tPropItem.value) Case Else Return SetError(3, 0, 0) EndSwitch Local $aFrameDelays[Int($iAnimFrameCount)], $i For $i = 0 To UBound($aFrameDelays) - 1 $aFrameDelays[$i] = $tVal.delay(($i + 1)) * 10 ;~ ConsoleWrite($i & ": "& $aFrameDelays[$i] & @CRLF) Next EndIf Return $aFrameDelays EndIf Return SetError(2, 0, 0) EndFunc ;==>_GDIPlus_GIFAnimGetFrameDelays ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_ImageGetPropertyItem ; Description ...: Gets a specified property item (piece of metadata) from this Image object. ; Syntax ........: __GDIPlus_ImageGetPropertyItem($hImage, $iPropID) ; Parameters ....: $hImage - A handle to an image object. ; $iPropID - An integer that identifies the property item to be retrieved. ; Return values .: $tagGDIPPROPERTYITEM structure or 0 on errors ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: _GDIPlus_ImageLoadFromFile _GDIPlus_ImageLoadFromStream ; Link ..........: Property Item Descriptions -> http://msdn.microsoft.com/en-us/library/windows/desktop/ms534416(v=vs.85).aspx ; =============================================================================================================================== Func __GDIPlus_ImageGetPropertyItem($hImage, $iPropID) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetPropertyItemSize", "handle", $hImage, "uint", $iPropID, "ulong*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Local Static $tBuffer ;why static? because otherwise it would crash when running it as x64 exe (workaround) $tBuffer = DllStructCreate("byte[" & $aResult[3] & "]") $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetPropertyItem", "handle", $hImage, "uint", $iPropID, "ulong", $aResult[3], "struct*", $tBuffer) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(11, $aResult[0], 0) Local Const $tagGDIPPROPERTYITEM = "uint id;ulong length;word type;ptr value" Local $tPropertyItem = DllStructCreate($tagGDIPPROPERTYITEM, DllStructGetPtr($tBuffer)) If @error Then Return SetError(20, $aResult[0], 0) Return $tPropertyItem EndFunc ;==>__GDIPlus_ImageGetPropertyItem ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimGetFrameDelaysFromBinFile ; Description ...: Gets the delay of each frame from a binary gif file ; Syntax ........: _GDIPlus_GIFAnimGetFrameDelaysFromBinFile($binGIF, $iAnimFrameCount[, $iDelay = 10]) ; Parameters ....: $binGIF - A binary string with the GIF anim. ; $iAnimFrameCount - An integer value. ; Return values .: An array with the information about the delay of each frame or the error code ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimGetFrameDelaysFromBinFile($binGIF, $iAnimFrameCount) If Not IsBinary($binGIF) Then Return SetError(1, 0, 0) If $iAnimFrameCount < 2 Then Return SetError(2, 0, 0) Local $aFrameDelays = StringRegExp($binGIF, "(?i)0021F904[[:xdigit:]]{2}([[:xdigit:]]{4})", 3) If @error Then Return SetError(3, 0, 0) Local Const $iDelay = 10 For $i = 0 To UBound($aFrameDelays) - 1 $aFrameDelays[$i] = $iDelay * Dec(StringRegExpReplace($aFrameDelays[$i], "([[:xdigit:]]{2})([[:xdigit:]]{2})", "$2$1")) Next If UBound($aFrameDelays) <> $iAnimFrameCount Then ReDim $aFrameDelays[$iAnimFrameCount] Return $aFrameDelays EndFunc ;==>_GDIPlus_GIFAnimGetFrameDelaysFromBinFile ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimExtractAllFrames ; Description ...: Extracts all frames from a GIF animation file with the option to resize the frames ; Syntax ........: _GDIPlus_GIFAnimExtractAllFrames($hImage, $sFilename[, $iJPGQual = 85[, $iW = 0[, $iH = 0[, $iResizeQual = 7[, ; $bReverse = False]]]]]) ; Parameters ....: $hImage - A handle to an image / bitmap object ; $sFilename - A string value. Folders will be created if not existing. ; $iJPGQual - [optional] An integer value. Default is 85. ; $iW - [optional] An integer value. Default is 0. ; $iH - [optional] An integer value. Default is 0. ; $iResizeQual - [optional] An integer value. Default is 2. ; $bReverse - [optional] A binary value. Default is False. ; Return values .: True or False on errors ; Author ........: UEZ ; Modified ......: ; Remarks .......: All frames will be extracted whereas the filename will be <filename>_XX.<ext>. XX is the amount of frames. If ; $bReverse is set True then the frames will be saved in reverse order. If $iW and $iH are zero then no resizing will be done. ; Related .......: _GDIPlus_EncodersGetCLSID _GDIPlus_ParamInit _GDIPlus_BitmapCreateFromScan0 _GDIPlus_GraphicsSetInterpolationMode _GDIPlus_ImageSaveToFile ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimExtractAllFrames($hImage, $sFilename, $iJPGQual = 85, $iW = 0, $iH = 0, $iResizeQual = 2, $bReverse = False) If $sFilename = "" Then Return SetError(1, @error, 0) Local Const $iAnimDimCount = _GDIPlus_GIFAnimGetFrameDimensionsCount($hImage) If @error Then Return SetError(2, @error, 0) Local Const $tGUID = _GDIPlus_GIFAnimGetFrameDimensionsList($hImage, $iAnimDimCount) If @error Then Return SetError(3, @error, 0) Local Const $iAnimFrameCount = _GDIPlus_GIFAnimGetFrameCount($hImage, $tGUID) If @error Then Return SetError(4, @error, 0) Local $sPath = StringRegExpReplace($sFilename, "(.+)\\.+", "$1") If StringLen($sPath) > 2 Then If Not FileExists($sPath) Then DirCreate($sPath) EndIf Local $sPrefixList = "jpg,png,bmp,gif,tif,", $sSuffix = StringRight($sFilename, 3) If Not StringInStr($sPrefixList, $sSuffix) Or StringMid($sFilename, StringLen($sFilename) - 3, 1) <> "." Then $sSuffix = "png" $sFilename &= ".png" EndIf Switch $sSuffix Case "jpg" Local $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") Local $tParams = _GDIPlus_ParamInit(1) Local $tData = DllStructCreate("int Quality") Local $pData = DllStructGetPtr($tData) Local $pParams = DllStructGetPtr($tParams) $tData.Quality = $iJPGQual _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) EndSwitch Local $sPrefix = StringTrimRight($sFilename, 4), $hFrame, $iCurrentFrame = 0, $i, $iRet, $hBitmap, $hGfx, $bError = False, $bResize = False If ($iW > 0) And ($iH > 0) And ($iW <> _GDIPlus_ImageGetWidth($hImage)) And ($iH <> _GDIPlus_ImageGetHeight($hImage)) Then $bResize = True $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $iResizeQual) EndIf Local $iFrame For $i = 0 To $iAnimFrameCount If $bReverse Then $iFrame = $iAnimFrameCount - $i Else $iFrame = $i EndIf _GDIPlus_GIFAnimSelectActiveFrame($hImage, $tGUID, $i) Switch $bResize Case False $hFrame = $hImage Case Else _GDIPlus_GraphicsClear($hGfx, 0x00000000) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $iW, $iH) $hFrame = $hBitmap EndSwitch Switch $sSuffix Case "jpg" $iRet = _GDIPlus_ImageSaveToFileEx($hFrame, $sPrefix & "_" & StringFormat("%0" & StringLen(Int($iAnimFrameCount)) & "i." & $sSuffix, $iFrame), $sCLSID, $pParams) If Not $iRet Then $bError = True Case Else $iRet = _GDIPlus_ImageSaveToFile($hFrame, $sPrefix & "_" & StringFormat("%0" & StringLen(Int($iAnimFrameCount)) & "i." & $sSuffix, $iFrame)) If Not $iRet Then $bError = True EndSwitch Next If $bResize Then _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) EndIf Return $bError EndFunc ;==>_GDIPlus_GIFAnimExtractAllFrames ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_GIFAnimCreateFile ; Description ...: Creates a GIF animation file ; Syntax ........: _GDIPlus_GIFAnimCreateFile($aImages, $sFilename[, $iDelay = 100]) ; Parameters ....: $aImages - An array of image handles (animation frames). ; $sFilename - The filename of the GIF animation. ; $iDelay - [optional] An integer value. Default is 100 ms per frame. ; Return values .: True or False on errors ; Author ........: UEZ ; Modified ......: ; Remarks .......: Vista or a higher operating system is required to create a GIF animation! ; Related .......: _GDIPlus_EncodersGetCLSID _GDIPlus_ParamInit _GDIPlus_ParamAdd _GDIPlus_ImageSaveToFileEx ; Link ..........: ; =============================================================================================================================== Func _GDIPlus_GIFAnimCreateFile($aImages, $sFilename, $iDelay = 100) Local Const $GDIP_EVTFrameDimensionTime = 21 Local $sCLSID = _GDIPlus_EncodersGetCLSID("GIF") Local $tMultiFrameParam = DllStructCreate("int;") DllStructSetData($tMultiFrameParam, 1, $GDIP_EVTMULTIFRAME) Local $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tMultiFrameParam)) Local $hStream = _WinAPI_CreateStreamOnHGlobal() Local $tGUID = _WinAPI_GUIDFromString($sCLSID) _GDIPlus_ImageSaveToStream($aImages[1], $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) DllStructSetData($tMultiFrameParam, 1, $GDIP_EVTFrameDimensionTime) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tMultiFrameParam)) Local $i For $i = 2 To $aImages[0] - 1 _GDIPlus_ImageSaveAddImage($aImages[1], $aImages[$i], $tParams) Next DllStructSetData($tParams, 1, $GDIP_EVTLASTFRAME) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tMultiFrameParam)) _GDIPlus_ImageSaveAddImage($aImages[1], $aImages[$i], $tParams) DllStructSetData($tParams, 1, $GDIP_EVTFLUSH) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGSAVEFLAG, 1, $GDIP_EPTLONG, DllStructGetPtr($tMultiFrameParam)) _GDIPlus_ImageSaveAdd($aImages[$i], $tParams) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) Local $iMemSize = _MemGlobalSize($hMemory) Local $pMem = _MemGlobalLock($hMemory) Local $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) _MemGlobalFree($hMemory) $bData = StringRegExpReplace($bData, "(?i)(0021F904[[:xdigit:]]{2})[[:xdigit:]]{4}", "${1}" & StringRegExpReplace(Hex(Int($iDelay / 10), 4), "([[:xdigit:]]{2})([[:xdigit:]]{2})", "$2$1")) Local $iExtended = @extended Local $hFile = FileOpen($sFilename, 2) If @error Then Return SetError(2, 0, False) FileWrite($hFile, Binary($bData)) FileClose($hFile) If Not $iExtended Then Return SetError(1, 0, False) Return SetExtended($iExtended, True) EndFunc ;==>_GDIPlus_GIFAnimCreateFile Func _GDIPlus_GIFAnimCreateFileFromImageFiles($aFrames, $sGIFFileName, $bReplay = True) Local $tagGIFHeader = "byte Header[6];byte Width[2];byte Height[2];byte PackedField[1];byte BackgroundColorIndex[1];byte PixelAspectRatio[1];" Local $tGIFHeader_1frame = DllStructCreate($tagGIFHeader & "byte ColorTable[768];") Local $hFile = _WinAPI_CreateFile($aFrames[0][0], 2, 2), $nBytes _WinAPI_ReadFile($hFile, DllStructGetPtr($tGIFHeader_1frame), DllStructGetSize($tGIFHeader_1frame), $nBytes) _WinAPI_CloseHandle($hFile) Local $iColorTableSize = 3 * 2 ^ (BitAND($tGIFHeader_1frame.PackedField, 7) + 1) Local $tGIFHeader_File = DllStructCreate($tagGIFHeader & "byte ColorTable[" & $iColorTableSize & "];byte ApplicationBlockExtension[18]") $tGIFHeader_File.Header = $tGIFHeader_1frame.Header $tGIFHeader_File.Width = $tGIFHeader_1frame.Width $tGIFHeader_File.Height = $tGIFHeader_1frame.Height $tGIFHeader_File.PackedField = $tGIFHeader_1frame.PackedField $tGIFHeader_File.BackgroundColorIndex = $tGIFHeader_1frame.BackgroundColorIndex $tGIFHeader_File.PixelAspectRatio = $tGIFHeader_1frame.PixelAspectRatio $tGIFHeader_File.ColorTable = BinaryMid($tGIFHeader_1frame.ColorTable, 1, $iColorTableSize) $tGIFHeader_File.ApplicationBlockExtension = Binary("0x21FF0B4E45545343415045322E3003010000") Local $bGIFHeader, $i, $b, $p, $d For $i = 1 To 8 $bGIFHeader &= StringTrimLeft(DllStructGetData($tGIFHeader_File, $i), 2) Next For $i = 0 To UBound($aFrames) - 1 $b = Binary(FileRead($aFrames[$i][0])) $p = Floor(StringInStr($b, "0021F904") / 2) $d = Hex(Dec($aFrames[$i][1] / 10), 4) If Not $p Then ContinueLoop $bGIFHeader &= StringMid(StringRegExpReplace(BinaryMid($b, $p, BinaryLen($b) - $p - 1), "(?i)0021F904([[:xdigit:]]{2})([[:xdigit:]]{4})(.*)", "0021F904${1}" & StringRight($d, 2) & StringLeft($d, 2) & "$3"), 3) Next $hFile = FileOpen($sGIFFileName, 18) FileWrite($hFile, Binary("0x" & $bGIFHeader & "3B")) FileClose($hFile) EndFunc ;==>_GDIPlus_GIFAnimCreateFileFromImageFiles ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_BitmapConvertTo8Bit ; Description ...: Converts a bitmap to a 8-bit image ; Syntax ........: _GDIPlus_BitmapConvertTo8Bit(Byref $hBitmap[, $iColorCount = 253[,$iDitherType = $GDIP_DitherTypeDualSpiral8x8[, ; $iPaletteType = $GDIP_PaletteTypeFixedHalftone252,[$bUseTransparentColor = True]]]]) ; Parameters ....: $hBitmap - A handle to an image / bitmap object ; $iColorCount - [optional] An integer value. Default is 253. ; $iDitherType - [optional] An integer value. Default is $GDIP_DitherTypeDualSpiral8x8. -> http://msdn.microsoft.com/en-us/library/ms534106(v=vs.85).aspx ; $iPaletteType - [optional] An integer value. Default is $GDIP_PaletteTypeFixedHalftone252 . -> http://msdn.microsoft.com/en-us/library/ms534159(v=vs.85).aspx ; $bUseTransparentColor - [optional] A binary value. Default is True. ; Return values .: True or False on errors ; Author ........: UEZ ; Modified ......: ; Remarks .......: Vista or a higher operating system is required ; Related .......: _GDIPlus_PaletteInitialize _GDIPlus_BitmapConvertFormat _GDIPlus_ImageLoadFromFile _GDIPlus_BitmapCreateFromScan0 ; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms534106(v=vs.85).aspx) ; =============================================================================================================================== Func _GDIPlus_BitmapConvertTo8Bit(ByRef $hBitmap, $iColorCount = 256, $iDitherType = $GDIP_DitherTypeDualSpiral8x8, $iPaletteType = $GDIP_PaletteTypeFixedHalftone252, $bUseTransparentColor = True) $iColorCount = ($iColorCount > 2 ^ 8) ? 2 ^ 8 : $iColorCount Local $tPalette = _GDIPlus_PaletteInitialize(256, $iPaletteType, $iColorCount, $bUseTransparentColor, $hBitmap) If @error Then Return SetError(1, @error, 0) Local $iRet = _GDIPlus_BitmapConvertFormat($hBitmap, $GDIP_PXF08INDEXED, $iDitherType, $iPaletteType, $tPalette) If @error Then Return SetError(2, @error, 0) Return $iRet EndFunc ;==>_GDIPlus_BitmapConvertTo8Bit Func _GDIPlus_BitmapConvertToXBit(ByRef $hBitmap, $iColorCount = 16, $iPixelFormat = $GDIP_PXF04INDEXED, $iDitherType = $GDIP_DitherTypeDualSpiral8x8, $iPaletteType = $GDIP_PaletteTypeFixedHalftone252, $bUseTransparentColor = False) Switch $iPixelFormat Case $GDIP_PXF08INDEXED $iColorCount = ($iColorCount > 2 ^ 8) ? 2 ^ 8 : $iColorCount Case $GDIP_PXF04INDEXED $iColorCount = ($iColorCount > 2 ^ 4) ? 2 ^ 4 : $iColorCount Case $GDIP_PXF01INDEXED $iPaletteType = $GDIP_PaletteTypeFixedBW $iColorCount = 2 Case Else $iPixelFormat = $GDIP_PXF04INDEXED $iColorCount = 16 $iDitherType = $GDIP_DitherTypeDualSpiral8x8 $iPaletteType = $GDIP_PaletteTypeFixedHalftone252 EndSwitch Local $tPalette = _GDIPlus_PaletteInitialize(256, $iPaletteType, $iColorCount, $bUseTransparentColor, $hBitmap) If @error Then Return SetError(1, @error, 0) Local $iRet = _GDIPlus_BitmapConvertFormat($hBitmap, $iPixelFormat, $iDitherType, $iPaletteType, $tPalette) If @error Then Return SetError(2, @error, 0) Return $iRet EndFunc ;==>_GDIPlus_BitmapConvertToXBit Func _GDIPlus_ImageGetColorPalette($hImage, ByRef $tColorPalette, $iSize) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetImagePalette", "handle", $hImage, "struct*", $tColorPalette, "uint", $iSize) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return True EndFunc ;==>_GDIPlus_ImageGetColorPalette Func _GDIPlus_ImageGetColorPaletteSize($hImage) Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipGetImagePaletteSize", "handle", $hImage, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $aResult[2] EndFunc ;==>_GDIPlus_ImageGetColorPaletteSize Example: ;requires 3.3.15.0+ version #AutoIt3Wrapper_Version=b #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so ;/pe /rm ;~ #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <Array.au3> #include <WindowsConstants.au3> #include "_GDIPlus_GIFAnim.au3" _GDIPlus_Startup() Global $fSize = 3.5 Global $binGIFAnim = _BruceLee() Global $hGIFImage = _GDIPlus_BitmapCreateFromMemory($binGIFAnim) Global Const $iW = _GDIPlus_ImageGetWidth($hGIFImage), $iH = _GDIPlus_ImageGetHeight($hGIFImage) Global Const $hGUI = GUICreate("GIF Anim UDF Example", $iW * $fSize, $iH * $fSize) Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW * $fSize, $iH * $fSize) GUISetState() Global $iCurrentFrame = 0 Global Const $iAnimDimCount = _GDIPlus_GIFAnimGetFrameDimensionsCount($hGIFImage) Global Const $tGUID = _GDIPlus_GIFAnimGetFrameDimensionsList($hGIFImage, $iAnimDimCount) Global Const $iAnimFrameCount = _GDIPlus_GIFAnimGetFrameCount($hGIFImage, $tGUID) Global Const $aFrameDelays = _GDIPlus_GIFAnimGetFrameDelaysFromBinFile($binGIFAnim, $iAnimFrameCount) AdlibRegister("PlayAnimPreview", 10) Do If GUIGetMsg() = -3 Then ;$GUI_EVENT_CLOSE = -3 AdlibUnRegister("PlayAnimPreview") _GDIPlus_BitmapDispose($hGIFImage) _GDIPlus_Shutdown() GUIDelete() $binGIFAnim = 0 Exit EndIf Until False Func PlayAnimPreview() AdlibUnRegister("PlayAnimPreview") Local $iDelay = $aFrameDelays[$iCurrentFrame] Local Static $iTimerCurrentFrame = TimerInit() _GDIPlus_GIFAnimSelectActiveFrame($hGIFImage, $tGUID, $iCurrentFrame) Local $hBmp = _GDIPlus_BitmapCreateFromScan0($iW * $fSize, $iH * $fSize) Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $GDIP_INTERPOLATIONMODE_NEARESTNEIGHBOR) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) _GDIPlus_GraphicsDrawImageRectRect($hGfx, $hGIFImage, 0, 0, $iW, $iH, 0, 0, $iW * $fSize, $iH * $fSize) Local $hBitmap_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, 0x0172 , 0, $hBitmap_GDI)) ;$STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0 _WinAPI_DeleteObject($hBitmap_GDI) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBmp) If TimerDiff($iTimerCurrentFrame) > $iDelay Then $iCurrentFrame += 1 $iTimerCurrentFrame = TimerInit() EndIf If $iCurrentFrame > UBound($aFrameDelays) - 1 Then $iCurrentFrame = 0 AdlibRegister("PlayAnimPreview", 10) EndFunc ;==>PlayAnimPreview ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2016-12-01 Func _BruceLee($bSaveBinary = False, $sSavePath = @ScriptDir) Local $BruceLee $BruceLee &= 'd7sAR0lGODlhgAAggAD1EAAAADs6ADp2VScvNEFTAFNTaGdn76lCAMieYezHUvzVAFj++Wruy5j6AOC5/PKz/OrRAP///09PTr1vAAPWrXJwcHBWAFRUY2NhYGBgAICAgKGhoeShADHypj75uU+wAFwj+79SblI6AHZ1bISCeY+PAI+wUyfYggywAI18kI2DvbCAGK2trQF4QQAh/wsATkVUU0NBUEUgMi4wAwEDElhNQFAgRGF0YQAHRQA/eHBhY2tldAAgYmVnaW49IgDvu78iIGlkPQAiVzVNME1wQwBlaGlIenJlUwB6TlRjemtjOQBkIj8+IDx4OgB4bXBtdGEgeOBtbG5zOn8qfyo/Ff8/FT8VPxU/FT8VPxWfCp8K/58KnwqfCp8KnwqfCp8Knwr/nwqfCp8KnwqfCp8KnwqfCg+fCp8KnwqICvkEBTIwABAALCHDAdwABgD/QIhwSCwajwDIpHLJbDqf0ACodEqtWq/YrAB2y+16v+CweABMLpvP6LR6zQBuu9/wuHxOrwDb73aAfs/X4wD/Q32CAIB4gwCHhIV0iIOKcgCHBQWMjm+QkgCIlGyMkQEBkQCRgplpmwWdnwCXfKJohwStBACdk6pmrK6wmACyZYyduwGHuAC5iLy2ob9jjADHe8XGyMfKYgCCDNHS09HEzgBf0NTa1tfYewAUFHoC4wJ64ACp3c/f4QDk5QAA58npYXwLCwADA/b2+Pbo8wDeevbl08dvgQC/f970LXDA0ACBQj8I1Sls6ABQH8SIYALqOwDA8cDDRBgTbgDs+DFkRgAKUwBaBGmSi0aVJQBbinTXj6X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B9awA1JWoYmAIkh5ZY/UBLgAJdU5pMWUjKWAEnUmfIV+UiQAFmC2GQqcOqYAOKVO0EVQQSHAPWZV5p4hlmhAEx7+uknoIYkADglAHvuScNhAIgKoihpjUbwAOif86l5w6QpAFSaTQqQZhqoAJcyLeopkEtiAOpmnqVS2uhGAKCStioRnDL6AOpmi87aYE+mAN6KW6i6bjpoAK+ONhVrrnPSAJpqr10WgaymAAeFWmyZsUa6AJOutJYGWu1/AMk2iK2m2/K4AESsxBXrrazdAArKZKfZnmvtALgqlNtugM+OAGqJqObSiy60AH7IS22q70IBAGi+YtR7znyLAP5rMEM0JXxlALjpChzvjMKuAGsvbjIGu5XFAMMgt3DB+14MAInHIWsBsKgSACN3Z4Z4EaysAMo7RhxDrC5nAIimyBlTbLN8ADvdvJOYO6+XAB/OxilL' $BruceLee &= '3IupAGQIAQQ0IcdvACUpLN30A0+/AMmtxklv5XPWAAECzTXGLIQAAAA7' $BruceLee = _WinAPI_Base64Decode($BruceLee) If @error Then Return SetError(1, 0, 0) Local $tSource = DllStructCreate('byte[' & BinaryLen($BruceLee) & ']') DllStructSetData($tSource, 1, $BruceLee) Local $tDecompress _WinAPI_LZNTDecompress($tSource, $tDecompress, 17546) If @error Then Return SetError(3, 0, 0) $tSource = 0 Local Const $bString = Binary(DllStructGetData($tDecompress, 1)) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\BruceLee_128x128.gif", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_BruceLee Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize) $tOutput = DllStructCreate("byte[" & $iBufferSize & "]") If @error Then Return SetError(1, 0, 0) Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0) If @error Then Return SetError(2, 0, 0) If $aRet[0] Then Return SetError(3, $aRet[0], 0) Return $aRet[6] EndFunc ;==>_WinAPI_LZNTDecompress It scales the GIF anim to factor 3.5.
    1 point
  47. argumentum

    Date/Time Pick coloring

    I really want to have this, so, it's a head start ( and example ) of coloring this control ( or part of it so far ) So don't be shy and pitch in #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <WindowsConstants.au3> #include <WinAPITheme.au3> #include <GuiMonthCal.au3> Global $g_hDTP1, $g_hDTP2, $g_idMemo Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("DateTimePick coloring test", 500, 300) $g_idMemo = GUICtrlCreateEdit("", 2, 62, 496, 266, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUICtrlSetData($g_idMemo, "MonthCal child handle will be created each time it pops up." & @CRLF & @CRLF, 1) $g_hDTP1 = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 185, 20)) $g_hDTP2 = _GUICtrlDTP_Create($hGUI, 2, 32, 240) GUICtrlCreateLabel("<-- now we need to find how to color", 195, 5, 500, 20) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("this part of the control", 280, 30, 500, 20) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Set the display format _GUICtrlDTP_SetFormat($g_hDTP1, "ddd MMM dd, yyyy hh:mm ttt") _GUICtrlDTP_SetFormat($g_hDTP2, "ddd MMM dd, yyyy hh:mm ttt") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") WinActivate("DateTimePick coloring test") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2, $iCtrl $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hDTP1, $g_hDTP2 Switch $iCode Case $NM_SETFOCUS _WinAPI_SetThemeAppProperties(0) _DebugPrint("$NM_SETFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) Case $NM_KILLFOCUS _WinAPI_SetThemeAppProperties(3) _DebugPrint("$NM_KILLFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) Case $DTN_DROPDOWN ; Sent by a date and time picker (DTP) control when the user activates the drop-down month calendar _DebugPrint("$DTN_DROPDOWN" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; The return value for this notification is not used ; Get month control child handle $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom) ;~ _WinAPI_SetWindowTheme($iCtrl, "", "") ; setting this here, does not change the size of the original canvas ;~ ; instead, for my simplicity, use _WinAPI_SetThemeAppProperties() OnFocus GUICtrlSetData($g_idMemo, "MonthCal child Handle: " & "0x" & Hex($iCtrl) & @CRLF, 1) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT, 0x8BD4DF) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK, 0xA9D7E4) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT, 0x005894) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK, 0x3F3F3F) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, 0xB2C2A9) Case $DTN_CLOSEUP ; Sent by a date and time picker (DTP) control when the user closes the drop-down month calendar _DebugPrint("$DTN_CLOSEUP" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; The return value for this notification is not used Case $DTN_DATETIMECHANGE ; Sent by a date and time picker (DTP) control whenever a change occurs $tInfo = DllStructCreate($tagNMDATETIMECHANGE, $lParam) _DebugPrint("$DTN_DATETIMECHANGE" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Flag:" & @TAB & DllStructGetData($tInfo, "Flag") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond")) Return 0 Case $DTN_FORMAT ; Sent by a date and time picker (DTP) control to request text to be displayed in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMAT, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) $tBuffer2 = DllStructCreate("char Display[64]", DllStructGetData($tInfo, "pDisplay")) _DebugPrint("$DTN_FORMAT" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->Display:" & @TAB & DllStructGetData($tBuffer2, "Display")) Return 0 Case $DTN_FORMATQUERY ; Sent by a date and time picker (DTP) control to retrieve the maximum allowable size of the string that will be displayed in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) _DebugPrint("$DTN_FORMATQUERY" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->SizeX:" & @TAB & DllStructGetData($tInfo, "SizeX") & @CRLF & _ "-->SizeY:" & @TAB & DllStructGetData($tBuffer2, "SizeY")) DllStructSetData($tInfo, "SizeX", 64) DllStructSetData($tInfo, "SizeY", 10) Return 0 Case $DTN_USERSTRING ; Sent by a date and time picker (DTP) control when a user finishes editing a string in the control $tInfo = DllStructCreate($tagNMDATETIMESTRING, $lParam) $tBuffer = DllStructCreate("char UserString[128]", DllStructGetData($tInfo, "UserString")) _DebugPrint("$DTN_USERSTRING" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->UserString:" & @TAB & DllStructGetData($tBuffer, "UserString") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags")) Return 0 Case $DTN_WMKEYDOWN ; Sent by a date and time picker (DTP) control when the user types in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) _DebugPrint("$DTN_WMKEYDOWN" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->VirtKey:" & @TAB & DllStructGetData($tInfo, "VirtKey") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond")) Return 0 Case Else _DebugPrint("$DTN_?????" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint Hopefully it'll turn into a UDF
    1 point
  48. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $UserNameInputGUI Global $Answer = _MsgBox() ; Or $Answer = _MsgBox($UserNameInputGUI) MsgBox(0, "What was Returned!", $Answer) Func _MsgBox($Handle = $UserNameInputGUI) ; <<<<< $UserNameInputGUI can be a Global Variable or you can pass it to the Function when it's called! Local $GUI, $ButtonNo, $ButtonYes $GUI = GUICreate("PLEASE VERIFY", 600, 270, -1, -1, 0, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("Is the User Info typed correctly?", 80, 16, 468, 33, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlCreateLabel("User Name:", 80, 65, 196, 33, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlCreateLabel("", 283, 65, 284, 33, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateLabel("AD Logon Account:", 80, 108, 196, 33, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlCreateLabel("", 283, 108, 284, 33, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $ButtonYes = GUICtrlCreateButton("Yes", 136, 168, 123, 41, $WS_GROUP) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") $ButtonNo = GUICtrlCreateButton("No", 311, 167, 123, 41, $WS_GROUP) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $ButtonYes GUIDelete($GUI) Return 1 Case $ButtonNo GUIDelete($GUI) GUISetState(@SW_SHOW, $Handle) Return 0 EndSwitch WEnd EndFunc ;==>_MsgBox But I would recommend looking at Melba23's post again, because he has a brilliant MsgBox UDF which has many custom options!
    1 point
  49. This is how to do it with the built-in UDF functions: #include <WinAPI.au3> #include <Misc.au3> Local $stPoint=DllStructCreate($tagPOINT),$aPos,$hControl,$hWin,$aLastPos[2]=[-1,-1],$sLastStr='',$sStr While Not _IsPressed('1B') $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='Window at '&$aPos[0]&','&$aPos[1]&': "'&WinGetTitle($hWin)&'"' If $sLastStr<>$sStr Then ToolTip($sStr,0,@DesktopHeight-20) $sLastStr=$sStr EndIf $aLastPos=$aPos EndIf Sleep(15) WEnd On a side note - I'd just like to add that _WinAPI_WindowFromPoint() was poorly thought out - it should take x,y coordinates instead of a structure.
    1 point
  50. #include <INet.au3> #include <String.au3> $favicon_url = 'http://www.filehippo.com' MsgBox(0, $favicon_url, $favicon_url & @crlf & @crlf & "Favicon extracted: " & get_favicon($favicon_url)) $favicon_url = 'http://www.theglobeandmail.com' MsgBox(0, $favicon_url, $favicon_url & @crlf & @crlf & "Favicon extracted: " & get_favicon($favicon_url)) $favicon_url = 'http://www.facebook.com' MsgBox(0, $favicon_url, $favicon_url & @crlf & @crlf & "Favicon extracted: " & get_favicon($favicon_url)) $favicon_url = 'http://delicious.com' MsgBox(0, $favicon_url, $favicon_url & @crlf & @crlf & "Favicon extracted: " & get_favicon($favicon_url)) Func get_favicon($favicon_page, $favicon_targetdir = @ScriptDir) $hDownload1 = InetGet($favicon_page & "/favicon.ico", $favicon_targetdir & "\favicon_" & StringReplace(StringReplace(StringReplace($favicon_page, ":", ""), "//", "_"), "http_www.", "") & ".ico") If Not FileExists($favicon_targetdir & "\favicon_" & StringReplace(StringReplace(StringReplace($favicon_page, ":", ""), "//", "_"), "http_www.", "") & ".ico") Then $source = _INetGetSource($favicon_page) $resultarray = _StringBetween($source, 'href="', '"') If IsArray($resultarray) Then For $i = 0 To UBound($resultarray) - 1 ConsoleWrite($resultarray[$i] & @CRLF) If StringInStr($resultarray[$i], ".ico") Then if StringLeft($resultarray[$i],"/") then $resultarray[$i] = $favicon_page & $resultarray[$i] $hDownload1 = InetGet($resultarray[$i], $favicon_targetdir & "\favicon_" & StringReplace(StringReplace(StringReplace($favicon_page, ":", ""), "//", "_"), "http_www.", "") & ".ico") ExitLoop EndIf Next EndIf EndIf If FileExists($favicon_targetdir & "\favicon_" & StringReplace(StringReplace(StringReplace($favicon_page, ":", ""), "//", "_"), "http_www.", "") & ".ico") Then Return True Else Return False EndIf EndFunc ;==>get_favicon Guess there's a better way to extract relative locations... Edit: Corrected For $i = 0 To UBound($resultarray) to For $i = 0 To UBound($resultarray) - 1 otherwise script will crash if no .ico was found in array
    1 point
×
×
  • Create New...