   Problem using ShellExecuteA() function
  Hi Guys, I have a problem using ShellExecuteA() function. When I pass it string variables it does not work. The strings have valid data in them and are defined as so:char filename[255],path[255];But when I pass it strings like "PROGRAM.EXE" and "C:/PROGRAM PATH/" it will work. I notice it takes string parameters of type LPCSTR, is there a conversion problem happening here.Please help meDarkStarUK
  hi, well i think im not on the right track here but whey not do it like this? ShellExecute(NULL, NULL,"C:/PROGRAM PATH/PROGRAM.EXE", NULL, NULL, SW_SHOWNORMAL);cheers ;  LPCSTR is merely a constant string. ie.typedef const char *LPCSTR;According to the docs that I have, the return value can be cast to an int and compared against a handle full of error messages. Hopefully this query will help you find that information for yourself: ShellExecute. And from there you can determine the reason why the call fails. ;  Emexus, that works fine, but I want to pass a string variable in to the function instead of giving it a string literal such as "C:/PROGRAM PATH/PROGRAM.EXE". And this is what is not working right, and I cannot understand why.DarkStarUK;  Hello,You might have to do something like this: ShellExecute(NULL,"open","C:\\PROGRAM PATH\\PROGRAM.EXE",NULL,NULL,SW_SHOW);Since the "\\" converts into a "\" with stringsFor example: // include the header for appending strings#include <string.h>// create character arrayschar filename[255], path[255], fileDest[255];// define path and filenamestrcpy(path, "C:\\PROGRAM PATH");strcpy(filename, "PROGRAM.EXE");// Append both strings together to make "C:\\PROGRAM PATH\\PROGRAM.EXE"strcpy(fileDest, path);strcat(fileDest, "\\");strcat(fileDest, filename);// Execute program from fileDestShellExecute(NULL,"open",fileDest,NULL,NULL,SW_SHOW);- BlueDev   [edited by - BlueDev on August 1, 2003 4:39:19 PM];  No thats not the problem I use the forward slash in strings e.g."c:/program/program.exe" which is fine.The problem is not with doing thisstrcpy(filename,"program.exe");and then calling ShellExecute... The problem is when I load the string from a file....say I load the string "program.exe" from file, thats when it does not work. I debug it by tracing the code and watch the variable...the variable string is fine in WATCH view but still dont work when I load the string from file and use ShellExecute. It''s a really bizzare problem and I dont know what to do.By the way Im doing this cos I am making an autostarter program, which boots up when windows does and stays in memory (but hidden, with no window) and launches programs suppossed to start with windows, when the time is right. So it needs to load in program path and file names from file and launch them one by one after a specified time. The reason for this is that I have loads of programs that start with windows and they take long to load if loading at same time and I often have to wait 5-7 mins before I can do anything with my comp. So my program loads them from 10 mins after I booted windows to desktop, one by one first one launches 10mins after windows does, then 12 mins, then 14 mins and so on. This already works brilliant, but I want to make it read programs from file (instead of using string literals) and launch them so I can modify this text file with programs I want to start and when. But the strings loaded in are not working...I get ERROR_FILE_NOT_FOUND from ShellExecuteADarkStarUK 