Message board for the users of flat assembler.
> Windows > User message handling without subclassing.
Just now I am playing with Fresh library in order to make it more consistent and modular. So, some of the visually created windows have to have user defined procedures for message handling and also, have to support some advanced features as auto alignment/autosize, fonts inheriting, etc.
The main idea is to make all this without subclassing the windows. The approach I am trying is to use API functions: "GetProp" and "SetProp".
The idea is to use:
invoke SetProp, [.hwnd], propUserWinProc, [ptrToUserWindowProcedure]
And instead of setting GWL_WINPROC using SetWindowLong to call user procedure directly from the main message loop:
.translate: invoke TranslateMessage, esi ; So, standard processing. invoke GetProp, [esi+MSG.hwnd], propUserWinProc test eax, eax jz .default ; there is no user procedure... ; call user procedure if any... push esi edi ebx mov ebx, [esi+MSG.message] stdcall eax, [esi+MSG.hwnd], ebx, [esi+MSG.wParam], [esi+MSG.lParam] pop ebx edi esi jnc .msg_loop .default: invoke DispatchMessage, esi jmp .msg_loop
What you think about this kind of approach? Is there some problems I am missing?
Any opinions are welcome.
The simple test example works fine with this approach. The full example code is attached.
P.S. There is small problem with autoalign windows, but it is not related with the user message handling. I will fix it later.
|01 Sep 2004, 23:14||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.