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

How to go to virtual desktop with opendialog

9 views
Skip to first unread message

SRD

unread,
Jan 24, 2007, 7:22:33 PM1/24/07
to
Anyone know how to get a regular opendialog to go to the main desktop
programmatically? I don't want to open the actual desktop folder but the
virtual desktop. Same as when you use the folder dropdown in the dialog and
select the desktop item at the top. Using D6. Found a lot of tricks for
the common file dialogs but not this one.

Thanks

Remy Lebeau (TeamB)

unread,
Jan 25, 2007, 12:46:28 AM1/25/07
to

"SRD" <st...@removeallthiscomcast.net> wrote in message
news:45b7f7e9$1...@newsgroups.borland.com...

> Anyone know how to get a regular opendialog to go to the main
desktop
> programmatically? I don't want to open the actual desktop folder
but the
> virtual desktop.

The "virtual desktop" is not a physical folder. The open dialog can't
return paths to virtual items, so why do you need to work with virtual
folders?

> Same as when you use the folder dropdown in the dialog and select
the
> desktop item at the top. Using D6. Found a lot of tricks for the
common
> file dialogs but not this one.

The open dialog is one of the common dialogs. What exactly are you
having a problem with?


Gambit


Chris Morgan

unread,
Jan 25, 2007, 4:37:43 AM1/25/07
to

Hi,

The desktop is just a folder within your user profile folder tree.
You can use the Win API function SHGetSpecialFolderPath to
get the directory path of the desktop, and then set this as the
opendialog's InitialDir.

cheers,

Chris


Xavier

unread,
Jan 25, 2007, 6:26:25 AM1/25/07
to

Usually, you'd set InitialDir to the CLSID of the special folder, like:

My Computer: InitialDir = '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}'
Recycle Bin: InitialDir = '::{645FF040-5081-101B-9F08-00AA002F954E}'

Desktop: InitialDir = '::{00021400-0000-0000-C000-000000000046}'

I must point out that getting the desktop as initial directory was a bit
of a hit-or-miss on my end. It wouldn't work at first, now it does, and
I did nothing to fix it. :/

Or maybe it's just the lack of coffee. :D

SRD

unread,
Jan 25, 2007, 7:49:26 AM1/25/07
to
> The desktop is just a folder within your user profile folder tree.
> You can use the Win API function SHGetSpecialFolderPath to
> get the directory path of the desktop, and then set this as the
> opendialog's InitialDir.

Yes, I've gotten that far with it too, but what I want is to be able to get
to the virtual desktop on the fly after the dialog is open, not just on
initial directory.


SRD

unread,
Jan 25, 2007, 7:47:10 AM1/25/07
to
> The "virtual desktop" is not a physical folder. The open dialog can't
> return paths to virtual items, so why do you need to work with virtual
> folders?

I'm trying to create my own "places bar" on the dialog (mostly to tie it in
visually to my application). I've been able to do that other than being
able to send the file listview to the virtual folder locations.


SRD

unread,
Jan 25, 2007, 7:58:01 AM1/25/07
to
> Usually, you'd set InitialDir to the CLSID of the special folder, like:
>
> My Computer: InitialDir = '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}'
> Recycle Bin: InitialDir = '::{645FF040-5081-101B-9F08-00AA002F954E}'
>
> Desktop: InitialDir = '::{00021400-0000-0000-C000-000000000046}'

Yes, got to this point too, thanks. I'm trying to add in my own replacement
"places bar" so I want to be able to send the file listview to the virtual
desktop even after the initial directory.

I can "brute force" the thing by going to the root and back up twice:

form1.ApOpenDialog1.SelectedFolder := '\'; //c:\
form1.ApOpenDialog1.SelectedFolder := '..'; //My Computer
form1.ApOpenDialog1.SelectedFolder := '..'; //Desktop

This gets me there, and I have a way of checking where I am along the way by
grabbing the folder dropdown's text but I don't like doing it this way as I
doubt it will be reliable.

> I must point out that getting the desktop as initial directory was a bit
> of a hit-or-miss on my end. It wouldn't work at first, now it does, and
> I did nothing to fix it. :/

This method seemed to work OK for me. I'll play around with it a little
more today and see what it does.

Stan

0 new messages