Solved

Problems with ActiveX control

Posted on 2001-07-09
15
860 Views
Last Modified: 2010-07-27
I have an ActiveX control that I want to publish on the internet. I have recently encountered a big problem, when I add a referance to mshtml.tlb (Microsoft HTML Object Library). When I add it to my control it works fine on the win98 I have VB on, but when I try to run it (compiled ocx, packaged it with the package and deployment wizard) on  a win2k computer the program just won't start. If I remove the referance it works without problems!

any ideas?
thx
0
Comment
Question by:kristofer
  • 6
  • 4
  • 3
  • +1
15 Comments
 
LVL 7

Expert Comment

by:Inteqam
ID: 6265352
maybe you are not distributing the tlb file.
0
 
LVL 2

Author Comment

by:kristofer
ID: 6265369
I am, it's in the list, and furthermore the file (MSHTML.tlb) is allready on the win2k comp. I can run programs that uses it, just not ActiveX controls. If I turn it into a document dll, register it and run the vbp file it works fine!
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 6265420
then, i think it is a licensing problem.
this is my 2 cents.
0
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6265452
Try the late binding, perhaps it will solve your problem.
(Because of typelib conflicts):
---------------------------------------------------------
Dim MyObject As Object
Set MyObject = CreateObject("MSHTML.HTMLxxx")

and so on ...

Hope this helps
WoK
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 6265480
good idea
good luck :o)
0
 
LVL 2

Author Comment

by:kristofer
ID: 6268029
OK, Wolfgang. Could you please, or anyone explain that a little further. Say I want to load an html webpage from "webbrowser1" to htmlDoc1 where htmlDoc1 is an IHTMLDocument.

Normally, I'd just type:
dim htmlDoc as IHTMLDocument
set htmlDoc = webbrowser1.Document

thx
0
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6268425
First you must(can) remove the project reference to the
Microsoft HTML Object Library. Then do following:

dim htmlDoc as Object
set htmlDoc = CreateObject("MSHTML.IHTMLDocument")

Thats late binding (without a hard project reference to the HSHTML type lib).
Thats all.

Best regards
WoK
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:kristofer
ID: 6268564
Have you tried that code out? are the "" supposed to be there? when I try I get a run time error:

Run-time error '429':
ActiveX component can't create object

Ideas?
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6270892
It could be a problem with the setup wizard not correctly registering the mshtml.tlb...  could you post your setup.inf file here
0
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6272620
You are right ... I have the same problem
I think you can't do it so (regretfully) ...
and therefore you can't invoke
it through CreateObject("MSHTML.HTMLDocument").
I search the registry and find that the progid of MSHTML is
'htmlfile', therefore when you write:

Dim Myhtmldoc As Object
Set Myhtmldoc = CreateObject("htmlfile")

it should function. It provides an object of the type:
"HTMLDocument". Crazy at all ...

Hope this helps
WoK

0
 
LVL 2

Author Comment

by:kristofer
ID: 6272841
OK, that seems to work... Atleast I don't get an error msg... However I need a lot more than the HTMLDocument. I need the following...

HTMLWindow2
HTMLDocument
IHTMLDocument
IHTMLElementCollection
IHTMLElement
IHTMLInputFileElement
IHTMLInputTextElement
IHTMLInputButtonElement

I tried CreateObject("htmlfile.HTMLWindow2") etc. but that didn't work... how do I search the registry? complicated I guess...
0
 
LVL 2

Author Comment

by:kristofer
ID: 6272894
NO... that didn't work either. It worked on the win98 I developed it on, but not on the win2k's that my clients will use... I get "Object does not support this property or method".

increased points to 50 then doubled... any ideas?
0
 
LVL 4

Accepted Solution

by:
WolfgangKoenig earned 100 total points
ID: 6273815
The problem you have is the incompatiblity between
WIn98 and WIN2000 mshtml.tlb (+.dll).

tlb stands for type lib

Type libs are backward compatible! and thats the reason
whye you should recompile your control on the win2000
system.
Then i should function under WIN95 and WIN2000!!

This should helps and you don't need
late binding anymore ...

Nice day
WoK

0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6273891
<<how do I search the registry?>>

Go to Start > Run ... type regedit hit Enter
0
 
LVL 2

Author Comment

by:kristofer
ID: 6297758
Took some time to install VB on the win2k, but it seems to be working fine now. thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vba is buggy because of corrupted user profile. Any fast way to fix it? 28 127
VB6 code to programmatically convert pdf to excel 21 70
VB error "Type mismatch" 2 50
using Access 8 59
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now