Synaps3 Posted 19 hours ago Posted 19 hours ago I've got a situation where I was writing and debugging my program for a long while. I got it to the point where everything was perfect and there were no bugs. Then I go to compile it to a 64-bit EXE...... aaaaand it's gone! The event no longer works. (Now I'm not 100% sure if the event is not firing or if an "if" statement or two are failing below it. I can test this a bit more tomorrow if the answer is not obvious and quick. Let's dig deeper... Here's the code snippet (I am not posting the whole thing): expandcollapse popup#include <WinApi.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> #include <Clipboard.au3> #include <Array.au3> #include <String.au3> #include <Misc.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <File.au3> GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_HANDLER") ; other code and stuff here ; ========================= Func WM_NOTIFY_HANDLER($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate("int;int;int", $lParam) Local $hwFrom = DllStructGetData($tNMHDR, 1) Local $code = DllStructGetData($tNMHDR, 3) Local $hListView = GUICtrlGetHandle($todoList) If $code = $NM_DBLCLK Then ; THIS PART DOES NOT EXECUTE ON 64-BIT EXE. WHY??? If $hwFrom = $hListView Then Local $index = _GUICtrlListView_GetSelectionMark($hListView) If $index <> -1 Then Local $oldText = _GUICtrlListView_GetItemText($hListView, $index) Local $newText = InputBox("Edit Task", "Double-click edit:", $oldText) If Not @error And StringStripWS($newText, 3) <> "" Then _GUICtrlListView_SetItemText($hListView, $index, $newText) _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE_USEHEADER) EndIf EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc
KaFu Posted 18 hours ago Posted 18 hours ago (edited) Try Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) instead. The NMHDR structure is not "int;int;int", but "struct; hwnd hWndFrom;uint_ptr IDFrom;INT Code; endstruct". Also don't use InputBox in the event, it must return as soon as possible. Try to relocate the complex part to your main loop, e.g. only set a trigger variable to true. Something like this: expandcollapse popupGlobal $b_Trigger_Event_Listview_NM_DBLCLK = False Global $hListView = GUICtrlGetHandle($todoList) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_HANDLER") While Sleep(10) If $b_Trigger_Event_Listview_NM_DBLCLK = True Then _Edit_Task() $b_Trigger_Event_Listview_NM_DBLCLK = False EndIf WEnd Func WM_NOTIFY_HANDLER($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hwFrom = DllStructGetData($tNMHDR, 1) Local $code = DllStructGetData($tNMHDR, 3) If $code = $NM_DBLCLK Then ; THIS PART DOES NOT EXECUTE ON 64-BIT EXE. WHY??? If $hwFrom = $hListView Then $b_Trigger_Event_Listview_NM_DBLCLK = True EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY_HANDLER Func _Edit_Task() Local $index = _GUICtrlListView_GetSelectionMark($hListView) If $index <> -1 Then Local $oldText = _GUICtrlListView_GetItemText($hListView, $index) Local $newText = InputBox("Edit Task", "Double-click edit:", $oldText) If Not @error And StringStripWS($newText, 3) <> "" Then _GUICtrlListView_SetItemText($hListView, $index, $newText) _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE_USEHEADER) EndIf EndIf EndFunc ;==>_Edit_Task Edited 18 hours ago by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
argumentum Posted 15 hours ago Posted 15 hours ago 3 hours ago, KaFu said: ... Also don't use InputBox in the event, it must return as soon as possible. ... ... If $code = $NM_DBLCLK Then ; THIS PART DOES NOT EXECUTE ON 64-BIT EXE. WHY??? If $hwFrom = $hListView Then ;~ $b_Trigger_Event_Listview_NM_DBLCLK = True AdlibRegister(_Edit_Task, 20) EndIf EndIf ... I use AdlibRegister(), and that frees the $WM_NOTIFY function. The main difference is that the code don't have to constantly evaluate in the main loop "are we there yet". 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