Optional parameters and empty COM values
|Top Previous Next|
In VB and VBA there are sometimes optional parameters. And often the only help available for functions in Inventor is the VB version, you have to guess the parameters of the C++ version from the VB version.
When there are optional parameters in C++ which you don't want to use you will probably have to pass an empty COM type value. A good example is GetTemplateFile:
hr = pFileManager->GetTemplateFile (kAssemblyDocumentObject, // type of file
CComVariant(), // Optional in VB, GUID for Weld and SheetMetal
&strTemplateFilename); // return value
That fourth parameter is an empty variant because we do not use it in this instance. In the VB description of the same function it is an optional parameter.
See also function call methods.
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)