lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


My idea is that Lua script like a hook to the native GUI system.
There is a general hook function in Lua, OnWindowMessage(hwnd, msg_name,...)
There is also a general window procedure in C. It translates some
necessary window messages to Lua by calling OnWindowMessage.
We will subclass all created window to the general window procedure
and save old window procedure in window's user data field.
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)SubclassWindow(hwnd,
SubclassProc));

The window message will be forward to old window procedure unless
OnWindowMessage returns true.

Now, we call do something with OnWindowMessage.