Search the Community
Showing results for tags '_winapi_setwindowlong'.
-
Function Reference _GUIRegisterMsgEx.au3 Register a user defined function for a known Windows Message ID (WM_MSG) to an individual ctrl using Call Back! Sintax: _GUICtrlMsg_Register( controlID, MsgID, "Function" ) _GUICtrlMsg_UnRegister( hWnd [, MsgID ]) Supports: ; AutoIt GUI controls to register message! Downloads: Version: 0.9b _GUIRegisterMsgEx_(RedirectLink).html Note: The functions have new parameters!, see fixes below! You can use this UDF in controls that consume internally specific Windows Message ID that we could not register with the GUIRegisterMsg function, eg: WM_CHAR, WM_KEYDOWN, WM_KEYUP are consumed by an edit control. Usage example is included! Sample: Fixes: I.e: Func _MyRegisterFunc( $hCtrlID, $iMsgID, $WParam, $LParam ) ;... EndFunc The 4 parameters have the following values: hCtrlID, The control handle in which the message is registered.iMsg, The Windows message ID.wParam, The first message parameter as hex value.lParam, The second message parameter as hex value. (Position. Parameter, Meaning) 0.9.0812.2600b09/09/2012 -> First release!I like to use UDFs, although I think this will not be very useful, I hope someone will find useful! Regards, João Carlos.
- 15 replies
-
- guiregistermsg
- dllcallbackregister
- (and 2 more)
-
Hey guys, I ran into a problem when I wanted to delete items of a listview using the delete key. My approach is to register my own WndProc for the listview and then filter the $WM_GETDLGCODE msg and then call the original WndProc. That works like a charm. The problem is that when the listview gets redrawn it somehow ends up in an infinite loop. The listview is suddenly emtpy and I can't interact with any controls of the GUI at all. Here's the code: #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <WinAPI.au3> $h_GUI = GUICreate("Test", 200, 200, 350, 350) $h_LV = GUICtrlCreateListView("Col 1|Col 2|Col 3", 0, 0, 200, 200) _GUICtrlListView_AddItem($h_LV, "") _GUICtrlListView_AddSubItem($h_LV, 0, "bla0", 0) _GUICtrlListView_AddSubItem($h_LV, 0, "bla0", 1) _GUICtrlListView_AddSubItem($h_LV, 0, "bla0", 2) _GUICtrlListView_AddItem($h_LV, "") _GUICtrlListView_AddSubItem($h_LV, 1, "bla1", 0) _GUICtrlListView_AddSubItem($h_LV, 1, "bla1", 1) _GUICtrlListView_AddSubItem($h_LV, 1, "bla1", 2) _GUICtrlListView_AddItem($h_LV, "") _GUICtrlListView_AddSubItem($h_LV, 2, "bla2", 0) _GUICtrlListView_AddSubItem($h_LV, 2, "bla2", 1) _GUICtrlListView_AddSubItem($h_LV, 2, "bla2", 2) _GUICtrlListView_AddItem($h_LV, "") _GUICtrlListView_AddSubItem($h_LV, 3, "bla3", 0) _GUICtrlListView_AddSubItem($h_LV, 3, "bla3", 1) _GUICtrlListView_AddSubItem($h_LV, 3, "bla3", 2) $h_LV_NewWndProc = DllCallbackRegister("WndProc_LV", "int", "hwnd;uint;wparam;lparam") $g_LV_OldWndProc = _WinAPI_SetWindowLong(GUICtrlGetHandle($h_LV), $GWL_WNDPROC, DllCallbackGetPtr($h_LV_NewWndProc)) GUISetState(@SW_SHOW) Func WndProc_LV($hWnd, $uMsg, $wParam, $lParam) Return _WinAPI_CallWindowProc($g_LV_OldWndProc, $hWnd, $uMsg, $wParam, $lParam) EndFunc ;==>WndProc_GUI Do Until GUIGetMsg() = $GUI_EVENT_CLOSE DllCallbackFree($h_LV_NewWndProc) As you can see I'm doing nothing in the WndProc of the listview. I'm simply calling the original WndProc. This still "freezes" when I mess with the width of the columns or in the original project when I add more items that they don't fit in the listview and I have to scroll. If I don't do that it's working fine.