Search the Community
Showing results for tags '_winapi_defsubclassproc'.
-
_WinAPI_DefSubclassProc not working properly
BBs19 posted a topic in AutoIt General Help and Support
Hi guys, I ran into a problem with _WinAPI_DefSubclassProc. It seems like it is not properly calling the next handler as it should. The below example is from the help file but with a Tab + Listview. When you switch between the tabs, the listview dissapears/is not painted properly. Only when you move over it with the mouse it appears back. Something is not properly handled here. Is there something wrong the way I use it or the way it is used in the help file? Shouldn't _WinAPI_DefSubclassProc call the needed handlers so that everything works as it should? #include <WinAPIShellEx.au3> #include <GUIConstantsEx.au3> #include <GuiComboBox.au3> #include <ListViewConstants.au3> OnAutoItExitRegister('OnAutoItExit') ; Create GUI Global $g_hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()')) ; Register DLL callback that will be used as window subclass procedure Global $g_hDll = DllCallbackRegister('_SubclassProc', 'lresult', 'hwnd;uint;wparam;lparam;uint_ptr;dword_ptr') Global $g_pDll = DllCallbackGetPtr($g_hDll) GUISetFont(12, 0, 0, "Segoe UI") GUICtrlCreateTab(0, 50, 989, 574) GUICtrlCreateTabItem("Search") GUICtrlCreateListView("a|a|a|a|a|a|a", 5, 109, 981, 540) ; GUICtrlCreateTabItem("Data Entry") GUICtrlCreateListView("b|b|b|b|b|b|b", 5, 109, 981, 540) ; GUISetState(@SW_SHOW) ; Install window subclass callback _WinAPI_SetWindowSubclass($g_hForm, $g_pDll, 1000, 0) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _SubclassProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData) #forceref $iID, $pData ;Do stuff.... Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_SubclassProc Func OnAutoItExit() _WinAPI_RemoveWindowSubclass($g_hForm, $g_pDll, 1000) DllCallbackFree($g_hDll) EndFunc ;==>OnAutoItExit