Skip to content

Instantly share code, notes, and snippets.

@mattcox
Last active July 12, 2018 21:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcox/fa299be4164ec8ebbf66 to your computer and use it in GitHub Desktop.
Save mattcox/fa299be4164ec8ebbf66 to your computer and use it in GitHub Desktop.
Demonstrates how to get a PackageInstance from a ILxItem COM interface. If you pass this function an item, it will return the class that it derives from, as long as it is one of your classes. Obviously, change the class name to whatever your class is called, as well as the server name!
Instance *
getInstance (
ILxUnknownID item)
{
CLxLoc_PackageInstance pkgInstance (item);
CLxSpawner <Instance> spawn ("myInstance");
if (pkgInstance.test ())
return spawn.Cast (pkgInstance);
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment