Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I open folder in explorer from pidl?

1 view
Skip to first unread message

jmc...@ix.netcom.com

unread,
Aug 29, 1996, 3:00:00 AM8/29/96
to

I can run files after I get the pidl by using ShellExecuteEx. If I
use ShellExecuteEx with the pidl for a folder, it won't open. I can
open it by using the folder path for lpFile, but I need to be able to
open "My Computer" and "Network Neighborhood" too. Does anyone know a
way to do this?


Chris Becke

unread,
Aug 30, 1996, 3:00:00 AM8/30/96
to

When explorer itself opens a folder, it actually ShellExecutes another
instance of explorer like so:

explorer.exe /idlist,-2109848072,C:\internet

Turning the -nnn back into hex gives us:
0x823E45F8
which looks remarkable like an address in the global memory area!

While I haven't tried it, it seems possible to allocate a pidl in some
global memory, and pass the pointer to it as a cmd line parameter.

I don't think this is really an answer to your question, but it seemed fun
anyway, and it might help a bit :)

jmc...@ix.netcom.com wrote in article
<504quo$7...@sjx-ixn3.ix.netcom.com>...


Hmmm, if anyone does actually try this and succeed I'd be real interested
in hearing from you. :)

Chris
--
chr...@vironix.co.za (Chris Becke)
http://www.vironix.co.za/chrisb
Vironix Software Laboratories


Raymond Chen

unread,
Aug 30, 1996, 3:00:00 AM8/30/96
to

Here is a sample program that opens "My Computer" via ShellExecuteEx.
It should be obvious how to modify the program to open an arbitrary pidl:

#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <shlobj.h>

LPMALLOC g_pMalloc;

int __cdecl main(int argc, char **argv) {

if (SUCCEEDED(SHGetMalloc(&g_pMalloc))) {
LPITEMIDLIST pidl;
if (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DRIVES, &pidl))) {
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.fMask = SEE_MASK_IDLIST;
sei.lpVerb = "open"; // or "explore"
sei.nShow = SW_NORMAL;
sei.lpIDList = pidl;
ShellExecuteEx(&sei);
g_pMalloc->lpVtbl->Free(g_pMalloc, pidl);
}

g_pMalloc->lpVtbl->Release(g_pMalloc);
g_pMalloc = 0;
}

return 0;
}

--
(Note that my return address is intentionally invalid in order
to foil electronic mailing list generation software.)

0 new messages