Standard "Open With..." dialog to choose helperapp |
Post Reply |
Author | |
lorax1284
Groupie Joined: 10 September 2005 Location: Canada Status: Offline Points: 14 |
Post Options
Thanks(0)
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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); } |
|
ijwelch
Senior Member Joined: 20 June 2006 Status: Offline Points: 262 |
Post Options
Thanks(0)
|
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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)
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |