CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    6

    Problem retrieving ProgramFiles path

    Hi everyone,

    I am trying to get the programefiles path but without succes. I tried it with:


    TCHAR localised_path[MAX_PATH];
    SHGetFolderPath(NULL, localised_path, CSIDL_PROGRAM_FILES, 0);

    but it said SHGetFolderPath and CSIDL_PROGRAM_FILES are undeclaired identifiers

    also I tried it with
    TCHAR localised_path[MAX_PATH];
    SHGetSpecialFolderPath(NULL, localised_path, CSIDL_PROGRAM_FILES, 0);

  2. #2
    Join Date
    Jul 2003
    Posts
    147

    Re: Problem retrieving ProgramFiles path

    It looks like you have your paramater list out of order.

    Code:
    TCHAR szPath[MAX_PATH];
    
    if(SUCCEEDED(SHGetFolderPath(NULL, 
                                 CSIDL_PROGRAM_FILES, 
                                 NULL, 
                                 0, 
                                 szPath))) 
    {
        PathAppend(szPath, TEXT("New Doc.txt"));
        HANDLE hFile = CreateFile(szPath, ...);
    }
    "Live only for tomorrow, and you will have a lot of empty yesterdays today."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured