Do not call us... We will call-back.
You are here: -> Main -> GUI API ->
PROC API_Window_Set_Callback STDCALL USES ecx,ebx,esi,edi ARG wnd_handle, call_type, lp_callback
This function setups the window's user mode callback.
Argument | Type | Description |
---|---|---|
wnd_handle | dword | HANDLE of the window who's callback to setup. |
call_type | dword |
What callback to execute |
lp_callback | dword |
Offset to user defined callback function. 0xffffffffh (-1) Means no function. |
Below is a sample callback suitable to be used as a template in your code.
PROC My_App_Callback STDCALL USES ebx,ecx,edx,esi,edi ARG wnd_handle, wnd_action, wnd_param1, wnd_param2 ;-------------------------------------- ; a case based on message/event value ;-------------------------------------- .IF [wnd_action] == ACT_PAINT_CHILD ;----------------------------- ; Wnd::On_Paint ; todo: add paint code here ;----------------------------- .ELSEIF [wnd_action] == ACT_LEFT_UP_CHILD ;----------------------------------- ; Wnd::ON_Mouse_Left_Down :) ; todo: add click code here ;----------------------------------- .ELSEIF [wnd_action] == ACT_KEY_CHILD ;----------------------------------- ; Wnd::ON_Key :) ; todo: add keyboard code here ;----------------------------------- .ELSEIF [wnd_action] == ACT_CLOSE_CHILD ;--------------------------- ;Wnd::Destructor ;todo:add release code here ;--------------------------- .ENDIF ;------------------------------------- ; by convention you should return zero ;------------------------------------- xor eax,eax ret ENDP
Please note that wnd_param1 and wnd_param2 depend on message/event type. For example:
However the wnd_handle and wnd_action parameters always exist and they always mean the same.
Theoretically you should not use OS_CALL_DEFAULT unless you really know what you are doing. Also OS_CALL_BEFORE is safe to use but was not troughly tested. OS_CALL_AFTER is pretty safe and tested a lot.
;---------------------------------- ; OS Known callbacks ;---------------------------------- OS_CALL_BEFORE EQU 1 OS_CALL_DEFAULT EQU 2 OS_CALL_AFTER EQU 3 OS_CALL_NOTIFY EQU 4