public static extern void PhRegisterCallbackEx( [In, Out] PhCallback *Callback, [In, MarshalAs(UnmanagedType.FunctionPtr)] PhCallbackFunction Function, [In, Optional] IntPtr Context, [In] ushort Flags, [Out] PhCallbackRegistration *Registration );
public CallbackRegistration(PhCallback *callback, PhCallbackFunction function) { this.Callback = callback; this.CallbackFunction = function; this.CallbackAlloc = MemoryAlloc.PrivateHeap.Allocate(PhCallbackRegistration.SizeOf); NativeApi.PhRegisterCallback(this.Callback, this.CallbackFunction, IntPtr.Zero, this.CallbackAlloc); this.RegistrationCallback = (PhCallbackRegistration *)this.CallbackAlloc; }
public CallbackRegistration(PhCallback* callback, PhCallbackFunction function) { this.Callback = callback; this.CallbackFunction = function; this.CallbackAlloc = MemoryAlloc.PrivateHeap.Allocate(PhCallbackRegistration.SizeOf); NativeApi.PhRegisterCallback(this.Callback, this.CallbackFunction, IntPtr.Zero, this.CallbackAlloc); this.RegistrationCallback = (PhCallbackRegistration*)this.CallbackAlloc; }
public void Dispose() { if (this.CallbackAlloc != null && this.RegistrationCallback != null) { // Unregister the callback. NativeApi.PhUnregisterCallback(this.Callback, this.RegistrationCallback); // Free the callback. MemoryAlloc.PrivateHeap.Free(this.CallbackAlloc); this.RegistrationCallback = null; } }
public static extern void PhUnregisterCallback( [In, Out] PhCallback *Callback, [In, Out] PhCallbackRegistration *Registration );