Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to bring up the "Open With" window programatically?

3 views
Skip to first unread message

Mary Huang

unread,
Jul 31, 2000, 3:00:00 AM7/31/00
to
Hi,

I use ShellExecute to open files by taking advantage of the file
association. What about files which are not associated with any default app?
Windows bring up the "Open With" window.... I want to do something like
that. Is that an api call?

Thanks,

Mary

Alex Blekhman

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
"Mary Huang" <mhu...@ca.ibm.com> wrote in message
news:8m538p$nei$1...@tornews.torolab.ibm.com...

When calling ShellExecute you'll get HINSTANCE return value:

// launch the file with its associated application
HINSTANCE hInst = ::ShellExecute(...);

If returned value is greater than 32 - everything is OK. Else check
returned value for error.

// launch "Open With.." dialog
if(SE_ERR_NOASSOC == (int)hInst) {
SHELLEXECUTEINFO se = { 0 };
se.cbSize = sizeof(SHELLEXECUTEINFO);
se.fMask = SEE_MASK_CLASSNAME;
se.hwnd = hParentWnd; // parent window
se.lpVerb = _T("openas");
se.lpFile = pcszPath; // name of the file to open
se.lpClass = _T("Unknown");

::ShellExecuteEx(&se);
}

HTH
Alex

Mary Huang

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
Alex,

Amazing! That did it!! Thanks very much!!

Mary

Alex Blekhman <tk...@yahoo.NOSPAM.com> wrote in message
news:Ezth5.4488$TT2....@telenews.teleline.es...

0 new messages