General information
Category:
Windows API functions
Ok, after reading the messages here (and doing some searching with DejaNews), I've come up with the following:
char lpFileName [1000];
char *ptr, c = '\\';
GetModuleFileName(GetModuleHandle(NULL),lpFileName,sizeof(lpFileName)-1);
ptr = strrchr(lpFileName, c);
*(strrchr(lpFileName, '\\')+1) = '\0';
chdir(lpFileName);
MessageBox(0,lpFileName, "Hi There", MB_OK+MB_ICONSTOP);
Which should leave me in the relevant directory, and I can run my exe from there.
Thanks to all who contributed.
Matt.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only