In need of serious help : shell actions (open, edit, print, etc)

S

Sin

Hello everyone,

I'm totally stumped at how little info I can find in MSDN or on the web
concerning this. It's almost as if only microsoft personel hold the key to
these secrets or something!!!

I'm currently writting a program in which there is a file/folder list which
mimics part of Explorer's list. I've got it pretty much cornered, but I
still have a couple of problems :

1. I found a way to get the verbs associated with a file using
ProcessStartInfo.Verbs... This works fine, but I would like to get the text
associated with each of these verbs. For example, I have a verb called
EditWithVS7 for most text files... How do I get the associated text ("Edit
with Visual Studio .NET") ?

2. I would like to display, like explorer, the "long" file type, as in
"Bitmap Image", "Text File", "Application", "Application Extension", etc...
I have no idea where to find this info.

3. How would I display the "Properties" dialog

4. How would I display the "Open With" dialog

5. I would like to support the shell extensions (Add To Zip, Scan with
Norton, Upload using WS_Ftp, etc)

6. I would also like to know where to get the Send To entries...

I know I'm asking for alot, but damn I can't find any info anywhere on how
to do this with .NET... I've spent at least 3-4 hours looking and I can't
find a single clue.

Any help would be immensely appreciated!

Thanks,

Alex.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,
1. I found a way to get the verbs associated with a file using
ProcessStartInfo.Verbs... This works fine, but I would like to get the text
associated with each of these verbs. For example, I have a verb called
EditWithVS7 for most text files... How do I get the associated text ("Edit
with Visual Studio .NET") ?

You might need to explore the Windows registry and find a placewhere these
verbs are stored. Start from the

HKEY_LOCAL_MACHINE\Software\Clients key as the MSDN suggests new clients
should register their canonical and display names here. You may also want to
review the "Registering Programs with Client Types" topic in MSDN.
2. I would like to display, like explorer, the "long" file type, as in
"Bitmap Image", "Text File", "Application", "Application Extension", etc...
I have no idea where to find this info.


I beleive the same MSDN topic covers this.
3. How would I display the "Properties" dialog
4. How would I display the "Open With" dialog
5. I would like to support the shell extensions (Add To Zip, Scan with
Norton, Upload using WS_Ftp, etc)
6. I would also like to know where to get the Send To entries...

Well, here's a place to start from:

MSDN Library->User Interface Design and Development->Windows Shell->Shell
Programmer's Guide

Nodes to read first would be "Intermediate Shell Techniques" and "Advanced
Shell Techniques".
 
F

Fergus Cooney

Alex said (in the dotnet.languages.vb group):

|| Hello everyone,
||
|| I'm totally stumped at how little info I can find in MSDN or on the
|| web concerning this. It's almost as if only microsoft personel hold
|| the key to these secrets or something!!!
||
|| I'm currently writting a program in which there is a file/folder list
|| which mimics part of Explorer's list. I've got it pretty much cornered,
|| but I still have a couple of problems :
||
|| 1. I found a way to get the verbs associated with a file using
|| ProcessStartInfo.Verbs... This works fine, but I would like to get the
|| text associated with each of these verbs. For example, I have a verb
|| called EditWithVS7 for most text files... How do I get the associated
|| text ("Edit with Visual Studio .NET") ?
||
|| 2. I would like to display, like explorer, the "long" file type, as in
|| "Bitmap Image", "Text File", "Application", "Application Extension",
|| etc... I have no idea where to find this info.
||
|| 3. How would I display the "Properties" dialog
||
|| 4. How would I display the "Open With" dialog
||
|| 5. I would like to support the shell extensions (Add To Zip, Scan
|| with Norton, Upload using WS_Ftp, etc)
||
|| 6. I would also like to know where to get the Send To entries...
||
|| I know I'm asking for alot, but damn I can't find any info anywhere on
|| how to do this with .NET... I've spent at least 3-4 hours looking and
|| I can't find a single clue.
||
|| Any help would be immensely appreciated!
||
|| Thanks,
||
|| Alex.


Hi Alex,

It's not secret stuff only for Microsoft personnel, but it is Black Art
with a seemingly small circle of initiates!! I believe the information is all
out there but scattered.

What you're talking about is Shell programming. This has traditionally
been a difficult domain for VB programmers because Windows and Shell have some
very VB-unfriendly data structures. It has mainly been for the enjoyment of
the C++ fraternity. For this reason I praise to the heavens those VBers who
have produced something useful.

With VB.NET (and C#) much more of the OS type stuff is accessible. It's
not, however, been a major target for the .NET developers. They are advancing
on all fronts, it is true, but this is not one of the priorities. General
adaptability is more important than specific OS integration - even if it's
their own. But I'm sure this situation will improve.

I talk from the position of someone who is interested in all this but
doesn't have the burning passion that you have. Despite that, I have put in
considerably more than a few hours!! And I have <huge> gaps in my knowledge.
:-(

But that's because I can't use C++ and, like I said, that's where the
action is.

How can I help you? Only with advice, I'm afraid. These points are not in
any priority

** As this is not a strong point in .NET, much of what you want will be
uing the WinApi. Do your searches again but with WinApi and Shell in mind.

** Definitely make friends with the guys in microsoft.public.vb.winapi.
There's much knowledge available. They'll also pooh-poo my hesitations and
tell you top go for it! You'll be asking for a lot but spread it out, take
your time and I'm sure you'll get well along the road.

** Get hold of anything you can on the Registry. Much of the Shell 'mind'
resides there. Even if you access it through an API, it is very handy to know
how it all works. Again, this knowledge is scattered but there are some good
books. There are also plenty of web sites with various snippets. One keyword
there is Tweaks.
MS Press - Microsoft Windows XP Registry Guide Book
Sybex - Mastering Windows XP Registry
Hacking the Windows Registry

** Read and ponder the sections in the MSDN on Shell programming
http://tinyurl.com/pzlm
[This is a shortcut to MSDN - Shell Programmer's Guide]

That's all I've got for you but it should get you started. There's
actually more than you need in all that - be careful - it may spark your
imagination and before you know it you'll be rewriting the Shell!!

Good luck.

Oh, one last point - I've taken the liberty of cross-posting this to the
vb.winapi newsgroup that I mentioned. Who knows - your questions may even have
some specific answers waiting there for you! ;-)

Regards,
Fergus
 
S

Sin

What you're talking about is Shell programming. This has traditionally
been a difficult domain for VB programmers because Windows and Shell have some
very VB-unfriendly data structures. It has mainly been for the enjoyment of
the C++ fraternity. For this reason I praise to the heavens those VBers who
have produced something useful.

With VB.NET (and C#) much more of the OS type stuff is accessible. It's
not, however, been a major target for the .NET developers. They are advancing
on all fronts, it is true, but this is not one of the priorities. General
adaptability is more important than specific OS integration - even if it's
their own. But I'm sure this situation will improve.

I talk from the position of someone who is interested in all this but
doesn't have the burning passion that you have. Despite that, I have put in
considerably more than a few hours!! And I have <huge> gaps in my knowledge.
:-(

But that's because I can't use C++ and, like I said, that's where the
action is.

Well I'm a C++ programmer doing a VB.NET project, but I've never done any
shell programming in C++ so I have no clue either way. I did find out about
extending the shell namespace, but it doens't seem to be what I'm after. I
might be wrong.

Anyways, the bottom line is that this is a VB project but I can use C++ bits
if needed. No problem there, I just wouldn't know how to do it in C++
either, so I'm back to square one.

** As this is not a strong point in .NET, much of what you want will be
uing the WinApi. Do your searches again but with WinApi and Shell in mind.

I've been programming VB.NET for over a year now and I still haven't used
any API calls. The fun thing about .NET is that there's usually an
alternative for every single API call out there. I guess I might have found
an exception :)

** Definitely make friends with the guys in microsoft.public.vb.winapi.
There's much knowledge available. They'll also pooh-poo my hesitations and
tell you top go for it! You'll be asking for a lot but spread it out, take
your time and I'm sure you'll get well along the road.

I've been here and active for the past 4-5 years. I sent it to the .NET
group cause I didn't expect the solution to come through APIs.

That's all I've got for you but it should get you started. There's
actually more than you need in all that - be careful - it may spark your
imagination and before you know it you'll be rewriting the Shell!!

Haha! Don't worry... I've been through enough pain in this project already,
no chance in hell I'm sparking anything.

Alex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top