Obtaining install path name

Hello,

I'm using the API function ISldWorks::GetExecutablePath to obtain the path name for the SolidWorks install directory. But the string being returned to me is not correct. On my computer the correct string should be:

C:\Program Files\SolidWorks Corp\SolidWorks\

but I’m getting:

C:\PROGRA~1\SOLIDW~1\SOLIDW~1

Here is my code in C++:

HRESULT hres = NOERROR;

CComBSTR bPathName;

TCHAR szPathName[255];

hres = swApp->GetExecutablePath(&bPathName);

_stprintf(szPathName, _T("%s"), (LPCTSTR)bPathName);

_tcscpy(path, szPathName);

SysFreeString(bPathName);

Any thoughts on what the problem may be? Thank you.

SolidworksApi macros