Using delegate for WindowProc - possible ?

Juan Campanas johnny at bells.com
Wed Dec 28 16:40:03 PST 2011


On Wednesday, 28 December 2011 at 23:45:05 UTC, Tal wrote:
> Can I do something like this :
> ______________________________________________________________________
> extern (Windows) LRESULT delegate (HWND hWnd, UINT message, 
> WPARAM wParam,
> LPARAM lParam) MyWinProcDelegate;
>
> this() {
> 	MyWinProcDelegate = &Events;
> }
>
> extern (Windows) LRESULT Events (HWND hWnd, UINT message, 
> WPARAM wParam,
> LPARAM lParam) {
> 	MessageBoxA(null , "Success!!!" , null ,0);
> 	return DefWindowProcA(hWnd, message, wParam, lParam);
> }
> ______________________________________________________________________
>
> The Events() doesn't seem to fire... am I missing something ?

Nope. You are trying to assign the address of a function to a 
delegate, both are differents.


More information about the Digitalmars-d-learn mailing list