Just so you know where I AM ...

I am quite versed in multi-threaded programming in and out of VB. I am pretty good with the API, however, not sure enough about the semantics of the Window object and COM (in my case VB6) to be sure of the answer to my question.

---------- Statement of Fact (?)

VB6 provides for Multi-Threading and it's RunTime Library (MSVBVM60.DLL) is Thread-Safe - I've utilized this quite well - nicelly stable. However, Forms and Controls are not "Thread-Safe" and, as a result, must only be accessed by the Thread which created them.

This is pretty much my (highly simplified) quideline for VB6 and Threading therein.

----------

Now, with this (my basic understanding) in mind, I'll get on to the question:

This is something that I am doing in VB6 - it appears solid. I would like to know if anyone has a good reason why I should not do it . . . Is it NOT "Thread-Safe" or are there possibly other issues?

Within VB6, I have two threads (in the same process). One Thread creates a Form with a PictureBox on it. It passes the hWnd of this PictureBox to the other Thread - this other Thread (running on it's own) updates the PictureBox, THROUGH THE hWnd, about 30 times a second, as follows (locHWnd contains the hWnd of the PictureBox):

locDC = GetDC(locHWnd)
locReturnL = BitBlt(locDC, locRECT.Left, locRECT.Top, locWidth, locHeight, locDCDesktop, locSrcXDesktop, locSrcYDesktop, SRCCOPY)
locReturnL = ReleaseDC(locHWnd, locDC)

((( As a side question, perhaps I should be using BeginPaint+EndPaint and/or GetDC+ReleaseDC? My intention with these calls is to "lock out" this Windows object while I use it, so that I don't CONTEND with another Thread? )))

----------

One thought that came to me ... I am referencing the PictureBox from a Thread which did not create it. HOWEVER, my mind whirrrs, I am not actually referencing the PictureBox Control (as in the Automation Object - the thing I must not contend with cause it's not Thread-Safe), I am ACTUALLY accessing the Windows resource (DC) directly! Hmmm. This should be OK?

Another thought that came to me ... I may CONTEND with the actual Windows object (DC). So, I added the calls to GetDC and ReleaseDC.

----------

MANY Thanks for reading this.