res: protocol and IMoniker
-
Has had any experience with using IMoniker to open files stored in dll's or exe's using the res: protocol. I have written code that uses CreateURLMoniker() and then IMoniker::BindToStorage() to open files and read their content via IStream. This works fine for file:, http:, ftp: protocols but fails when using the res: protocol which unfortunately is the protocol i am particularly interested in! I don't understand how IE does it since i can use CreateURLMoniker() and then pass the moniker to ShowHTMLDialog() and IE is happy to read the file. If I step through the code then my IBindStatusCallback::OnProgress() gets called with BINDSTATUS_MIMETYPEAVAILABLE and after the MIME type string 'text/html' in the szStatusText parameter is the text of the file i want to load but i don't get a good IStream* back from IMoniker::BindToStorage(). My original code used URLOpenBlockingStream() which suffers from the same problem when accessing res: resources. Please help!
-
Has had any experience with using IMoniker to open files stored in dll's or exe's using the res: protocol. I have written code that uses CreateURLMoniker() and then IMoniker::BindToStorage() to open files and read their content via IStream. This works fine for file:, http:, ftp: protocols but fails when using the res: protocol which unfortunately is the protocol i am particularly interested in! I don't understand how IE does it since i can use CreateURLMoniker() and then pass the moniker to ShowHTMLDialog() and IE is happy to read the file. If I step through the code then my IBindStatusCallback::OnProgress() gets called with BINDSTATUS_MIMETYPEAVAILABLE and after the MIME type string 'text/html' in the szStatusText parameter is the text of the file i want to load but i don't get a good IStream* back from IMoniker::BindToStorage(). My original code used URLOpenBlockingStream() which suffers from the same problem when accessing res: resources. Please help!
I am not sure there is a moniker for the res:// protocole. Actually, CreateURLMoniker is for http://, ftp://, and a few other. I am almost sure that CreateURLMoniker does not work with file:// for instance.
How low can you go ?
(MS retrof_u_ck) -
I am not sure there is a moniker for the res:// protocole. Actually, CreateURLMoniker is for http://, ftp://, and a few other. I am almost sure that CreateURLMoniker does not work with file:// for instance.
How low can you go ?
(MS retrof_u_ck)In my tests it works fine with the file: protocol. Thats the beauty of it, since an app can locate the resources it needs in a consistent way no matter where they are stored. Unfortunately the protocol handler for res: doesn't seem to work exactly like the others but it must be possible since you can create a IMoniker to a res: file and hand that to IE for it to load with no problems! I know that i could create my own pluggable protocol handler and that would then allow me to get at my files in resources but that seems like a lot of work when there must be slight change that i can make to the way i deal with the IMoniker interface to take advantage of Microsofts res: implementation.