05-31-2017 03:45 AM
Hi
this thread is almost dealing with my task.
https://forums.ni.com/t5/NI-TestStand/How-to-specify-environment-when-using-custom-OI/m-p/3617452
BTW my task is quite different. I am NOT using the ApplicationManager. So commandline will not work at all.
I am initializing the engine in old school:
HRESULT res = m_engine.CreateInstance("TestStand.Engine");
is there any change to work with environments?
Regards
Juergen
Solved! Go to Solution.
05-31-2017 08:37 AM
Hey Juergen,
It looks like you can call EngineInitializationSettings.SetEnvironmentPath() before creating the engine. The EngineInitializationSettings class is new to 2016.
I haven't had a chance to try it... so let me know if that works!
-Trent
06-01-2017 09:07 AM
Hi Trent,
Thanks for this useful information.
Now I have the problem to invoke that class.
under TS2016 there is no CLSID.
#import "C:\\Program Files (x86)\\National Instruments\\TestStand 2016\Bin\\teapi.dll"
(at least did not found one)
How do you create that instance.
IEngineInitializationSettingsPtr engineInitSettings;
HRESULT res = engineInitSettings.CreateInstance(??????);
Or is it provided by another interface?
Best regards
Juergen
06-01-2017 05:28 PM
You should be able to get it with __uuidof(TS::EngineInitializationSettings).
Here's a crude snippet that i used to test:
#import "teapi.dll" #include <iostream> using namespace TS; int main() { CoInitialize(NULL); IEngineInitializationSettingsPtr engineInitSettings; IEnginePtr enginePtr; HRESULT HR; //Set Environment HR = engineInitSettings.CreateInstance(__uuidof(EngineInitializationSettings)); engineInitSettings->SetEnvironmentPath("C:\\Users\\Public\\Documents\\National Instruments\\Custom\\myCustomEnv.tsenv"); //Get Environment HR = enginePtr.CreateInstance(__uuidof(Engine)); std::cout << enginePtr->GetEnvironmentPath(); return 0; }
I also have the include path added to my project settings instead of specifying it manually:
-Trent
06-02-2017 01:10 AM