Exemplo n.º 1
0
BOOL CBlueClickApp::GetWorkSpacePath(CString &csPath) 
{  
	char pFileName[MAX_PATH]; 
	int nPos = GetCurrentDirectory( MAX_PATH, pFileName); 
 
	CString csFullPath(pFileName);  
	
	if( nPos < 0 ) {
		csPath = "";
		return FALSE;
	} else { 
		csPath = csFullPath;
		return TRUE;
	}
}
Exemplo n.º 2
0
static CString GetWorkDir()
{
    //TCHAR pFileName[MAX_PATH];
    //int nPos = GetCurrentDirectory( MAX_PATH, pFileName);

    //CString csFullPath(pFileName);
    //if( nPos < 0 )
    //	return CString(_T(""));
    //else
    //	return csFullPath;
    HMODULE module = GetModuleHandle( 0 );
    TCHAR pFileName[MAX_PATH];
    GetModuleFileName( module, pFileName, MAX_PATH );

    CString csFullPath( pFileName );
    int nPos = csFullPath.ReverseFind( _T( '\\' ) );
    if( nPos < 0 )
        return CString( "" );
    else
        return csFullPath.Left( nPos );
}