CString question in ActiveX control

I found a problem with CString in ActiveX control
While I using a Cstring in propPage,
the member method Left() can can be used.
but In .....Ctrl.cpp page, this method dose not work.

Like:
CString str;
str = L"C:\\Documents and Settings\\LEVI" ;
str = str.Left( str.GetLength() - str.ReverseFind('\\') - 1 ) ;

while in PropPage, str is "C:\\Documents and Settings";
but in ...Ctrl.cpp, str is still "C:\\Documents and Settings\\LEVI".

This is why?

another question:
I need to get the path"C:\\Documents and Settings\\All Users", there is a macro
CSIDL_PROFILE to return the current path like "C:\\Documents and Settings\\LEVI",
there was another macro CSIDL_PROFILES to return what I want, but this one does not exists in VC 2003,I didn't found it.
Any one can help to get this path "C:\\Documents and Settings\\All Users" ?

Thanks.

Can you please post up your code illustrating your CString issue. Please remember to put it into [c0de] [/c0de] tags (with o not 0).

To get the current directory. You can use:
DWORD GetCurrentDirectory( DWORD nBufferLength, LPTSTR lpBuffer );

There are other Win32API calls that allow you to get various system and program/user directories.
closed account (z05DSL3A)
For the CSIDL (constant special item ID list) see:
http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx

You should beable to use SHGetSpecialFolderPath() with a relavent CSIDL to get the folder path you want.
Thanks,

my issue has been solved.

using CSIDL_COMMON_DOCUMENTS, and my CString question do not exists at all, I used it in a wrong way.

Last edited on
Topic archived. No new replies allowed.