ActiveX control created in multithreaded VFP COM dll  
Author Message
cosmmm





PostPosted: Visual FoxPro General, ActiveX control created in multithreaded VFP COM dll Top

I just can't to solve the problem. May anyone say why a MSWinsock control isn't work in VFP COM dll. In common exe this all works fine, but in the COM dll nothing happens, while I invoking Connect method. Really nothing! The State property remains 0 at all.

Help if you know



Visual FoxPro2  
 
 
cosmmm





PostPosted: Visual FoxPro General, ActiveX control created in multithreaded VFP COM dll Top

The State property remains 0 at all.

I have mistaken. State property equals to 4 (Resolving host). Very strange. If I run my class just from command window, then the connection established normally, but from dll - State=4. Hmmm

Any ideas


 
 
cosmmm





PostPosted: Visual FoxPro General, ActiveX control created in multithreaded VFP COM dll Top

 

I just can't to solve the problem. May anyone say why a MSWinsock control isn't work in VFP COM dll.

 

I just understood one thing: I organized a loop to wait an answer from the server and used the INKEY(.1) command. In this case all works fine. But in COM dll INKEY command causes the error "User-interface operation not allowed at this time". So MSWinsock control doesn't have idle time to do its job. I'm interesting: what command may be used to organize a small pause in DO WHILE...ENDDO to allow another COM object (MSWinsock) to work


 
 
CetinBasoz





PostPosted: Visual FoxPro General, ActiveX control created in multithreaded VFP COM dll Top

If waiting would solve your problem you can use Sleep API or a do while..enddo. ie:

declare Sleep in win32API integer milliseconds
Sleep(100)

lnStart = datetime()
do while datetime() - m.lnStart < 0.1
enddo


 
 
cosmmm





PostPosted: Visual FoxPro General, ActiveX control created in multithreaded VFP COM dll Top

If waiting would solve your problem you can use Sleep API or a do while..enddo. ie:

declare Sleep in win32API integer milliseconds
Sleep(100)

lnStart = datetime()
do while datetime() - m.lnStart < 0.1
enddo

I already have exactly the same code. But in this case (DO WHILE...ENDDO) and without INKEY(.1) MSWinsock in COM dll doesn't receive enough time( ), so simply doesn't work. That's why I'm asking so stupid (on the first look) question.

About Sleep: Sleep pauses CURRENT thread on the specified number of milliseconds, so fox doesn't work at this time at all


 
 
CetinBasoz





PostPosted: Visual FoxPro General, ActiveX control created in multithreaded VFP COM dll Top

Sorry I don't know.