My executable file is in this place --> D:\Examples\C_Pro\newApp.exe Also in that "C_Pro" folder contain several files ( file1.txt, file2.txt, file44.exe, newApp.c )
In my newApp.c file, I includes a ShellExecute Function to execute "file44.exe" file in same folder like this --> ShellExecute(NULL,"open","D:\Examples\C_Pro\file44.exe",NULL,NULL,1)
in this way all work properly..
I'm talking about AppPath like thing in VB
But the case is I want to run this newApp.exe on different pc's So I want to replace ""D:\Examples\C_Pro\" this by whatever the path that contain "newApp.exe" file in another pc. (like C:\Software\ )
I get the path using GetModuleFileName Function but it contain newApp.exe part I want only at to the Point that new directory PathRemoveFileSpec function doesn't work.
and also the return path of GetModuleFileName like --> D:\Examples\C_Pro\newApp.exe but when we put some path in to ShellEcxecute the require double shalse (space sequence) like this --> D:\Examples\C_Pro\
How can I get rid of this problem.
Actual code snippt is this...
int main()
{
ShellExecute(NULL,"open","D:\\Softwares\\TypingMaster700.exe",NULL,NULL,SW_SHOWNORMAL);
}
But I want to do like this. (this is dummy one, here "some_Funtion" means dummy function for explanation purpose.
int main()
{
char *dirPath = some_Function(a,x,d);
char *fullPath;
fullPath = strcat(dirPath,"\\TypingMaster700.exe");
ShellExecute(NULL,"open",fullPath,NULL,NULL,SW_SHOWNORMAL);
}
Something like this works on Windows: