Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyMessageWindow : MessageWindow
- {
- private FMTest fmtest = null;
- public MyMessageWindow(FMTest fmtest)
- {
- this.fmtest = fmtest;
- }
- protected override void WndProc(ref Message m)
- {
- base.WndProc(ref m);
- if (m.Msg == GFMAPI.WM_FMNOTIFICATION)
- {
- // m.WParam holds the IntPtr to FMDevice in case you're writing a multi-device application
- fmtest.ReceivedNotification();
- }
- }
- }
- public class FMTest : IDisposable
- {
- private IntPtr FMDevice = IntPtr.Zero;
- public void Init()
- {
- FMDevice = GFMAPI.FMOpen(0);
- GFMAPI.FMRegisterNotification(FMDevice, new MyMessageWindow(this).Hwnd, GFMAPI.WM_FMNOTIFICATION);
- }
- public void ReceivedNotification()
- {
- TagFM_NOTIFICATION notification;
- GFMAPI.FMGetNotification(FMDevice, out notification);
- }
- public void Dispose()
- {
- if (FMDevice != IntPtr.Zero)
- {
- GFMAPI.FMClose(FMDevice);
- FMDevice = IntPtr.Zero;
- }
- }
- }
Add Comment
Please, Sign In to add comment