ComValue.GetGuid

Returns a Guid stored in the Value property. This is necessary because Guids are Value types that cannot be passed into or be accessed by FoxPro code at all.

You will most likely use this method on a ComValue instance returned when you use InvokeMethod() to call a method that return a Guid, or using GetProperty() to access a property.

o.ComValue.GetGuid()

Return Value

GUID as a string if the Value is a string

Example

*** To retrieve a Guid always use `InvokeMethod` or `GetProperty`

* Using Guid Result
loGuidComValue =  loBridge.InvokeMethod(loNet,"GetGuid") && returns COM Value
lcGuid = loGuidComValue.GetGuid() 
? lcGuid

* Access a Guid Property
loObj = loBridge.InvokeMethod(loNet,"GetObjectWithGuidProp()")
? loObj.Name  && regular props work
* ? loObj.Guid  && fails
loGuidComValue = loBridge.GetProperty(loObj,"Guid")  && ComValue returned
lcGuid = loGuidComValue.GetGuid()
? lcGuid

* Just create a new Guid
lcGuid = loGuidComValue.NewGuid()
? "New Guid: " + lcGuid

See also:

Class ComValue

© West Wind Technologies, 2021 • Updated: 09/19/19
Comment or report problem with topic