Re: detect USB Device arrive/remove : how to use with harbour / HMG
Posted: Sun Feb 09, 2020 6:31 am
hi,
i found a Solution but not all is clear to me
change PUBLIC to Field-wide STATIC have help with those Variable
here i have mix some Code ... donĀ“t ask me how it work ... but it work
these both use Code like this
so now i can go on with HBFM and include USB-Device
i found a Solution but not all is clear to me
Code: Select all
STATIC caItems := {} // for GRID
STATIC acImage := {}
STATIC aDrives
Code: Select all
nMainThreadID := GetCurrentThreadID()
HMG_ThreadShareData( 1, Win_1.HANDLE )
aThread[ 1 ] := hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @Wait4Action() )
aThread[ 2 ] := hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @DoNothing() )
AttachThreadInput( nMainThreadID, HMG_ThreadHBtoWinID( aThread[ 1 ] ), .T. )
AttachThreadInput( nMainThreadID, HMG_ThreadHBtoWinID( aThread[ 2 ] ), .T. )
CREATE EVENT PROCNAME USB_Detect() HWND Win_1.HANDLE STOREINDEX nIndex
EventProcessAllHookMessage( nIndex, .T. )
Code: Select all
FUNCTION Wait4Action()
...
Fillgrid()
DO_Image( .T. )
Code: Select all
Win_1.Grid_Device.hide()
...
Win_1.Grid_Device.show()