카드 리더기의 Win32 Dll 호출

5672 단어 Win32
 1 unsafe class Program

 2 {

 3     [DllImport("mwhrf_bj.dll")]

 4     public static extern int rf_card(int icdev, Byte _Mode, UInt64* _Snr);

 5 

 6     [DllImport("mwhrf_bj.dll")]

 7     public static extern int Open_USB();

 8 

 9     [DllImport("mwhrf_bj.dll")]

10     public static extern int Close_USB(int icdev);

11 

12     [DllImport("mwhrf_bj.dll")]

13     public static extern int rf_beep(int icdev, UInt32 _Msec);

14 

15     static void Main(string[] args)

16     {

17         int devID = Open_USB();

18         Console.WriteLine("      ");

19         while (true)

20         {

21             UInt64 cardSN;

22             int flag= rf_card(devID, (Byte)0x00, &cardSN);//             

23             //int flag= rf_card(devID, (Byte)0x00, &cardSN);//             

24             if (flag != 1)

25             {

26                 rf_beep(devID, 10);

27                 Console.WriteLine("    ,   {0}", cardSN);

28             }

29             Thread.Sleep(1000);

30         }

31         Close_USB(devID);

32         Console.WriteLine("      ");

33     }

34 }

좋은 웹페이지 즐겨찾기