LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NewActiveXCtrlFromPersistence

I have a DLL which includes a file programmatically generated from a UIR with an ActiveX control (the 3DGraph) on it. Generated from CVI's UIR -> TUI tool.

i.e. the BuildPanel function includes

errChk(PANEL_CWGRAPH3D = NewActiveXCtrlFromPersistence (hPanel, "Untitled Control",
79, 187, "", 1, dataPtr, 0));

If I call the DLL from another CVI program, it works fine. However, when this DLL is called from TestStand (Action step, calling the DLL directly) this NewActiveXCtrlFromPersistence function fails. (ActiveX control error -143 )

Any ideas?
0 Kudos
Message 1 of 2
(2,954 Views)
Hi!
Use your function in dll in thread.
Like...

void _stdcall _export (n,m...)
{
int threadID;
CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, ThreadFunction, NULL, &threadID);
CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, threadID, OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
}

int CVICALLBACK ThreadFunction (void *functionData)
{
.
.
.
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
.
.
.
status = hPanel_1 = NewActiveXCtrlFromPersistence (hPanel, "", 0, 0,
"{E9A5593C-CAB0-11D1-8C0B-0000F8754DA1}", 1, dataPtr, 0);
.
.
.
CoUninitialize();


}
0 Kudos
Message 2 of 2
(2,903 Views)