06-25-2009 01:56 AM
Hi,
I'm using labVIEW ActiveX to Call a VI from a Visual C++ application. For this I've provided a vi with some control with predefined names.
I uses this controlnames to set values to vi and run this by using LabVIEW::VirtualInstrumentPtr->Run() method. Users of my application adds labview codes in this vi and uses these controls to get the value set by me.
My code is something like this
LabVIEW::_ApplicationPtr m_pLVApp;
LabVIEW::VirtualInstrumentPtr m_pVI;
m_pLVApp.CreateInstance("LabVIEW.Application");
char password[60] = "";
VARIANT_BOOL reserveForCall = VARIANT_FALSE;
long options = 0;
TCHAR viPath[MAX_PATH];
_tcscpy( viPath, _T("MyVi.vi") );
m_pVI.CreateInstance("LabVIEW.VirtualInstrument");
m_pVI = m_pLVApp->GetVIReference( LPCTSTR(viPath), LPCTSTR(password), reserveForCall, options );
HRESULT hr = m_pVI->OpenFrontPanel( VARIANT_TRUE, LabVIEW::eVisible );
HRESULT hr = m_pVI->SetControlValue( "Value1", "1" );
This code works fine. But some of my customers feels that it would be better to provide my vi as a subvi, so that they can use it without modifying. For this, i want to set the data from my side to the subvi inside user's vi. I tried by SetControlValue(). But it is not working.
Is there any way to get the subvi used in VI by using activex/COM?
Or Is there any better solution to this problem?
Regards,
Faisal M