سلام
این کد اتصال usb و کلا device هست و نیازمند فعال سازی پلاگین MemoryEx هست .
در Global Function :
کد:WM_MOVING = 0x0216; WM_DEVICECHANGE = 0x0219; DBT_DEVICEARRIVAL = 0x8000; DBT_DEVTYP_VOLUME = 0x00000002; function EventHandler(hWnd, uMsg, wParam, lParam) if (hWnd == mainWinHdl and uMsg == WM_DEVICECHANGE) then --MainWindows_DEVICECHANGE if (wParam == DBT_DEVICEARRIVAL) then -- etesal device DEV_BROADCAST_HDRStructure = MemoryEx.DefineStruct( {UINT("dbch_size"); UINT("dbch_devicetype"); UINT("dbch_reserved"); } ); hdlDEVStruct = MemoryEx.AssignStruct(lParam, DEV_BROADCAST_HDRStructure); if (hdlDEVStruct.dbch_devicetype == DBT_DEVTYP_VOLUME) then -- etesal usb Dialog.Message("Notice", "usb device connected", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end end end return Subclass.OldWinProc(hWnd, uMsg, wParam, lParam); end
در OnShow :
کد:mainWinHdl = Application.GetWndHandle(); Subclass.Create(mainWinHdl, EventHandler);
در OnShutDown :
کد:Subclass.Remove(mainWinHdl);






پاسخ با نقل قول
Bookmarks