class Callback(R, T1, T2, T3, T4) { private alias R delegate(T1, T2, T3, T4) Method; private extern (Windows) alias R function(T1, T2, T3, T4) Function; public this(Method method) { method_ = method; } public Function opCast() { return &callback; } public static extern (Windows) R callback(T1 arg1, T2 arg2, T3 arg3, T4 arg4) { return method_(arg1, arg2, arg3, arg4); } private static Method method_; }; alias Callback!(int, Handle, uint, uint, int) WndProc; class Control { void registerClass() { WNDCLASS wc; wc.lpfnWndProc = (WNDPROC)(new WndProc(&windowProc)); } private int windowProc(Handle handle, uint message, uint param1, int param2) { // Now I have access to the class's non-static members. Hurrah. ... } }