Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In an Activex with param, how to run some code on load ?

Status
Not open for further replies.

AmirFusion

IS-IT--Management
Jun 8, 2005
3

I have a VB6 Activex. I want to do something that when the Activix is loaded ,it runs some code.

Now, I have one button and I have to ask the user to click on it.

PS. my activex has 3 params that I pass to it using PARAM tags inside the OBJECT tag in HTML.

any hint to the right direction is appriciated.

Amir
 
I'm afraid you're sort of trying to do something that can't be done easily. What you're asking for is control of the constructor, and you don't have it, at least you have very little control.

When you use PARAM tags, you're setting properties of your ActiveX DLL (I'm assuming it's a DLL and not an EXE). These properties get set after you instantiate the object (in your words, "load the ActiveX").

You probably can't ask the ActiveX object to ask the user to click on a button as a direct consequence of instantiating the object (I don't think you can run any sort of code that interacts with the container, the container being your web page). You have to create a method in the ActiveX class and call that method from your client. (You'll need to use vbScript or some such.)

If you want to, you can experiment with the Class_Initialize event handler. This is the closest that you can come to a constructor--it runs when you instantiate the object--but, while you can "run some code" in it, you can't pass parameters to it. Keep in mind that your PARAM tags will be processed AFTER the Initialize event code is done.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top