ShellExecute() string problem
I have a weird problem that may involve pointer problems or incorrect termination, but I have almost given up now!!!
I use a Windows API32 function called "ShellExecute()"
to launch any application from within my application.
The application name is stored in a charbuffer just after the string "Execute ".
The idea is that by sending an email to my application, a user can launch any application he desires. The email generates the charbuffer.
static char Temp[TEMP_SIZE];
///search string to see if an Execute email recieved?
if (strstr(Temp,"Execute") !=NULL)
////get a pointer to the location of the app to execute
hInst = ShellExecute(0,"open",pathpointer,0,0,SW_SHOW);
If i harcode the pathpointer and write: "c:\\winnt\\notepad.exe"
it works fine, but If i store this string in the "Temp" buffer
the string is found but ShelExecute doesnt find the executable.....
Strangely if, I write a web adress like www.volvo.se , then ShellExecute launches the web browser as it is suppoes to.
It seems to have something to do with either termination or the path.
But I have tried to copy from the pointer to a new char buff, terminate it and then use it with ShellExecute, I have also tried the various path functions in API 32, but to no avail. And, as I said, when I hardcode the string, it works........
Anyones suggestions is extremly appreciated!!!