Binding win32 window to a D class
Dune
not.yet at yahoo.com
Tue Dec 26 14:05:37 PST 2006
== Quote from freeagle (freeagle at inmail.sk)'s article
> the second approach, without the need for get/setPtr:
> class Windows
> {
> static Window[HWND] _windows;
> .
> .
> .
> int windowProc(HWND hwnd, uint message, WPARAM wParam, LPARAM lParam)
> {
> .
> .
> .
> }
> }
> extern(Windows)
> int
> wndProc(HWND hwnd, uint message, WPARAM wParam, LPARAM lParam)
> {
> Window* wnd = hwnd in Window._windows;
> if(wnd !is null)
> {
> return wnd.windowProc(hwnd, message, wParam, lParam);
> }
> else
> {
> return DefWindowProc(hwnd, message, wParam, lParam);
> }
> }
This looks pretty simple even for a newbie like me, but somehow I can't associate
the following line in wndProc:
Window* wnd = hwnd in Window._windows;
to the class...
Inside the class I'm using the CreateWindowA WinAPI, which returns the needed
HWND, but how do I put this HWND into the _windows array?
Is there a chance to get a minimalistic but full working example?
Also somehow the compiler (GDC) always wants 'main' but afaik in gui apps it
should be 'winmain'...
Thanks says a newbie (to D...)
Dune
More information about the Digitalmars-d-dwt
mailing list