
2. How can i find out the function adress of the current callback

THX sverson
Code: Select all
GetWindowLong_(WindowID(#win), #GWL_WNDPROC))
Thanks!Just added this to the manual.To remove/disable a previous set Callback just call SetWindowCallback(0) again.
Today this sentence is incomplete: The 0 is used to cancel the CallBack procedure address pointer, but with the v4, it is also necessary to specify the targeted window.Andre wrote:Just added this to the manual.To remove/disable a previous set Callback just call SetWindowCallback(0) again.
Code: Select all
Procedure.l WinProc(hWnd,Msg,wParam,lParam)
result = #PB_ProcessPureBasicEvents
Select Msg
Case #WM_NOTIFY
Debug "call : clic column"
*NMHDR.NMHDR = lParam
If *NMHDR\hWndFrom = GadgetID(1)
If *NMHDR\code = #LVN_COLUMNCLICK
*NMLV.NMLISTVIEW = lParam
column = *NMLV\iSubItem
Debug "call: clic on column : "+Str(column)
EndIf
EndIf
EndSelect
ProcedureReturn result
EndProcedure
#Window = 10
OpenWindow(#Window, 0, 0, 300, 300, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
CreateGadgetList(WindowID(#Window))
ListIconGadget(1,10,10,280,200,"col1",50)
For i=1 To 4
AddGadgetColumn(1, i,Str(i),50)
Next
For i=1 To 4
AddGadgetItem(1, i,Str(i))
Next
; SetWindowCallback(@WinProc())
SetWindowCallback(@WinProc(), #Window)
SetWindowCallback(0)
; SetWindowCallback(0, #Window)
Repeat
event = WaitWindowEvent()
Select event
Case #WM_NOTIFY
Debug "pure : clic column"
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Debug "pure :clic on list"
Debug EventlParam()
Debug EventwParam()
EndSelect
EndSelect
Until event = #WM_CLOSE