netripper

netripper

Aug 6th, 2009
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. @@ // Relevant parts of code of GFMAPI.NET for FMOpen and FMClose (www.netripper.nl)
  2.  
  3.     public enum ResultCode : int
  4.     {
  5.         Success                 = 0,
  6.         InvalidParameter        = 87,
  7.         CallNotImplemented      = 120,
  8.         NotSupported            = 50,
  9.         BadUnit                 = 20,
  10.         NotReady                = 21,
  11.         OpenFailed              = 110,
  12.         DeviceAlreadyAttached   = 548,
  13.         GenFailure              = 31
  14.     }
  15.  
  16. @@ // ...snip...
  17.  
  18.         private const string DLL = "GFMAPI.DLL";
  19.  
  20.         [DllImport(DLL, SetLastError = true)]
  21.         public static extern IntPtr FMOpen(int FMDeviceIndex);
  22.  
  23.         [DllImport(DLL)]
  24.         public static extern ResultCode FMClose(IntPtr FMDevice);
  25.  
  26. @@ // ...in the calling class when FMOpen is called (in my test app)...
  27.  
  28.                     // Opening device
  29.                     FMDevice = GFMAPI.FMOpen(0);
  30.  
  31.                     // Fetching device information
  32.                     TagFMDEVINFO devinfo = new TagFMDEVINFO();
  33.                     devinfo.Size = Marshal.SizeOf(devinfo);
  34.                     ResultCode rc = GFMAPI.FMGetDevInfo(0, ref devinfo);
  35.  
  36.                     // Register window for notifications
  37.                     ResultCode result = GFMAPI.FMRegisterNotification(FMDevice, MessageWindow.Hwnd, GFMAPI.WM_FMNOTIFICATION);
  38.  
  39. @@ // ... in the calling class when FMClose is called...
  40.  
  41.                     // Closing device
  42.                     ResultCode result = GFMAPI.FMClose(FMDevice);
  43.  
Add Comment
Please, Sign In to add comment