static void Main(string[] args) { try { CALLBACK_FUN fun = new CALLBACK_FUN(); fun.p_ReadedCardNumberCallBack = fReadedCardNumber; fun.p_CtrUploadIOStateCallBack = fCtrUploadIOState; fun.p_ReadedICCardCallBack = fReadICCard; byte a = TCP102_InitDll(1); byte b = TCP102_InitCallBack(1, ref fun); if (a != 0) { Console.WriteLine("Init DLL Error code : " + a.ToString() + "\nPress any key to exit..."); Console.ReadKey(); return; } if (b != 0) { Console.WriteLine("Init CALLBACK Error code : " + b.ToString() + "\nPress any key to exit..."); Console.ReadKey(); return; } frm.loadConfig(); ctr_ip1 = frm.ctrlIP1; ctr_ip2 = frm.ctrlIP2; var handle = GetConsoleWindow(); //Hide ShowWindow(handle, SW_HIDE); Thread.Sleep(400); frm.ShowDialog(); // Show ShowWindow(handle, SW_SHOW); TCP102_DllExit(); } catch (Exception) { } }
public static unsafe extern byte TCP102_InitCallBack(uint dwUser, ref CALLBACK_FUN p_call_back);
public unsafe static extern byte TCP102_InitCallBack(uint dwUser, ref CALLBACK_FUN p_call_back);