Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/01/2024 in all areas

  1. The error is in _WM_NOTIFY_DebugEvent() because the calling process does not have read access to the specified range of memory. It's pretty easy to check with _WinAPI_IsBadReadPtr() after $tInfo is created and it will return true. This happens because lParam in WM_COMMAND is a handle to the control window but in _GUICtrlButton_SetSplitInfo() example it's passed as a pointer to a NMHDR structure. $sText = "Text=" & _GUICtrlButton_GetText($hCtrl) _WM_NOTIFY_DebugEvent($sCode, $tagNMHDR, $lParam, "IDFrom", $sText) ; <<< ---- This line Return 0 ; Only workout clicking on the button Edit: just use GUIRegisterMsg() by yourself without this extra library (WM_NOTIFY.au3) and everything works as expected #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <WindowsConstants.au3> Global $g_hBtn, $g_idMemo, $g_hBtn2 ; Note: The handle from these buttons can NOT be read with GUICtrlRead Example() Func Example() Local $hGUI = GUICreate("Button Set SplitInfo (v" & @AutoItVersion & ")", 400, 400) $g_idMemo = GUICtrlCreateEdit("", 10, 100, 390, 284, $WS_VSCROLL) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") $g_hBtn = _GUICtrlButton_Create($hGUI, "Split Button", 10, 10, 120, 30, $BS_SPLITBUTTON) _GUICtrlButton_SetSplitInfo($g_hBtn) $g_hBtn2 = _GUICtrlButton_Create($hGUI, "Split Button 2", 10, 50, 120, 30, $BS_SPLITBUTTON) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) Local $aInfo = _GUICtrlButton_GetSplitInfo($g_hBtn) MemoWrite("Split Info" & @CRLF & "----------------") For $x = 0 To 3 MemoWrite("$ainfo[" & $x & "] = " & $aInfo[$x]) Next MemoWrite("Split Info" & @CRLF & "----------------") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local Const $BCN_HOTITEMCHANGE = -1249 Local $tagNMBHOTITEM = $tagNMHDR & ";dword dwFlags" Local $tNMBHOTITEM = DllStructCreate($tagNMBHOTITEM, $lParam) Local $iCode = DllStructGetData($tNMBHOTITEM, "Code") Local $hWndFrom = DllStructGetData($tNMBHOTITEM, "hWndFrom") Local $iFlags = DllStructGetData($tNMBHOTITEM, "dwFlags") Local $sText = "" Switch $iCode Case $BCN_HOTITEMCHANGE ; Win XP and Above $sText = "Text=" & _GUICtrlButton_GetText($hWndFrom) If BitAND($iFlags, 0x10) = 0x10 Then ConsoleWrite('BCN_HOTITEMCHANGE - Entering' & @CRLF) ;~ _WM_NOTIFY_DebugEvent("$BCN_HOTITEMCHANGE - Entering", $tagNMBHOTITEM, $lParam, "IDFrom", $sText) ElseIf BitAND($iFlags, 0x20) = 0x20 Then ConsoleWrite('BCN_HOTITEMCHANGE - Leaving' & @CRLF) ;~ _WM_NOTIFY_DebugEvent("$BCN_HOTITEMCHANGE - Leaving", $tagNMBHOTITEM, $lParam, "IDFrom", $sText) EndIf Case $BCN_DROPDOWN MemoWrite("$BCN_DROPDOWN") _Popup_Menu($hWndFrom) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _Popup_Menu($hCtrl) Local $hMenu Local Enum $e_idOpen = 1000, $e_idSave, $e_idInfo $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hCtrl, -1, -1, 1, 1, 2) Case $e_idOpen MemoWrite("Open - Selected") Case $e_idSave MemoWrite("Save - Selected") Case $e_idInfo MemoWrite("Info - Selected") EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndFunc ;==>_Popup_Menu ; React on a button click Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $iCode = BitShift($wParam, 16) Local $hCtrl = $lParam Local $sCode, $sText Switch $hCtrl Case $g_hBtn, $g_hBtn2 Switch $iCode Case $BN_CLICKED $sCode = "$BN_CLICKED" Case $BN_PAINT $sCode = "$BN_PAINT" Case $BN_PUSHED $sCode = "$BN_PUSHED" Case $BN_HILITE $sCode = "$BN_HILITE" Case $BN_UNPUSHED $sCode = "$BN_UNPUSHED" Case $BN_UNHILITE $sCode = "$BN_UNHILITE" Case $BN_DISABLE $sCode = "$BN_DISABLE" Case $BN_DBLCLK $sCode = "$BN_DBLCLK" Case $BN_DOUBLECLICKED $sCode = "$BN_DOUBLECLICKED" Case $BN_SETFOCUS $sCode = "$BN_SETFOCUS" Case $BN_KILLFOCUS $sCode = "$BN_KILLFOCUS" EndSwitch $sText = "Text=" & _GUICtrlButton_GetText($hCtrl) ConsoleWrite($sText & @CRLF) ;~ _WM_NOTIFY_DebugEvent($sCode, $tagNMHDR, $lParam, "IDFrom", $sText) Return 0 ; Only workout clicking on the button EndSwitch ; Proceed the default AutoIt3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default AutoIt3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
    2 points
  2. AutoIt3.exe ended.rc:-1073740771 Same error, I'm gonna take a nap before I look...
    2 points
  3. @jpm, please take a look at https://www.autoitscript.com/forum/topic/211745-_guictrlbutton_setsplitinfo/?do=findComment&comment=1532380 The example for _GUICtrlButton_SetSplitInfo() crashes.
    1 point
  4. Andreik

    ePUB Reader

    New version available. Fixed a small bug in UpdateSlider().
    1 point
  5. @laohacbancho37 It's possible that _WD_ConsoleVisible is no longer working following an update to Chromedriver. Anyone else seeing this? The workaround by @Danyfirex will stop the webdriver console from being shown at all.
    1 point
  6. When you post code, please use the method described in the link. You can edit your post with the ... in the upper right corner of your post. The problem is that you have 2 ProgressOn statements. Remove the second, should work.
    1 point
  7. Jury

    _GUICtrlButton_SetSplitInfo

    Works fine for me : ----------------------------- WM_NOTIFY - Infos: ----------------------------- Code :-1249 CtrlID :10001 CtrlHWnd:0x000308F2 Split Button 2 $BCN_HOTITEMCHANGE - Leaving: ----------------------------- WM_NOTIFY - Infos: ----------------------------- Code :-1249 CtrlID :10001 CtrlHWnd:0x000308F2 Split Button 2.... ------------------------------------- Split Info ---------------- $ainfo[0] = 0x00000036 $ainfo[1] = 4 $ainfo[2] = 15 $ainfo[3] = 0 Split Info ---------------- $BCN_HOTITEMCHANGE - Entering: ----------------------------- WM_NOTIFY - Infos: ----------------------------- Code :-1249 CtrlID :10001 CtrlHWnd:0x000308F2 Split Button 2....
    1 point
  8. check option #4 I added IsWinOverWin($hWnd1, $hWnd2)
    1 point
  9. AlmarM

    Password Generator

    I improved my older password generator. Global Const $CHR_AZ_LOW = StringLower("abcdefghijklmnopqrstuvwxyz") Global Const $CHR_AZ_UP = StringUpper("ABCDEFGHIJKLMNOPQRSTUVWXYZ") Global Const $CHR_NUMBERS = "0123456789" Global $sUseCharacters = $CHR_AZ_LOW $hWnd = GUICreate("Password Generator.", 460, 175) GUICtrlCreateGroup("Options", 10, 10, 280, 75) GUICtrlCreateLabel("Password length:", 20, 30) $hPasswordLength = GUICtrlCreateInput(8, 130, 27, 40) $hUpDown = GUICtrlCreateUpDown($hPasswordLength) GUICtrlCreateLabel("Characters:", 20, 53) $hCharacters = GUICtrlCreateCombo("a-z", 130, 50, 150, 20, 0x0003) $hCurrentSequence = GUICtrlCreateLabel("Hover me to see your current sequence.", 10, 90, 280) $hGenerate = GUICtrlCreateButton("Generate", 10, 110, 135, 25) $hClearHistory = GUICtrlCreateButton("Clear history", 155, 110, 135, 25) $hPassword = GUICtrlCreateInput("", 10, 145, 280, 20) $hHistory = GUICtrlCreateEdit("", 300, 10, 150, 155, BitOR(0x0800, 0x0040, 0x00200000)) GUICtrlSetData($hCharacters, "A-Z|0-9|a-z, A-Z|a-z, 0-9|A-Z, 0-9|a-z, A-Z, 0-9|< User defined ... >", "a-z") GUICtrlSetLimit($hUpDown, 99, 1) GUICtrlSetTip($hCurrentSequence, $sUseCharacters) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $hCharacters $sRead = GUICtrlRead($hCharacters) If ($sRead == "a-z") Then $sUseCharacters = $CHR_AZ_LOW ElseIf ($sRead == "A-Z") Then $sUseCharacters = $CHR_AZ_UP ElseIf ($sRead == "0-9") Then $sUseCharacters = $CHR_NUMBERS ElseIf ($sRead == "a-z, A-Z") Then $sUseCharacters = $CHR_AZ_LOW & $CHR_AZ_UP ElseIf ($sRead == "a-z, 0-9") Then $sUseCharacters = $CHR_AZ_LOW & $CHR_NUMBERS ElseIf ($sRead == "A-Z, 0-9") Then $sUseCharacters = $CHR_AZ_UP & $CHR_NUMBERS ElseIf ($sRead == "a-z, A-Z, 0-9") Then $sUseCharacters = $CHR_AZ_LOW & $CHR_AZ_UP & $CHR_NUMBERS ElseIf ($sRead == "< User defined ... >") Then $sUseCharacters = InputBox("Password Generator.", "Enter a character sequence.", "abcABC123!@#", "", 200, 100) EndIf GUICtrlSetTip($hCurrentSequence, $sUseCharacters) Case $hGenerate $sPassword = _GeneratePassword(GUICtrlRead($hPasswordLength), $sUseCharacters) GUICtrlSetData($hPassword, $sPassword) GUICtrlSetData($hHistory, $sPassword & @CRLF, "|") Case $hClearHistory GUICtrlSetData($hHistory, "") EndSwitch WEnd Func _GeneratePassword($iLength, $sSequence) Local $sResult Local $aSplit = StringSplit($sSequence, "", 2) For $i = 1 To $iLength $sResult &= $aSplit[Random(0, UBound($aSplit) - 1, 1)] Next Return $sResult EndFunc
    1 point
×
×
  • Create New...