Link to home
Start Free TrialLog in
Avatar of Grunge
GrungeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Distributing ActiveX components to client machines

I've so far found out that I need the files in a cab file.
I've never used a cab file b4.. it currently contains an OCX and a related DLL. Do I need to make an INF file for this cab?...

this is part of the ACTIVEX object tag in the code:

codebase="datepicker.cab"


...so how do i distribute ACTIVEX objects via my page?

perhaps a tutorial?
Avatar of Dave_Greene
Dave_Greene

Well you need to have the signed with Verisign.  You can build the .cab file using VB's Package and Deployment Wizard by selecting the internet deployment option.
Here is a listing of steps to be taken to ensure you are building your OCX correctly

1) Create an OCX Project (ActiveX Control)
2) right click your control, select add UserControl, then when you get into the VB dialog where you

normally select a usercontrol, select the wizard.
3) Add the Property you want to expose eg (Message) "My Custom Members" in the wizard
4) doesn't map to a control
5) When you get to the set attributes page, set Message to a string.

Your New Control Should Look Like this

'CODE BEGIN

'Default Property Values:
Const m_def_Message = "Empty Message"
'Property Variables:
Dim m_Message As String
'Event Declarations:

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=13,0,0,Empty Message
Public Property Get Message() As String
Message = m_Message
End Property

Public Property Let Message(ByVal New_Message As String)
m_Message = New_Message
PropertyChanged "Message"
MsgBox "Here is the Message you passed [" & m_Message & "]"
End Property

'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
m_Message = m_def_Message
End Sub

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_Message = PropBag.ReadProperty("Message", m_def_Message)
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Message", m_Message, m_def_Message)
End Sub

'CODE END

6) Build your OCX
7) set binary compatibility on the control in the projects properties.
8) Add a standard EXE to your project group
9) Place the Control onto form1.
10) Check to see if the value you set in the controls property page (on form1) actually change the value,



if so proceed.

If not, it's time to write a comment on EE stating so. (listing the control code)
11) it worked!  yahoo!  Now build your OCX again just to be certain you have any changes
12) Use the Package and Deployment wizard to build the deployment
- Using the "Internet Package" option
- Take the defaults until you get to the "Safety Settings" tab, you will select "NO" for Safe for

Scripting, and

"YES" for safe for initialization.
- Now you are finished... with this step
13) now look into the directory where you built the package. you should see projectName.htm, open it


It should look something like this

'HTML BEGIN

<HTML>
<HEAD>
<TITLE>Project1.CAB</TITLE>
</HEAD>
<BODY>
<!--     If any of the controls on this page require licensing, you must
 create a license package file. Run LPK_TOOL.EXE to create the
 required LPK file. LPK_TOOL.EXE can be found on the ActiveX SDK,
 http://www.microsoft.com/intdev/sdk/sdk.htm. If you have the Visual
 Basic 6.0 CD, it can also be found in the \Tools\LPK_TOOL directory.

 The following is an example of the Object tag:

<OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
 <PARAM NAME="LPKPath" VALUE="LPKfilename.LPK">
</OBJECT>
-->

<OBJECT ID="UserControl1"
CLASSID="CLSID:291EACFF-517D-4B6C-9EF0-A329A541AD8C"
CODEBASE="Project1.CAB#version=1,0,0,0">
</OBJECT>
</BODY>
</HTML>

'HTML END

14) Make the following changes (per this example)
   <OBJECT ID="UserControl1" Height="400" Width="400"  <--however big the control is
 CLASSID="CLSID:291EACFF-517D-4B6C-9EF0-A329A541AD8C"
 CODEBASE="Project1.CAB#version=1,0,0,0">
    param name="Message" value="Your New Message here!"
15) Save your changes and run the projectname.htm
16) If it works great, if not... time to comment again  :)

Cheers!  
Avatar of Grunge

ASKER

Give me a while to go through all that... but while I do let me just say from first glance that seems to be the most helpful and concise answer i've ever recieved!
Avatar of Grunge

ASKER

I'm not writing a brandnew control at the moment.. Its a downloaded datepicker supplied as a dll & Ocx.
listening...
Then it should be relatively simple, provided they have already signed the control!  If you can find a page where it is used you can just copy and paste the declarations it uses.  It will usually point to a .cab file that resides on the owners server... that way updates occur automatically

Cheers  :)
Avatar of Grunge

ASKER

I can't find a page that uses it. The development page I downloaded it from hasn't been updated for a year or so.
http://www.mvps.org/ccrp/
Where is this control?
Ok, you are going to have problems with this one.  

1) you didn't create it.
2) the person who did may or may not have had it signed.
3) you may have to pay for the control.

You could wrap the DLL & OCX up in your own CAB file, but the control will never be signed, and some browsers are set to reject unsigned controls.

I would send the guy an email asking him what his intentions are with this control, who knows maybe he's gotten it signed and it's available... or maybe he'll give you the code... never know.
Avatar of Grunge

ASKER

I'm using this one now...it only requires the vbrunSp3
my problem is to distribute this..

http://hjem.get2net.dk/vcoders/cm/resources/vcdtp.htm
ASKER CERTIFIED SOLUTION
Avatar of Dave_Greene
Dave_Greene

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
Avatar of Grunge

ASKER

Some contradicting txt on the site:

http://hjem.get2net.dk/vcoders/cm/general/vendor.htm#Top

Also..

Release version: Made the DateTime Picker independent of Steve McMahons SSubTmr6.dll. This means that there are no dependencies execpt for the VB6 SP3 Runtime files.
........................................................

The only problem is distributing the VB6-SP3 Runtime files.

I have a link to it however client machines clicking on this actutally activate the .exe on the server

server is currently win98 with pws.

:?)