Print Page | Close Window

Standard "Open With..." dialog to choose helperapp

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=14613
Printed Date: 26 June 2024 at 4:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Standard "Open With..." dialog to choose helperapp
Posted By: lorax1284
Subject: Standard "Open With..." dialog to choose helperapp
Date Posted: 24 June 2009 at 10:19pm
Our software manages files, and we want to allow users to select "helper apps" for various types of files.

We would like to present the standard "Open With..." dialog to users from which they can choose the app they want to use.

I understand that this dialog is usually shown by the OS itself when a user attempts to launch an unknown file from Windows Explorer... but is there an API for this dialog so it can be used to set up helper apps?

(MFC, C++, Visual Studio .Net 2003)

Thanks in advance!

-------------
Ryan Germann
Product Manager &
UI Designer



Replies:
Posted By: mdoubson
Date Posted: 28 July 2009 at 8:44pm
You just need to call ShellExec with you type of file and if it not registrated as already existed association - ShellExec will open you prompt to find target
This is a sample from my old code - ext is string of file extention.
..............
int j = strFile.ReverseFind('.');
strFile = strFile.Left(j + 1);
strFile += ext;

if (::ShellExecute(GetSafeHwnd(),  "open", strFile, NULL, strPath, SW_HIDE) == (HINSTANCE) SE_ERR_NOASSOC)
{
AfxMessageBox("No Associations with extension " + ext + "\nYou should create one!");
           ShellExecute(GetSafeHwnd(), "open", "rundll32.exe", "shell32.dll,OpenAs_RunDLL " + strFile, strPath, SW_SHOW);
}


-------------
Mark Doubson, Ph.D.


Posted By: ijwelch
Date Posted: 29 July 2009 at 9:59pm
You can build menu yourself. The info is in registry. This site explains where:
- http://windowsxp.mvps.org/OpenWith.htm

-------------
ExtremeSuitePro 12.1.1
WinXP SP3


Posted By: mdoubson
Date Posted: 29 July 2009 at 10:09pm
Sure - but the idea is to give USER a choice to make association - not force him (e.g. our app generate some image of special format we don't have internal viewer but user can have some "universal" image viewer he can choose)

-------------
Mark Doubson, Ph.D.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net