LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using ShellExecuteEx() in CVI

Hi!
 
I'm trying to run the following code in CVI.  I have SDK package installed with my CVI, too.
Two header files, windows.h and Shellapi.h, are incleuded in my program already.
 
-----------------------------------------------------------------------------
   SHELLEXECUTEINFO ShExecInfo = {0};
   ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
   ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
   ShExecInfo.hwnd = NULL;
   ShExecInfo.lpVerb = "open";
   ShExecInfo.lpFile = "c:\\test.txt";     
   ShExecInfo.lpParameters = "";
   ShExecInfo.lpDirectory = NULL;
   ShExecInfo.nShow = SW_SHOW;
   ShExecInfo.hInstApp = NULL;  
  
   ShellExecuteEx(&ShExecInfo);
   WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
---------------------------------------------------------------------------------
 
 
No problem for compiling, but it keeps giving me the link error at run time:
"Undefined symbol '_ShellExecuteExA@4' referenced in "External_WinApp.c"
 
 
Could anyone give me an advise?
 
0 Kudos
Message 1 of 3
(4,090 Views)
Hi dcl9000,

You need to add the Shell32.lib import library to your CVI project. You can find this import library in the <CVI>\SDK\lib directory.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 3
(4,083 Views)
Got it.  Thanks!
0 Kudos
Message 3 of 3
(4,058 Views)