The CLSID, which should be recorded in the typelib somewhere. I prefer using #import, which exposes the whole of a type-lib, including the CLSIDs. Here's an example - I'm using Excel's _Application class (it's a COM class - you could use it via MFC's 'Add Class' route:
// Do the import - need to rename some things to avoid name collisions
#import "libid:00020813-0000-0000-C000-000000000046" version("1.6") auto_search no_dual_interfaces rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB") rename("DocumentProperties", "excelDocumentProperties") rename("SearchPath", "excelSearchPath") rename("CopyFile", "excelCopyFile") rename("ReplaceText", "excelReplaceText")
int main(int, char**)
{
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
{
// Create the Excel object (or get the active instance) - note
// that the CLSID of the Excel application class is linked to
// the structure (Excel::Application) generated for that class
// and can be accessed using __uuidof.
Excel::_ApplicationPtr xl;
if (SUCCEEDED(xl.GetActiveObject(__uuidof(Excel::Application))))
{
std::cout << "Getting name\n";
// We're using several auto-generated classes here (Excel
// application, Excel workbook) - you'd have to import each
// one separately with MFC!
std::cout << xl->ActiveWorkbook->FullName << std::endl;
}
}
CoUninitialize();
}
If you're using VC6 (which I'm guessing you are?), I'm not sure how well #import will work for you, though :-(
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p