473,224 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

call windows' "open with" dialog

Hi all,
I need to call windows' "open with" dialog from my C# windows form
application. After the user selects application, control must return to
me (I have to launch directly the process).
I found this solution:

http://www.codeproject.com/KB/shell/openwith.aspx

but it's not good for me since it will execute the process directly.

There is a way to call "open with" dialog and retieve selected application?

Thank you in advance

Bests,
Stefano Tonello
Aug 3 '08 #1
5 6150
Good morning Stefano. Welcome to Microsoft Newsgroup Support Service! My
name is Jialiang Ge [MSFT]. It's my pleasure to work with you on this post.

The solution at http://www.codeproject.com/KB/shell/openwith.aspx is the
same as the command:
Rundll32.exe shell32.dll, OpenAs_RunDLL C:\test.jpg

To retrieve the control of launching the selected application in our own
process after we bring up the "Open With" dialog, there is no direct way. (I
will explain the reason in detail). However, we may have some workarounds
depending on your specific context. Let's first look at the possible
solutions, then I will explain "WHY"s.

---- POSSIBLE SOLUTIONS ----

WORKAROUND 1: Building our own "Open With" dialog.

To be honest, rolling our own OpenAs dialog is something that is hard to
work perfectly. There will be many tests to do to eliminate the bugs. We can
get a list of apps registered to execute a certain file type by groveling
the registry http://windowsxp.mvps.org/OpenWith.htm or using the API:
SHAssocEnumHandlers
http://msdn.microsoft.com/en-us/libr...09(VS.85).aspx (The API is
available to Windows Vista and the above).

WORKAROUND 2: If your request can be adjusted to "how to get the selected
application in the 'Open With' dialog after the file is opened by the
default 'Open With' process", we can consider using the process handle:

http://forums.msdn.microsoft.com/en-...-74008a0632c6/
(see Martin's reply)

---- CAUSES -----

A. WHY can't I retrieve the control to launch the selected application in
our own process from the shell "Open With" dialog?

1. The OpenAs dialog runs in a separate process (rundll32.exe), so we have
no way of marshalling the process handle back from the OpenAs dialog process
into our process
2. Some types of apps do not support returning the process handle. Apps that
use DDE or drop target invocation does not return a process handle because
their model is typically to have one running process that multiple
ShellExecutes call into.

B. WHY isn't the first workaround very perfect?

Workaround 1 is not perfect because I'm not sure how you would actually
execute the file once the user selects the app. It would only work if the
executing app took a command line argument with the file name, which pretty
much rules out anything that uses DDE or IDropTarget.

Please let me know whether my suggestions are helpful to you. If you have
any other questions or concerns, DON'T hesitate to tell me.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

"Stefano Tonello" <cu********@newsgroup.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi all,
I need to call windows' "open with" dialog from my C# windows form
application. After the user selects application, control must return to me
(I have to launch directly the process).
I found this solution:

http://www.codeproject.com/KB/shell/openwith.aspx

but it's not good for me since it will execute the process directly.

There is a way to call "open with" dialog and retieve selected
application?

Thank you in advance

Bests,
Stefano Tonello

Aug 4 '08 #2
On Aug 3, 10:55*pm, Stefano Tonello <cubevis...@newsgroup.nospam>
wrote:
Hi all,
* * * * I need to call windows' "open with" dialog from my C# windows form
application. After the user selects application, control must return to
me (I have to launch directly the process).
I found this solution:

http://www.codeproject.com/KB/shell/openwith.aspx

but it's not good for me since it will execute the process directly.

There is a way to call "open with" dialog and retieve selected application?

Thank you in advance

Bests,
* * * * Stefano Tonello
Hi

I think you can invoke "OpenWith" dialog only through interop services
provided by .Net. Try PInvoke for the same.

There is no direct way to as similar to OpenFileDialog /
ColorDialog .. etc.
-Cnu
Aug 4 '08 #3
Hello Stefano,

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Aug 6 '08 #4
Dear Jialiang,
I'm sorry for the late reply. I really appreciate your help.
I hope to work with you again

Bests,
Stefano Tonello

Jialiang Ge [MSFT] ha scritto:
Hello Stefano,

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
Aug 7 '08 #5
Hello Stefano,

You are surely welcome to work with me again. I look forward to more and
more successful cooperation with you in future. When you have any other
questions, please DON'T hesitate to post it in our newsgroups
(http://msdn.microsoft.com/en-us/subs.../aa974230.aspx) and we (MSFT)
will do our best to help you.

By the way, I notice that this is your first post to use our newsgroups. I
appreciate to hear from your comments/feedbacks of our support service,
website design, our product limitation, our process, and etc, so that we
can do better for you in future. (our feedback link: ms****@microsoft.com)

Have a great day!

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Aug 8 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Micah | last post by:
I know it's possible to use os.startfile() to open/execute a file based on its extension, but when a file is not recognized, I get a WindowsError with Errno 1155. Is there any way (using...
7
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
3
by: JoNaS | last post by:
As a lot of us might now, the input file (aka browse button) in html does not allow for multiple file selection or for filtering file types. The File Open dialog used in WinForms allow these things...
1
by: Shilpa | last post by:
Hi All, I need C# code needed to open the windows "Open with" dialog Regards, Shilpa
2
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question in relation to opening files from C#. I have a Windows form where I allow the user to type in a file extension in a text box (e.g., "xls"). I then take...
3
by: Mark.V.Sullivan | last post by:
I have encountered the same problem another posted about several months ago. Unfortunately, there was no result posted on the old thread. I will let the original message text stand and ask if...
5
by: charles | last post by:
I have a question about the file Open dialog box. I would like to be able to make the dialog box bigger by selecting the bottom right-hand corner and dragging/expanding the box. I am told by...
2
seshu
by: seshu | last post by:
Hi Everybody I have a small doubt regarding open with dialog box guys i have designed a small soft ware in which i am opening a wave file like this ...
1
by: yoavyoavyoav | last post by:
Hi There , Is there a way the Process.Start() method will open the "open with" dialog if a file association is not available ? if not , is there any equivalent ? Thanks in advance.
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.