473,499 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6179
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
1770
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
3684
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
2290
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
1564
by: Shilpa | last post by:
Hi All, I need C# code needed to open the windows "Open with" dialog Regards, Shilpa
2
4384
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
2337
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
5385
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
1171
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
2430
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
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.