CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    Houston
    Posts
    21

    DESPERATE : Please Help : Cascading folders under Start Menu

    How can I create CASCADING folders under start menu (on top of all of MS's stuff, not under Programs etc). Something like Programs or Favorites folder?

    What I need to do now is to “ADD” a folder to the “Start Menu” (not replacing MS menu, just adding on top with CSIDL_START_MENU pidl) and
    optionally show it as a cascading folder (like Programs).

    I posted this a week ago without any luck. Someone please help.




  2. #2
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: DESPERATE : Please Help : Cascading folders under Start Menu

    Once you have got your PIDL pointer from SHGetSpecialFolderLocation(), use SHGetPathFromIDList() to get the full path of the directory that the Start menu mirrors (it should be a path under your Profiles entry.

    This path is just like any directory - you can create new subdirectories (= cascading menus) and then create files or shortcuts in the subdirectories (= items in the cascading menu).

    Like this:

    ---// Add a menu or two to the start menu.
    pWndMain = AfxGetMainWnd();
    if (pWndMain != NULL)
    hWnd = pWndMain->GetSafeHwnd();

    if (::SHGetSpecialFolderLocation(hWnd, CSIDL_STARTMENU, &pPIDL) != NOERROR)
    AfxMessageBox("Failed to get Start menu folder!");
    else
    {
    bGotPath = ::SHGetPathFromIDList(pPIDL,(LPSTR)strPath.GetBuffer(_MAX_PATH) );
    strPath.ReleaseBuffer();
    if (bGotPath && strPath != "")
    {
    _chdrive(strPath[0]);
    _chdir( (const char *)strPath);
    if (_mkdir("My Start Menu Extension") != 0)
    AfxMessageBox("Couldn't create subfolder!");
    if (_chdir("My Start Menu Extension") != 0)
    AfxMessageBox("Couldn't set directory to subfolder!");

    // Now you can create files or shortcuts to go in this directory / menu level.
    }
    else
    AfxMessageBox("Couldn't get path!");

    // Retrieve a pointer to the shell's IMalloc interface.
    if (SUCCEEDED(SHGetMalloc(&pMalloc) ) )
    {
    // Free the PIDL.
    pMalloc->Free(pPIDL);
    // Release the shell's IMalloc interface.
    pMalloc->Release();
    }
    }




    ---

    Does this help?



    --
    Jason Teagle
    [email protected]

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