String Error using ShellExecute() in vs.net 2005
-
I am getting an error on this line:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
and the error is: error C2664: 'ShellExecuteW' : cannot convert parameter 3 from 'const char [48]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I am using a relative path as my program will be executed from the root of a CD and will attempt to open a file 2 layer down the directory tree. thanks -
I am getting an error on this line:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
and the error is: error C2664: 'ShellExecuteW' : cannot convert parameter 3 from 'const char [48]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I am using a relative path as my program will be executed from the root of a CD and will attempt to open a file 2 layer down the directory tree. thanksCNewbie wrote:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
ShellExecute(NULL, NULL, _T("Cisco CCNP Exam 642-801\\cd\\CBTNuggetPlayer.exe"), NULL, _T(""), SW_SHOWDEFAULT);
Nibu thomas Software Developer
-
I am getting an error on this line:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
and the error is: error C2664: 'ShellExecuteW' : cannot convert parameter 3 from 'const char [48]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I am using a relative path as my program will be executed from the root of a CD and will attempt to open a file 2 layer down the directory tree. thanks -
CNewbie wrote:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
ShellExecute(NULL, NULL, _T("Cisco CCNP Exam 642-801\\cd\\CBTNuggetPlayer.exe"), NULL, _T(""), SW_SHOWDEFAULT);
Nibu thomas Software Developer
-
Thanks that fixed the errors and taught me something :). Now it opens CBTNuggetPlayer.exe like it is supposed to but then it closes right away. No Window or anything. Why would that happen? Thanks
CNewbie wrote:
Thanks that fixed the errors and taught me something . Now it opens CBTNuggetPlayer.exe like it is supposed to but then it closes right away. No Window or anything. Why would that happen?
Can't say anything specific. Just a guess, does it require a command line argument?
Nibu thomas Software Developer
-
CNewbie wrote:
Thanks that fixed the errors and taught me something . Now it opens CBTNuggetPlayer.exe like it is supposed to but then it closes right away. No Window or anything. Why would that happen?
Can't say anything specific. Just a guess, does it require a command line argument?
Nibu thomas Software Developer
-
no, I can go to the exe and double click and it opens fine. it is a GUI based exe. but trying to open it from my program doesnt bring up the window. Just opens the exe and then it closes without a window being drawn.
Try this...
ShellExecute(NULL, NULL, _T("Cisco CCNP Exam 642-801\\cd\\CBTNuggetPlayer.exe"), NULL, NULL, SW_SHOWDEFAULT);
A suggestion: Check out CreateProcess[^]. A Demo[^]
Nibu thomas Software Developer
-
I am getting an error on this line:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
and the error is: error C2664: 'ShellExecuteW' : cannot convert parameter 3 from 'const char [48]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I am using a relative path as my program will be executed from the root of a CD and will attempt to open a file 2 layer down the directory tree. thanks