Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - Standard "Open With..." dialog to choose helperapp
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

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

 Post Reply Post Reply
Author
Message
lorax1284 View Drop Down
Groupie
Groupie
Avatar

Joined: 10 September 2005
Location: Canada
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote lorax1284 Quote  Post ReplyReply Direct Link To This Post Topic: Standard "Open With..." dialog to choose helperapp
    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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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);
}
Back to Top
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.