PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

File handling in EVC4

Hi all!

I'm very confused about this, please help.
I've tried to rename a file like this:

MoveFile(_T("a.txt"),_T("b.txt"));//from winbase.h

but got ERROR_FILE_NOT_FOUND since the file (a.txt) is in the application's
directory, not in the root, where the MoveFile expects.

Should i determine the directory of my app and then call MoveFile, or
is there any better solution? If not, how can i determine my app dir?
(the user can install it anywhere, and GetCurrentDirectory is not supported
on Windows CE :( (...why?))

thanks
MG
PocketPC does not know what "current directory" is.
You have to state full path name.


Code:

DWORD GetModuleDirectory(HMODULE hModule, LPTSTR szPath, DWORD dwLength) {

DWORD dwLen;
LPTSTR p;
if (0 == (dwLen = GetModuleFileName(hModule, szPath, dwLength))) {
return(0);
}
p = szPath + dwLen;
while (p != szPath) {
if (TEXT('\\') == *--p) {
*(++p) = 0;
break;
}
}
return(p - szPath);

}