Using delegate for WindowProc - possible ?

bls bizprac at orange.fr
Thu Dec 29 11:13:24 PST 2011


On 12/28/2011 03:45 PM, 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 ?

Maybe std.functional toDelegate() ?

auto DelegateToUse = toDelegate(&Events);
Not sure how much sense this makes...

If I  recall correctly I have used

alias extern windows LRESULT delegate() callback;
callback = &cbfunc;
As said I am not sure, hth Bjoern


More information about the Digitalmars-d-learn mailing list