Link to home
Start Free TrialLog in
Avatar of freter
freter

asked on

URL Monikers

Has anyone got a clue how to write an URL Moniker?
I am trying to use the Intenet Explorer to display HTML files that I pull out of a OLE2 structured storage file. Microsoft does s.th very similar in their Infoviewer 5 (comes with the MSDN): If you have the MSDN installed an type something like
mk:@ivt:activex/start.htm
IE will display the file start.htm from the knowledgebase file activex.ivt.
I already have found out that "ivt" in the above URL is registered in the registry and seems to be an URL Moniker. And from the MSDN I found out that I need to write an URL Moniker server.
Before I waste my time re-inventing the wheel: has somebody out there already written one?
Best regards,
Freter
Avatar of ronit051397
ronit051397

Avatar of freter

ASKER

Hm...
I have seen that before, but it doesn't help me.
I need a DLL that can be invoke by Intenet Explorer, just like the ivtmon.dll that is referenced by the string "ivt" in the URL depicted in my question.
Sorry, I can't help you with this issue.
Yep, did that one some time ago. It was a pain in the ass to get all the information, because it is only well documented how to *use* monikers, but not how to *write* them.
I built a sample moniker that simply displays HTML files from a file system or an error message if the file was not found. E.g. you set the moniker root to
c:\hello
and type in IE
mk:@slashmoniker:/my/baby.html
it would load c:\hello\my\baby.html
Sure you could dispatch any path to anywhere.
You'll get the moniker code for 300 points, it took me about 5 weeks to figure all the details out.

Slash/d003303
Avatar of freter

ASKER

Slash/d003303:
One question before I increase the points for you:
Is your moniker able to provide the embedded images of the html page out to explorer?

Freter

Yo,
all embedded objects (images, plug-in codbases, etc.) that have a relative path are combined to a full qualified path by IE before they are requested. E.g. if <IMG SRC="/images/help.gif"> is part of a page provided by my moniker, IE would create the full referenced path mk:@slashmoniker:/images/help.gif.
Because IE builds full referenced URLs compilant to RFC 2068, you can also prefix the moniker root like M$ does. The "mk:@slashmoniker:" identifies the protocol (equi to http:), then comes the "//(server)" part, then a directory/file path (you may omit the server part). So if the page location of the above example would be mk:@slashmoniker://MyDatabase/about.html, IE would refer the picture path to mk:@slashmoniker://MyDatabase/images/help.gif.
This gives you flexibility on interpretation of the URL and organization of your database archive. E.g. you could also provide mk:@slashmoniker:MyServer//MyDatabase/about.html as a page location, the image would be in mk:@slashmoniker:MyServer//MyDatabase/images/help.gif. Or mk:@slashmoniker:MyDomain:MyServer//MyDatabase/about.html, etc.
You can do anything you like and easily run a website fromout a database.
Hope this answers your question.

Slash/d003303
Avatar of freter

ASKER

Slash:
Ok. I'll increase the points.

Freter
ASKER CERTIFIED SOLUTION
Avatar of d003303
d003303

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
An example to register a moniker called by mk:@HelloWorld

// BOC //
REGEDIT4

[HKEY_CLASSES_ROOT\HelloWorld]
@="Hello World Moniker"

[HKEY_CLASSES_ROOT\HelloWorld\CLSID]
@="{556F12A1-DE94-11D1-B4EA-0000E82D8A65}"

[HKEY_CLASSES_ROOT\HelloWorld\CurVer]
@="HelloWorld.1"

[HKEY_CLASSES_ROOT\HelloWorld.1]
@="Hello World Moniker V1"

[HKEY_CLASSES_ROOT\HelloWorld.1\CLSID]
@="{556F12A1-DE94-11D1-B4EA-0000E82D8A65}"

[HKEY_CLASSES_ROOT\CLSID\{556F12A1-DE94-11D1-B4EA-0000E82D8A65}]
@="Hello World Moniker V1"

[HKEY_CLASSES_ROOT\CLSID\{556F12A1-DE94-11D1-B4EA-0000E82D8A65}\InprocServer32]
"ThreadingModel"="Apartment"
@="D:\\Program Files\\MyMoniker.dll"

[HKEY_CLASSES_ROOT\CLSID\{556F12A1-DE94-11D1-B4EA-0000E82D8A65}\ProgID]
@="HelloWorld.1"

[HKEY_CLASSES_ROOT\CLSID\{556F12A1-DE94-11D1-B4EA-0000E82D8A65}\Version]
@="1"

[HKEY_CLASSES_ROOT\CLSID\{556F12A1-DE94-11D1-B4EA-0000E82D8A65}\VersionIndependentProgID]
@="HelloWorld"

// EOC //

Slash/d003303
Avatar of freter

ASKER

Thanks a lot, Slash!
This is exactly what I have been looking for. It works perfectly for me.
I had only little time this morning to look through all of the code, so maybe I will have some questions regarding the source the next few days.

Ok, no prob.
Avatar of freter

ASKER

Hi Slash, still listening on this thread?

I've got some probs with the Moniker. When I use it with IE 4.0, everything is just fine, but when running in IE 3 (no matter which build #), it just reports an access violation in mshtml.dll after loading the 4th unique file.
I woul be *very* glad if you could spend a minute or two helping me with this bug!

Freter
Yo,
still listening. I just tried over and over, no problems.
So, do you still run the moniker in file-access mode or have you already bound it into the OLE structured storage ? If you are still working in a file system, could you send me an archive with these files ?
Also, take a look at the debug file and see where the moniker crashes. This is a very helpful information.

Slash/d003303
Avatar of freter

ASKER

Hm.
I used the code you provided here. Then I put five different really plain HTML files in the root and called them via the moniker. The important thing is: the fifth unique file will cause a crash. If you try to load files that are not unique (like call only two files alternatingly), no crash will occur.
This problem arises as well with the code that reads from a file system as well as with my code that binds to OLE Structured Storage. And: it only occurs with IE3x, *not* with IE4x!
I don't have the code here today, but I can send it to you tomorrow, together with the debug.txt.

Later
Freter
Ok, awaiting your mail :)
d003303,

Do you have a similar example that takes advantage of the IBindStatusCallback interface?


cdcoppola,

sorry, haven't done that yet.