Home > Back-end >  To open the file with ShellExecute, path is variable how?
To open the file with ShellExecute, path is variable how?

Time:09-20

To open the file with ShellExecute, path is variable how?
Int a=ShellExecute (NULL, TEXT (" open "), sta, NULL, NULL, SW_MINIMIZE);
Sta is the string

CodePudding user response:

 
The TEXT (sta)

CodePudding user response:

Sorry for missing a quote
 
The TEXT (" the sta ")

CodePudding user response:

Such as open QQ. Exe
ShellExecute (NULL, "open", "qq. Exe", NULL, NULL, SW_SHOWMAXIMIZED);

CodePudding user response:

ShellExecute (NULL, _T (" open "), CA2W (strPath. C_str ()), CA2W (strFile. C_str ()), NULL, SW_SHOWNORMAL);//strPath with strFile type string



Remember useful junction post

CodePudding user response:

reference 4 floor a1007885391 response:
ShellExecute (NULL, _T (" open "), CA2W (strPath. C_str ()), CA2W (strFile. C_str ()), NULL, SW_SHOWNORMAL);//strPath with strFile type string



Remember useful junction post
he prompt expression must contain structure or joint type, this is a c + +

CodePudding user response:

refer to the original poster ling dao night heart response:
for help, open the file with ShellExecute, path variable is how?
Int a=ShellExecute (NULL, TEXT (" open "), sta, NULL, NULL, SW_MINIMIZE);
Sta is the string
added, I am a char * sta

CodePudding user response:

It doesn't matter if it is a variable
Sta application space, either through memcpy or strcpy baby to sta application space,
Or use a character array to store path, then the sta=STR; Then it is ok to call interface,

CodePudding user response:

refer to 6th floor ling dao night heart response:
Quote: refer to the original poster ling dao night heart response:

To open the file with ShellExecute, path is variable how?
Int a=ShellExecute (NULL, TEXT (" open "), sta, NULL, NULL, SW_MINIMIZE);
Sta is the string
added, I am a char * sta

String c_str function is char * type ah, you direct CA2W (sta)
  • Related