Creation of activex document dll using visual basic and register it.
Aim : Creation of activex document dll using visual basic and register it.
Activex document :
General definition :
The easiest way to describe an ActiveX document is to call it a Visual Basic form that appears within a browser. Though not technically accurate – it does allow you to picture what is going on with ActiveX documents.
To be more technically accurate, an ActiveX document is a structured storage file that is displayed by an ActiveX component. The structured storage file is the VBD file you may have heard about and the ActiveX component is the ActiveX Document EXE or ActiveX Document DLL that you build when you define the ActiveX document project.
.Exe versus .dll:
Visual Basic offers you the choice of creating your ActiveX document project as an .EXE or a DLL. The differences between these lie in speed and safety. An .EXE runs “out of process” with respect to its container (the browser), which means that it has its own memory space. Communication between separate processes is slower, but because the .EXE runs in its own memory space, it can crash without causing the container to crash. A DLL runs “in process,” sharing the same memory space as the container. Intra-process communication is a lot faster, but a bug in the DLL can crash the container. Functionally, there is no difference between .EXE and DLLÑyou select one or the other depending on whether utmost speed or crash protection is more important to you.
Creation of Activex document:
An ActiveX document project is made up of a document that contains the data, and a server, or application, that provides the functionality. After compilation, the document is contained in a Visual Basic Document file (.VBD) and the server is contained in either an .EXE or .DLL file. During development, the project is in a .DOB file, which is a plain text file containing the definitions of the project’s controls, source code, and so on. If an ActiveX document project contains graphical elements that cannot be stored in text format, they will be kept in a .DOX file. The .DOB and .DOX files in an ActiveX document project are parallel to the .FRM and .FRX files of a regular Visual Basic executable project.
Deployment of activex document:
What are the logistics of deploying an ActiveX document? A deployment consists of one .VBD file for each document in the project, plus a compressed CAB file containing the compiled DLL or .EXE file. The CAB file may also contain the Visual Basic runtime and support files, or you can specify that these be downloaded directly from Microsoft’s site. This latter option reduces the size of your deployment but does not remove the requirement that the Visual Basic runtime and support files must be downloaded—only once, however—unless the user already has these files on the local system. This requirement for support-file download is another reason why ActiveX documents are more suitable for specific Web-based applications and are less suitable for a general “public” Web page.
Navigation of activex Document :
When a user navigates to an ActiveX document for the first time, here’s what happens:
1. The CAB file is downloaded.
2. The .EXE or DLL that contains the server is extracted from the CAB file and installed on the system.
3. If required, the Visual Basic runtime and support files are installed, either from the CAB or from the Microsoft download site.
4. The VBD file is either downloaded to the local computer or, more often, opened from the remote location.
Registration of .dll/.exe/.ocx :
REGSVR32 is a command-line tool that has a simple set of options
REGSVR32 command-line options.
/u Unregister the specified COM server
/s Register the COM server silently (with no visible output)
/c Register the COM server with output to the console
The REGSVR32 tool is used with the following command-line syntax:
Listing 1. GetPathFromFullFileName
Public Function GetPathFromFullFileName(FullFileName As String) _
' Passed a fully qualified filename, removes
' the filename part and returns the path information.
' Returns a blank string if there is no path information.
Strip any spaces.
FullFileName = Trim(FullFileName)
' Check for empty argument.
If Len(FullFileName) = 0 Then
GetPathFromFullFileName = ""
Look for last / or \.
If Mid$(FullFileName, idx, 1) = "\" Or _
Mid$(FullFileName, idx, 1) = "/" GetPathFromFullFileName = Left$(FullFileName, idx)
Listing 2. Code in UserDocument1
Private Sub UserDocument_InitProperties()
' Initialize the document's two data items.
path = GetPathFromFullFileName(UserDocument.Parent.LocationURL)
Hyperlink.NavigateTo path & "UserDocument2.vbd"
Private Sub txtUserName_Change()
' Tell the container than a property has changed.
'Tell the container that a property has been changed.
UserDocument_ReadProperties(PropBag As PropertyBag)
' Read the document's two data items from the property bag.
txtUserName.Text = PropBag.ReadProperty("UserName", "")
UserComment = PropBag.ReadProperty("UserComment", "")
UserDocument_WriteProperties(PropBag As PropertyBag)
' Write the document's two data items to the property bag.
PropBag.WriteProperty "UserComment", UserComment
PropBag.WriteProperty "UserName", txtUserName.Text
Listing 3. Code in UserDocument2
Private Sub cmdGoBack_Click()
finally , we have implemented the assignment successfully with understanding of basic features of acitvex document dll & creation of it using visual basic and at the last we register it.