If I use VarPtr to get and store the pointer for a variable of a user defined type, and make sure that neither variable is destroyed, will the pointer I get always point to that variable even if I alter it?
i.e.
Assuming I've declared CopyMemory correctly if I call SetPointer once and only once at the begining of my program will GetValue always return a copy of apiPoint, no matter how many times I pass apiPoint into GetCursorPos, or go apiPoint.x=lngWhatever?Code:Dim apiPoint As POINTAPI Dim hPointerToapiPoint As Long Private Sub SetPointer() hPointerToapiPoint = VarPtr(apiPoint) End Sub Private Function GetValue() As POINTAPI Dim apiTemp As POINTAPI CopyMemory apiTemp,ByVal hPointerToapiPoint, LenB(apiTemp) GetValue=apiTemp End Function
Please don't ask why I might possibly want to do things this way, I'm trying to do some really wierd **** and I have to do it like this.
Any Clues


Reply With Quote