////////////////////// ADS THREAD
///////////////////////////////////////////////////
FUNCTION ThreadAds()
LOCAL oDlg
LOCAL oThread, oThreadAds
// RunSql query
oThreadAds := Thread():new()
oThreadAds:start({|| LongSqlRun() })
// this code to send events to main
window
FOR i:=1 TO 10000
PostAppEvent(xbeP_Move,SetAppWindow():currentPos(),SetAppWindow():currentPos(),SetAppWindow())
sleep(5)
NEXT
RETURN NIL
//==========================================
FUNCTION LongSqlRun()
LOCAL nConnect := 0
LOCAL nStatment := 0
LOCAL hCursor := 0
// sleep works properly
//sleep(48000)
DllCall( 'ace32.dll',32,
"AdsConnect60", 'd:\UNIVERSAL\EXPO\Globino\7.12\UNIVERSAL-7.ADD',
2, 'AdsSys', 'air', 0, @nConnect)
DllCall( 'ace32.dll',32, "AdsCreateSQLStatement",
nConnect, @nStatment )
// some minutes with very big memory leak
DllCall( 'ace32.dll',32, "AdsExecuteSQLDirect", nStatment,
"SELECT * INTO #trrrr FROM sodoper WHERE summa=3.14", @hCursor )
DllCall( 'ace32.dll',32, "AdsCloseTable", hCursor )
DllCall( 'ace32.dll',32, "AdsCloseSQLStatement", nStatment )
DllCall( 'ace32.dll',32, "AdsDisConnect", nConnect )
msgBox('Finish')
RETURN NIL