Click to See Complete Forum and Search --> : DESPERATE : Please Help : Cascading folders under Start Menu


Vali
May 19th, 1999, 06:08 PM
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.

Jason Teagle
May 20th, 1999, 07:19 AM
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?