Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open "My computer" 1

Status
Not open for further replies.

Leibnitz

Programmer
Apr 6, 2001
393
CA
can we open "My computer" with this code ?

ShellExecute(handle, NULL, path_to_folder, NULL, NULL, SW_SHOWNORMAL);


it not,how i should proceed ?
 
Not quite, but you can do it with this code:

LPITEMIDLIST pidl = NULL;

if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidl)))
{
SHELLEXECUTEINFO ei;
ZeroMemory(&ei,sizeof(ei));
ei.cbSize = sizeof(ei);
ei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_IDLIST;
ei.lpIDList = pidl;
ei.lpVerb = "open";
ei.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&ei);
IMalloc * im;
SHGetMalloc(&im);
im->Free(pidl);
im->Release();
}

You need to include shlobj.h to compile this, BTW. :) I just can't help it, I like MS...:)
 
Thanks DaveTips for your help,the code works perfectly.
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top