Discussion:
how to use URLMoniker access a MIME type file in internet explorer
(too old to reply)
Jedi Luke
2005-03-23 18:13:22 UTC
Permalink
Hello, i want to open a special MIME type file in internet explorer
directly, does not appear the Internet File Download Dialog, just like
Windows Media Player open a WMV file url in internet explorer.
I found the solution in MSDN, URLMoniker can do this, but i don`t known how
to implement this, start my application to open a special url directly.

anyone can could do this?

Thanks,
Jedi Luke ***@hotmail.com
ismailp
2005-04-08 11:41:43 UTC
Permalink
It was quite long ago, I think I did something like that. I may have
used IMoniker, I don't remember.

IMoniker *pmk = NULL;
CreateMoniker(szUrl, NULL, &pmk, 0);

This creates a moniker.

Do you want MIME type? I am not sure if you can get mime type of an
object BEFORE server declares it. However, you can get its type name on
Windows (e.g. "Windows Media File", "Text File", etc) with following
way(s):

1. Get file name, search for "." from end of the string with StrRChr,
get the extension, then get file type name with SHGetFileInfo.
2. Get file name, use PathFindExtension() to determine extension, use
SHGetFileInfo to get file type name. (<-- preferred method).

LPTSTR lpszFileName; // assume that you copied file name into this
buffer
LPTSTR lpszExtension = PathFindExtension(lpszFileName);
if (!lpszExtension)
return E_FAIL; // failure?
SHFILEINFO sfi = {0};
TCHAR szBuffer[MAX_PATH] = {0};
wsprintf(szBuffer, TEXT("*%s"), lpszPath);
SHGetFileInfo(szBuffer, FILE_ATTRIBUTE_NORMAL, &sfi,
sizeof(SHFILEINFO), SHGFI_USEFILEATTRIBUTES|SHGFI_TYPENAME);

// use szTypeName of sfi.
Hope that helps.
Ismail

Loading...