hi,
i have some working Sample to react on WM_DEVICECHANGE but both fail in "Main" App
Code: Select all
CREATE EVENT PROCNAME USB_Detect() HWND Form_1.HANDLE STOREINDEX nIndex
it does use Form_1.HANDLE which is correct but
a.) it fired Event only when Form_1 have focus
b.) Form_1 only can receive Event when have focus
not clear what the Problem is but the other Problem have to do with it : Thread
if i can`t receive Event i have to "ask" for it so i want to use Thread / Timer
like above in USB_Detect() i can´t access "Main" when using EVENT or Thread
---
i have read in c:\hmg.3.4.4\SAMPLES\MultiThread\MT_Notifier\MT_Notifier.prg
Code: Select all
#define WAY_ONE 1
// set inter-thread data exchange, this is the way because vars PUBLIC are not INHERITED
#if WAY_ONE
s_hWnd_Form1 := Form_1.HANDLE
#else
HMG_ThreadShareData( 1, Form_1.HANDLE )
#endif
// Notifier( cMsg, ERROR, nSeconds, lCenter, nTransparency )
pThID[ 1 ] := hb_threadStart( @Notifier(), "Thread Count "+ hb_NtoS( ++nThreadCount ) + CRLF + "Printing file xxxxx.xxx sent to EPSON LX-300", NIL, 3, NIL, NIL )
pThID[ 2 ] := hb_threadStart( @Notifier(), "Thread Count "+ hb_NtoS( ++nThreadCount ) + CRLF + "Printing file xxxxx.xxx sent to EPSON LX-300", NIL, 3, NIL, NIL )
pThID[ 3 ] := hb_threadStart( @Notifier(), "Thread Count "+ hb_NtoS( ++nThreadCount ) + CRLF + "File not found!", 1, NIL, NIL, NIL )
pThID[ 4 ] := hb_threadStart( @Notifier(), "Thread Count "+ hb_NtoS( ++nThreadCount ) + CRLF + "Printing file xxxxx.xxx sent to EPSON LX-300", NIL, 3, NIL, 128 )
pThID[ 5 ] := hb_threadStart( @Notifier(), "Thread Count "+ hb_NtoS( ++nThreadCount ) + CRLF + "File not found!", 1, NIL, NIL, 100 )
Form_1.Label_1.VALUE := "Total Thread Count: "+ hb_NtoS( nThreadCount )
and there is a comment
// NOTE: Because when you create a GUI control inside a Thread each thread take a local Windows Message Queue,
// is necessary you attach all Message Queue to the main thread Message Queue to allow
// invoke DO EVENTS in any thread for empty the Windows Message Queue of all thread.
so where can i read more about hb_thread
---
i have read about "hb_setListenerAdd"
Question : is "Listener" -> "look for Event"
i´m stuck with this Problem. please help if you got a Idea