Werty Posted March 14 Posted March 14 On 1/14/2024 at 8:55 AM, ioa747 said: ; Title...........: ShellTrayRefresh.au3 I doubt this will work with hidden taskbar. Some guy's script + some other guy's script = my script!
UEZ Posted April 6 Posted April 6 (edited) Get the binary type for exe / dll file. expandcollapse popup;Coded by UEZ build 2024-04-08 #AutoIt3Wrapper_UseX64 = y #include <WinAPIFiles.au3> #include <WinAPIProc.au3> Global $sFile = FileOpenDialog("Select a DLL file", "", "File (*.dll;*.exe)", $FD_FILEMUSTEXIST) If @error Then Exit MsgBox($MB_ICONINFORMATION, "File Binary Type", StringRegExpReplace($sFile, ".+\\(.+)", "$1") & " = " & _WinAPI_GetBinaryType2($sFile)) ; #FUNCTION# ==================================================================================================================== ; Author.........: UEZ ; Modified.......: ; =============================================================================================================================== Func _WinAPI_GetBinaryType2($sFile) Local Const $hFile = _WinAPI_CreateFile($sFile, 2, 2) If Not $hFile Or @error Then Return SetError(1, 0, 0) Local Const $hMapping = _WinAPI_CreateFileMapping($hFile, 0, Null, $PAGE_READONLY, Null) If Not $hMapping Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, 0) EndIf Local Const $pAddress = _WinAPI_MapViewOfFile($hMapping, 0, 0, $FILE_MAP_READ) If Not $pAddress Or @error Then __ReturnGBT2($hMapping, $hFile, 3) Local $aHeader = DllCall("Dbghelp.dll", "ptr", "ImageNtHeader", "ptr", $pAddress) If @error Or IsArray($aHeader) = 0 Then Return __ReturnGBT2($hMapping, $hFile, 4) Local $tIMAGE_NT_HEADERS = DllStructCreate("dword Signature;ptr FileHeader;ptr OptionalHeader;", $aHeader[0]) If @error Or Not IsDllStruct($tIMAGE_NT_HEADERS) Then Return __ReturnGBT2($hMapping, $hFile, 5) Local $tIMAGE_FILE_HEADER = DllStructCreate("word Machine;word NumberOfSections;dword TimeDateStamp;dword PointerToSymbolTable;dword NumberOfSymbols;word SizeOfOptionalHeader;word Characteristics;", DllStructGetPtr($tIMAGE_NT_HEADERS) + 4) If @error Or Not IsDllStruct($tIMAGE_FILE_HEADER) Then Return __ReturnGBT2($hMapping, $hFile, 6) __ReturnGBT2($hMapping, $hFile, 0) Switch $tIMAGE_FILE_HEADER.Machine Case 0x014c Return "x86" Case 0x0200 Return "Intel Itanium" Case 0x8664 Return "x64" Case Else Return "Error" EndSwitch EndFunc ;==>_WinAPI_GetBinaryType2 Func __ReturnGBT2($hMapping, $hFile, $iError) _WinAPI_CloseHandle($hMapping) _WinAPI_CloseHandle($hFile) If $iError Then Return SetError($iError, 0, 0) EndFunc ;==>__ReturnGBT2 Edited April 9 by UEZ small modifications argumentum, TheDcoder and ioa747 3 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Popular Post Nine Posted August 27 Popular Post Posted August 27 Wonder how to have a progress in your window task bar, here you go : expandcollapse popup#include <GUIConstantsEx.au3> Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" Global Const $sIID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}" Global Const $tagITaskbarList3 = _ "HrInit hresult();" & _ "AddTab hresult(hwnd);" & _ "DeleteTab hresult(hwnd);" & _ "ActivateTab hresult(hwnd);" & _ "SetActiveAlt hresult(hwnd);" & _ "MarkFullscreenWindow hresult(hwnd;boolean);" & _ "SetProgressValue hresult(hwnd;uint64;uint64);" & _ "SetProgressState hresult(hwnd;int);" & _ "RegisterTab hresult(hwnd;hwnd);" & _ "UnregisterTab hresult(hwnd);" & _ "SetTabOrder hresult(hwnd;hwnd);" & _ "SetTabActive hresult(hwnd;hwnd;dword);" & _ "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarSetImageList hresult(hwnd;ptr);" & _ "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _ "SetThumbnailTooltip hresult(hwnd;wstr);" & _ "SetThumbnailClip hresult(hwnd;ptr);" Example() Func Example() Local $hGUI = GUICreate("AutoIt v3", 400, 100) GUISetState() Local $oTaskBar = TB_Init() For $i = 1 To 100 TB_SetProgress($oTaskBar, $hGUI, $i, 100) Sleep(25) Next TB_Flash($oTaskBar, $hGUI, 4, 300) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example Func TB_Init() Local $oTB = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList3, $tagITaskbarList3) $oTB.HrInit() Return $oTB EndFunc ;==>TB_Init Func TB_SetProgress(ByRef $oTB, $hWnd, $iCurrent, $iCompleted) $oTB.SetProgressValue($hWnd, $iCurrent, $iCompleted) EndFunc ;==>TB_SetProgress Func TB_Flash(ByRef $oTB, $hWnd, $iTimes, $iDelay) For $i = 1 To $iTimes $oTB.SetProgressState($hWnd, 0) Sleep($iDelay) $oTB.SetProgressValue($hWnd, 100, 100) Sleep($iDelay) Next $oTB.SetProgressState($hWnd, 0) EndFunc ;==>TB_Flash argumentum, TheDcoder, seadoggie01 and 3 others 3 3 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
argumentum Posted August 28 Posted August 28 2 hours ago, Nine said: Wonder how to have a progress in your window task bar, here you go ... Local $oTaskBar = TB_Init() $oTaskBar.SetThumbnailTooltip($hGUI, "1st line" & @CRLF & "2nd line") ... would you post an example for each in the $tag ? ( that'd be super cool ) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted August 28 Posted August 28 55 minutes ago, argumentum said: would you post an example for each in the $tag ? nope “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
TheDcoder Posted August 28 Posted August 28 6 hours ago, Nine said: Wonder how to have a progress in your window task bar Is that even a thing in Windows 11 anymore? I used to love those effects in Windows 7 (Ah the nostalgia) EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
argumentum Posted August 28 Posted August 28 11 minutes ago, TheDcoder said: Is that even a thing in Windows 11 anymore? Win10 - Win11 I like the Win10 better. TheDcoder 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
seadoggie01 Posted August 28 Posted August 28 Expanding on Nine's task bar adventures... The overlay icon and tooltip were the only other interesting task bar things to me, so I added those + examples expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIIcons.au3> ; For _WinAPI_DestroyIcon #include <WinAPIShellEx.au3> ; For _WinAPI_ShellExtractIcon Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" Global Const $sIID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}" Global Const $tagITaskbarList3 = _ "HrInit hresult();" & _ "AddTab hresult(hwnd);" & _ "DeleteTab hresult(hwnd);" & _ "ActivateTab hresult(hwnd);" & _ "SetActiveAlt hresult(hwnd);" & _ "MarkFullscreenWindow hresult(hwnd;boolean);" & _ "SetProgressValue hresult(hwnd;uint64;uint64);" & _ "SetProgressState hresult(hwnd;int);" & _ "RegisterTab hresult(hwnd;hwnd);" & _ "UnregisterTab hresult(hwnd);" & _ "SetTabOrder hresult(hwnd;hwnd);" & _ "SetTabActive hresult(hwnd;hwnd;dword);" & _ "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _ "ThumbBarSetImageList hresult(hwnd;ptr);" & _ "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _ "SetThumbnailTooltip hresult(hwnd;wstr);" & _ "SetThumbnailClip hresult(hwnd;ptr);" Example() Func Example() Local $hGUI = GUICreate("AutoIt v3", 400, 100) GUISetState() Local $oTaskBar = TB_Init() TB_ToolTip($oTaskBar, $hGUI, "Working...") ; Load an icon -- this is a blue refresh on Win11 Local $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & "\shell32.dll", 238, 32, 32) TB_SetOverlayIcon($oTaskBar, $hGUI, $hIcon, "Blue refresh") For $i = 1 To 100 TB_SetProgress($oTaskBar, $hGUI, $i, 100) Sleep(25) Next ; Destroy the old icon _WinAPI_DestroyIcon($hIcon) Local $hSecondIcon = _WinAPI_ShellExtractIcon(@SystemDir & "\shell32.dll", 300, 32, 32) TB_SetOverlayIcon($oTaskBar, $hGUI, $hSecondIcon, "Green checkmark") TB_Flash($oTaskBar, $hGUI, 4, 300) TB_ToolTip($oTaskBar, $hGUI, "Waiting for you to close the window") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Clear the icon overlay TB_SetOverlayIcon($oTaskBar, $hGUI, Null) _WinAPI_DestroyIcon($hSecondIcon) EndFunc ;==>Example Func TB_Init() Local $oTB = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList3, $tagITaskbarList3) $oTB.HrInit() Return $oTB EndFunc ;==>TB_Init Func TB_SetProgress(ByRef $oTB, $hWnd, $iCurrent, $iCompleted) $oTB.SetProgressValue($hWnd, $iCurrent, $iCompleted) EndFunc ;==>TB_SetProgress Func TB_Flash(ByRef $oTB, $hWnd, $iTimes, $iDelay) For $i = 1 To $iTimes $oTB.SetProgressState($hWnd, 0) Sleep($iDelay) $oTB.SetProgressValue($hWnd, 100, 100) Sleep($iDelay) Next $oTB.SetProgressState($hWnd, 0) EndFunc ;==>TB_Flash ; These are icons added to your taskbar icon, showing status usually. Each window only gets 1. Set $hIcon to NULL to clear. ; (Win11) Teams uses this to show your status (busy, free, inactive) and Outlook uses it to show if you have an unread email Func TB_SetOverlayIcon(ByRef $oTB, $hWnd, $hIcon, $sAltText = "") $oTB.SetOverlayIcon($hWnd, $hIcon, $sAltText) EndFunc ;==>TB_SetOverlayIcon ; Depending on settings and version, this may be difficult to see. On Win11 with taskbar previews, it is only visible after hovering over the preview window. Func TB_ToolTip(ByRef $oTB, $hWnd, $sTooltip) $oTB.SetThumbnailTooltip($hWnd, $sTooltip) EndFunc ;==>TB_ToolTip argumentum, Andreik, Nine and 1 other 4 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
Nine Posted August 30 Posted August 30 If you want to modify the appearance of any blocking functions, here one way : #include <WindowsConstants.au3> #include <WinAPISys.au3> OnAutoItExitRegister(OnAutoItExit) Global $hForm = GUICreate('Example') GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), WM_SHELLHOOK) _WinAPI_RegisterShellHookWindow($hForm) MsgBox($MB_OK, "MsgBox", "Message") InputBox("InputBox", "Prompt") FileOpenDialog("FileOpenDialog", @ScriptDir, "au3 (*.au3)") Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) If $wParam <> $HSHELL_WINDOWCREATED Then Return Switch WinGetTitle($lParam) Case "MsgBox" ControlSetText($lParam, "", "Static1", "Cool Stuff") ControlSetText($lParam, "", "Button1", "New") Case "InputBox" Local $hCtrl = ControlGetHandle($lParam, "", "Edit1") Local $hFont = _WinAPI_CreateFont(16, 0, 0, 0, 600) _SendMessage($hCtrl, $WM_SETFONT, $hFont, False) _WinAPI_DeleteObject($hFont) Case "FileOpenDialog" ControlHide($lParam, "", "Button2") EndSwitch EndFunc ;==>WM_SHELLHOOK Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($hForm) EndFunc ;==>OnAutoItExit pixelsearch and argumentum 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
argumentum Posted October 28 Posted October 28 (edited) ConsoleWrite('--- ProcessStartDate: ' & ProcessStartDate('SciTE.exe') & @CRLF) ; --- ProcessStartDate: 2024/10/28 09:45:50 Func ProcessStartDate($sProcessOrPID, $iRet_tSYSTEMTIME = 0, $iLocalTime = 0) Local $aFT, $tFT, $tST, $iID = ProcessExists($sProcessOrPID) If $iID Then ; https://www.autoitscript.com/forum/index.php?showtopic=139260&view=findpost&p=1538034 $aFT = _WinAPI_GetProcessTimes($iID) If @error Or UBound($aFT) <> 3 Then Return SetError(@error, _WinAPI_GetLastError(), "GetProcessTimes FAILED") $tST = _Date_Time_FileTimeToSystemTime($iLocalTime ? _Date_Time_FileTimeToLocalFileTime($aFT[0]) : $aFT[0]) If $iRet_tSYSTEMTIME Then Return $tST Return _Date_Time_SystemTimeToDateTimeStr($tST, 1) EndIf Return SetError(11, 0, "Process does not exist") EndFunc ;==>ProcessStartDate I have a bunch of RDP running and wanted to identify which is which and thought of the Process date and PID, to know that the given process was from X connection because when it disconnects the popup window does not have any info. in regards to what disconnected ... , am working on it. And thought that the function was a good snippet to share. Edited October 28 by argumentum TheDcoder, SOLVE-SMART and robertocm 3 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
argumentum Posted November 29 Posted November 29 (edited) Report_GetDriveSpaceFree() Func Report_GetDriveSpaceFree($sDrive = "C:\", $iLine = @ScriptLineNumber) ; how I use it in my project Local $iFree = GetDriveSpaceFree($sDrive), $iTotal = @extended, $iError = @error, $iUsed = $iTotal - $iFree ConsoleWriteDebug(($iFree < 10 ? "!" : "+") & " DriveSpaceFree(" & $sDrive & "): " & $iFree & ' GB free of ' & $iTotal & ' GB total (Used: ' & $iUsed & ' GB)(Error: ' & $iError & ').' & @CRLF, $iLine) EndFunc ;==>Report_GetDriveSpaceFree Func GetDriveSpaceFree($sDrive = "C:\") ; in GB Local $iError = 0, $iFree = DriveSpaceFree($sDrive) $iError += @error ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1538974 Local $iTotal = DriveSpaceTotal($sDrive) $iError += @error Return SetError($iError, Int($iTotal / 1024), Int($iFree / 1024)) EndFunc ;==>GetDriveSpaceFree Func ConsoleWriteDebug($sStr = @CRLF, $iLine = @ScriptLineNumber, $iError = @error, $iExtended = @extended) Local $iRet = ConsoleWrite("@@ Debug (" & $iLine & ") : " & $sStr & (StringRight($sStr, 2) = @CRLF ? "" : @CRLF)) Return SetError($iError, $iExtended, $iRet) ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1538974 EndFunc ;==>ConsoleWriteDebug I needed GetDriveSpaceFree() for a project and ConsoleWriteDebug() is a good idea. ..and, code to add the @ScriptLineNumber to your main script. Edited December 5 by argumentum more Decibel and ioa747 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted December 15 Posted December 15 Owner Draw Combo Box with default $CBS_DROPDOWN. Not so obvious as it seems. expandcollapse popup#include <WinAPIConv.au3> #include <WinAPIGdi.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <GuiComboBox.au3> Opt("MustDeclareVars", True) Global Const $tagDRAWITEMSTRUCT = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;hwnd hwndItem;handle hDC;dword rcItem[4];ptr itemData" Global Const $ODA_DRAWENTIRE = 1 Global Const $ODS_SELECTED = 1 Global $idCombo Example() Func Example() GUICreate("Owner Draw", 300, 200) $idCombo = GUICtrlCreateCombo("", 10, 10, 185, 20, BitOR($CBS_HASSTRINGS, $CBS_OWNERDRAWFIXED, $GUI_SS_DEFAULT_COMBO)) Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetData($idCombo, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17") GUISetState() Local $aAccelKeys[1][2] = [["{ENTER}", $idCombo]] GUISetAccelerators($aAccelKeys) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUIRegisterMsg($WM_DRAWITEM, WM_DRAWITEM) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $idCtrl = _WinAPI_LoWord($wParam), $iCode = _WinAPI_HiWord($wParam) If $idCtrl = $idCombo And ($iCode = $CBN_KILLFOCUS Or $iCode = $CBN_SELCHANGE) Then Validate($idCtrl) Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func Validate($idComboBox) Local Static $sSelection Local $sComboRead = GUICtrlRead($idComboBox) If $sSelection = $sComboRead Then Return Local $iList = _GUICtrlComboBox_FindStringExact($idComboBox, $sComboRead) If $iList = -1 Then GUICtrlSendMsg($idComboBox, $CB_SETCURSEL, -1, 0) $sSelection = "" ConsoleWrite("Invalid data" & @CRLF) Else $sSelection = $sComboRead ConsoleWrite("Currently displaying: " & $sComboRead & @CRLF) If _GUICtrlComboBox_GetCurSel($idComboBox) = -1 Then _GUICtrlComboBox_SetCurSel($idComboBox, $iList) EndIf EndFunc ;==>Validate Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) If $wParam <> $idCombo Then Return $GUI_RUNDEFMSG Local $tDraw = DllStructCreate($tagDRAWITEMSTRUCT, $lParam), $sText If $tDraw.itemAction = $ODA_DRAWENTIRE Then Local $tRECT = DllStructCreate($tagRECT, DllStructGetPtr($tDraw, "rcItem")) Local $hBrush = _WinAPI_CreateSolidBrush(BitAND($tDraw.itemState, $ODS_SELECTED) ? 0xFFCDAD : Mod($tDraw.itemID, 2) ? 0xFFFFFF : 0xE0E0E0) _WinAPI_FillRect($tDraw.hDC, $tRECT, $hBrush) $tRECT.Left += 5 $tRECT.Top += 2 _GUICtrlComboBox_GetLBText($tDraw.hwndItem, $tDraw.itemID, $sText) _WinAPI_DrawText($tDraw.hDC, $sText, $tRECT, $DT_LEFT) _WinAPI_DeleteObject($hBrush) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM Note : you can tab, enter, up arrow, down arrow to validate the combo input field. Musashi, ioa747, argumentum and 1 other 4 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
MattyD Posted December 16 Posted December 16 (edited) Hi all - here's a quick example of how you can "hit test" controls under the mouse. You can't directly handle WM_NCHITTEST with GuiRegisterMessage() - controls don't pass this message on to the parent. We can directly grab messages from a control however, as long as we send them to the old handler when we're done. Note: for buttons I *think* you can use WM_MOUSEHOVER via a traditional GUIRegisterMessage, which is obviously a better option - but this will work with labels etc... Edit: oops I guess I was a little too hasty here! - this looks to brake stuff. I'll update the post if I find a solution... Fixed!! #include <guiConstants.au3> #include <winapi.au3> Global $hGui = GUICreate("", 200, 100) Global $hBtn = GUICtrlCreateButton("Test", 4, 4, 80, 80) Global $hBtnProc = DllCallbackRegister("ButtonProc", "long", "hwnd;uint;wparam;lparam") Global $pOrigBtnProc = _WinAPI_GetWindowLong(GUICtrlGetHandle($hBtn), $GWL_WNDPROC) _WinAPI_SetWindowLong(GUICtrlGetHandle($hBtn), $GWL_WNDPROC, DllCallbackGetPtr($hBtnProc)) GUISetState() while 1 $Msg = GUIGetMsg(1) Switch $Msg[0] Case $GUI_EVENT_CLOSE Exit Case $hBtn ConsoleWrite("Clicked" & @CRLF) EndSwitch wend Func ButtonProc($hWnd, $uMsg, $wParam, $lParam) Switch $uMsg Case $WM_NCHITTEST ConsoleWrite(StringFormat("Button Hit. Mouse:[%d,%d]\r\n", BitAND($lParam, 0xFFFF), BitShift($lParam, 16))) EndSwitch Local $aRet = DllCallAddress("long", $pOrigBtnProc, "hwnd", $hWnd, "uint", $uMsg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc Edited December 16 by MattyD ioa747 1
argumentum Posted Tuesday at 03:08 AM Posted Tuesday at 03:08 AM (edited) Case $WM_NCHITTEST ; https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest ConsoleWrite(StringFormat("Button Hit. Mouse:[%d,%d]\r\n", BitAND($lParam, 0xFFFF), BitShift($lParam, 16))) Case $WM_MOUSELEAVE ; https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mouseleave ConsoleWrite(StringFormat("Button Left") 0x02A3 is magic WM_MOUSELEAVE ..it was defined Edited Tuesday at 03:26 AM by argumentum found it MattyD 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now