Hi All,
What I know:
* Using with speeds up developement
* Using with makes code a lot easier to manage.
* Using with can make code prettier
I think "With ... End With" speeds up execution time, which is something I've seen posted before. But I've also seen in other posts that it's a pure syntactic sugar and does nothing to compiled code. I've also heard:
With speeds up execution because objects need to be "opened" before they are accessed, and "closed" afterwards to allow other processes to access them.
Looking through the COM Api's the only thing I could see which might relate to this is CoLockObjectExternal.
So my question is, for the following code:
What does VB6 do internally? E.G. is it like this:Code:With A.B.C With .D Debug.Print .E end with Debug.Print .F & .G End With
or is it more complex like:Code:set temp1 = A.B.C set temp2 = temp1.D Debug.Print temp2.E Debug.print temp1.F & temp1.G
Does anyone know the answer?Code:set temp1 = A.B.C CoLockObjectExternal temp1 set temp2 = temp1.D CoLockObjectExternal temp2 Debug.Print temp2.E Debug.print temp1.F & temp1.G CoDisconnectObject temp2 CoDisconnectObject temp1




Reply With Quote
