Re: How I can pass the WndProc as a parameter?

2022-09-10 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 10 September 2022 at 10:39:12 UTC, Injeckt wrote: To elaborate on why you need the above... But I get these bugs: WndProc is a function, and you can't pass a function as a runtime function parameter, only pointers to functions. The first two errors tell you exactly what the

Re: How I can pass the WndProc as a parameter?

2022-09-10 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 10 September 2022 at 10:39:12 UTC, Injeckt wrote: And after all, I call it: KK_CreateWindowClass(WndProc); `KK_CreateWindowClass();`

Re: How I can pass the WndProc as a parameter?

2022-09-10 Thread Andrey Zherikov via Digitalmars-d-learn
On Saturday, 10 September 2022 at 10:39:12 UTC, Injeckt wrote: server.d(29): Error: function `server.WndProc(void* hwnd, uint message, uint wParam, int lParam)` is not callable using argument types `()` I think you need to get address of a function: ```d wndclass.lpfnWndProc = ```

Re: How I can pass the WndProc as a parameter?

2022-09-10 Thread Injeckt via Digitalmars-d-learn
On Saturday, 10 September 2022 at 10:39:12 UTC, Injeckt wrote: utils.d(52): Error: cannot implicitly convert expression `*WndProc` of type `nothrow @system extern (Windows) int(void*, uint, uint, int)` to `extern (Windows) int function(void*, uint, uint, int) nothrow @system`

How I can pass the WndProc as a parameter?

2022-09-10 Thread Injeckt via Digitalmars-d-learn
I define this function: extern(Windows) static LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) nothrow { return 0; } Then I define in another .d file: void KK_CreateWindowClass(WNDPROC WndProc) { WNDCLASSEX wndclass;