background color for winapi window
-
Hi,
Can you tell me how to set the background color of a winapi window?
I've figured out that I can change the standard window background color with the following code:-local mywin = winapi.Window{ title = "GARRY'S", background = winapi.ffi.cast('HBRUSH', 10), w = 600, h = 400, x=500, y=200, autoquit = true, }
but I would a more general method that would allow any color such as:-
background = 0xff0000 -- for a red backgroundAny clues?
Thanks,
Garry.
-
How about
background = winapi.CreateSolidBrush(winapi.RGB(255, 0, 0))
?[btw, if your app is winapi-heavy, might as well work in the winapi namespace directly:
setfenv(1, require'winapi')
]
-
Perfect! Thanks for the quick response.
-
Glad I could help. You probably noticed that docs are thin on winapi, so feel free to bug me with questions or tell me your experience with it, or with anything luapower really :)
Eg. you could nag me to write method-by-method docs if you think it's worth it. I'm not sure how much they are needed once you get the hang of it. OTOH I also don't know how many people bailed out on it because of that :)
-
The lack of docs doesn't bother me too much. The showcase examples provide a good starting point, and I'm happy to nut things out for myself if I can (I'm retired and have plenty of time on my hands).
Thanks for the offer of further help. I'm sure I'll need it in the near future :)