First, ". \" and the system API function GetModuleFileName are used to obtain the address of the current program running.
The difference is that ". \" indicates the relative path, while GetModuleFileName gets the absolute path for running the program.
When the program runs in Windows, there is basically no difference. However, if the program runs under Wince, since Wince does not support relative paths, all paths can only be obtained by calling the system API function.
Usage:
". \" Is followed by the relative address of the file or the file name.
The GetModuleFileName usage is as follows:
CString CIniFileOpe: GetSystemPath ()
{
TCHAR MyexeFullPath [MAX_PATH];
CString MyAppPath;
GetModuleFileName (NULL, MyexeFullPath, MAX_PATH );
CString strPathTemp;
StrPathTemp = MyexeFullPath;
Int iLastPos =-1;
Int iStartPos = 0;
Do
{
IStartPos = iLastPos;
ILastPos = strPathTemp. Find (_ T ("\"), iStartPos + 1 );
} While (iLastPos! =-1 );
MyAppPath = strPathTemp. Left (iStartPos + 1 );
Return MyAppPath;
}