Here's the code to instantiate ATS and ATS2. The key was to use the right registry IDs. After that, it seemed that using the ByProperty instrument generation failed to create valid IIDs. To get around that, we are trying this with ByServer instruments (thus the Set/GetProperty calls). These Set/Get calls always return "Property is not optional".
int main (int argc, char *argv[])
{
VBOOL ATSvisible = VTRUE; //it starts as hidden (false), so we need to see this value change.
HRESULT CAstat = -1;
char errStr[200] = "";
const IID ATSiid;
GUID ATS_Application_classId = {0xE8596241, 0x140D, 0x11D5, 0x96, 0xF8, 0x00, 0x10, 0x4B, 0x70, 0xE9, 0xEC};
GUID RabbitGlobalId = {0x1085634B, 0x0CC7, 0x11D5, 0x91, 0x28, 0x00, 0xA0, 0xC9, 0x5D, 0xE7, 0x12};
GUID ATS2classId2 = {0xAB0622AF, 0xEF9A, 0x4895, 0x99, 0x03, 0x1E, 0xE3, 0xFB, 0x9E, 0x8B, 0xF6};
GUID ClassID_ATS2Golbal = {0x0608FE8B, 0x2A53, 0x44E9, 0xB4, 0xA2, 0x7F, 0x4A, 0x3C, 0x90, 0xB0, 0x8D};
ERRORINFO errorInfo;
char *returnValue = NULL;
int interfacePtr;
int didAddRef;
if (InitCVIRTE(0,argv,0) == 0)
return -1;
CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED);
if((gMainPanel = LoadPanel (0, "AcousticGUI.uir", MainPanel)) < 0)
return -1;
sprintf(tempStr, "\n%s,%s,%s,\n", "Opened AcousticTest:", DateStr(), TimeStr());
printToLog(tempStr);
DisplayPanel (gMainPanel);
ConfigCommPortsOnUI();
//Doesn't seem to do anything, but might be useful later
//CAstat = Wb6ent_New_IBasicIdeObj (NULL,1, LOCALE_NEUTRAL,0,&WB6handle);
CAstat = CA_CreateObjectByClassIdEx (&ATS2classId2, NULL, &ClassID_ATS2Golbal,1, LOCALE_NEUTRAL,0, &ATS2GlobalHandle);
CA_GetAutomationErrorString(CAstat,errStr,200);
sprintf(tempStr,"%s ATS returned \"%s\"",TimeStr(),errStr);
InsertTextBoxLine(gMainPanel, MainPanel_StatusPanel, -1, tempStr);
CAstat = CA_CreateObjectByClassIdEx(&ATS_Application_classId, NULL, &RabbitGlobalId, 0, LOCALE_NEUTRAL, 0, &ATShandle);
CA_GetAutomationErrorString(CAstat,errStr,200);
sprintf(tempStr,"%s ATS returned \"%s\"",TimeStr(),errStr);
InsertTextBoxLine(gMainPanel, MainPanel_StatusPanel, -1, tempStr);
CAstat = ATS_SetProperty (ATShandle, NULL, ATS_IApplicationVisible, CAVT_BOOL, VTRUE);
// CAstat = ATS_GetProperty (ATShandle, NULL, ATS_IApplicationVisible, CAVT_BOOL, &ATSvisible);
CA_GetAutomationErrorString(CAstat,errStr,200);
sprintf(tempStr,"%s ATS returned \"%s\"",TimeStr(),errStr);
InsertTextBoxLine(gMainPanel, MainPanel_StatusPanel, -1, tempStr);
CAstat = ATS_IApplicationPanelOpen (ATShandle, NULL, ATSConst_apbAnalogInput, CA_DEFAULT_VAL);
CA_GetAutomationErrorString(CAstat,errStr,200);
sprintf(tempStr,"%s ATS returned \"%s\"",TimeStr(),errStr);
InsertTextBoxLine(gMainPanel, MainPanel_StatusPanel, -1, tempStr);
RunUserInterface ();
return 0;
}