LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error getting TestStand ObjectHandle

I have this LW/CVI function, that gets the ObjectHandle of TestStand ActiveX server:

HRESULT CVIFUNC TS_ActiveEngine (const char *server, int supportMultithreading,
LCID locale, int reserved,
CAObjHandle *objectHandle)
{
HRESULT __result;

GUID clsid = {0xB2794EF6, 0xC0B6, 0x11D0, 0x93, 0x9C, 0x0, 0x20, 0xAF,
0x68, 0xE8, 0x93};
GUID iid = {0xB2794EF5, 0xC0B6, 0x11D0, 0x93, 0x9C, 0x0, 0x20, 0xAF, 0x68,
0xE8, 0x93};

__result = CA_GetActiveObjectByClassIdEx (&clsid, server, &iid,
supportMultithreading, locale,
reserved, objectHandle);

return __result;
}

When I execute this code:

HRESULT rr;
CAObjHandle engineObj;
rr = TS_ActiveEngine(NULL, 1, LOCALE_NEUTRAL, 0, &engineObj);
if (rr)
CA_DisplayErrorInfo(engineObj, "ERR", rr, NULL);

i receive an error: "Operation unavailable".

How can I determine the ObjectHandle of already launched TestStand engine?
0 Kudos
Message 1 of 4
(3,336 Views)
Hi,

I would suggest using TestStand API (TS_NewEngine) to create the TestStand enginer and it will return you the objectHandle for that engine. Is there a reason you dont want to use TestStand API?

Using GUID and CA_GetActiveObjectByClassIdEx will give you a better control but will take away lot of adaptiveness. Have you tried using &IID_IDispatch instead of &iid and removing const before char *server? I am not sure why you are seeing this error or if any of these suggestions will be helpful, but worth a try.

If you are more inclined on using this approach, I would recommend attaching a working code file (small) demonstrating this error.

Looking forward to your response.
Rajiv G
0 Kudos
Message 2 of 4
(3,310 Views)
The function you see in my example is the TS_ActiveEngine function provided by TSApiCVI.c file. Also, in that file I found the TS_NewEngine, that calls also CA_CreateObjectByClassId function.

The reason I cannot use TS_NewEngine is that I don't need another engine instance. I want to find out, from my application, the engine initiated by another application (I don't have the source code for that application) and to communicate with that application through TS Engine: changing parameters or steps, sending messages and such things. That's whi, i repeat, I need to know the handle of the already launched TS Engine.
0 Kudos
Message 3 of 4
(3,292 Views)
Hi,

If you are creating/launching the engine somewhere you must be having the object handle for that engine. Is it possible to get that engine reference?

Also, I think a new engine creates the same instance of the engine per process, I will try to verify that statement. What version of TestStand are you using??

Rajiv
0 Kudos
Message 4 of 4
(3,271 Views)