Image Viewer CP ActiveX Control

Web Developer Getting Started



Assuming that you have already run the Image Viewer CP Pro ActiveX Control installation program and started Microsoft FrontPage, the next step is to create a project.  Then use the "Insert/Advanced/ActiveX Control.." command to include the file "Image Viewer CP Pro ActiveX Control" into the new project

Select Control
Click Customize button select the Image Viewer CP Pro Control

Click OK to insert the ActiveX control.

The code as following:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="GENERATOR" content="Microsoft FrontPage 4.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>New Page 1</title>

</head>

<body>

<p><b><font size="2">File Path e.g(c:\test.jpg)</font></b><font SIZE="1"> </font><input TYPE="TEXT" Name="txtFile" Value size="20">

<input TYPE="BUTTON" Name="btnLoad" Value="Load Image"><br>

<br>

<input TYPE="BUTTON" Name="btnRotate" Value="Rotate"> <input TYPE="BUTTON" Name="btn25" Value="25% of Original">

<input TYPE="BUTTON" Name="btn33" Value="33% of Original"> <input TYPE="BUTTON" Name="btn50" Value="50% of Original">

<input TYPE="BUTTON" Name="btn100" Value="100% of Original"> <input TYPE="BUTTON" Name="btn200" Value="200% of Original">

<input TYPE="BUTTON" Name="btnFit" Value="Fit to Window"> <input TYPE="BUTTON" Name="btnAspect" Value="Aspect Ratio"><br>

<script LANGUAGE="VBScript">

Sub btnLoad_onClick
   ImageViewer1.FileName=txtFile.value
end sub

Sub btnRotate_onClick
  ImageViewer1.Rotate90
end sub

Sub btn25_onClick
  ImageViewer1.View=1
end sub

Sub btn33_onClick
  ImageViewer1.View=2
end sub

Sub btn50_onClick
   ImageViewer1.View=3
end sub

Sub btn100_onClick
  ImageViewer1.View=5
end sub

Sub btn200_onClick
  ImageViewer1.View=7
end sub

Sub btnFit_onClick
  ImageViewer1.View=9
end sub

Sub btnAspect_onClick
 ImageViewer1.View=10
end sub

</script>

<object CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331" width="14" height="14">

<param NAME="LPKPath" VALUE="imageviewer.lpk">

</object>

<object classid="clsid:C9460283-3EED-11D0-A647-00A0C91EF7B9" id="ImageViewer1" width="487" height="350">

<param name="_Version" value="65536">

<param name="_ExtentX" value="12885">

<param name="_ExtentY" value="9260">

<param name="_StockProps" value="0">

<param name="Border" value="-1">

<param name="HighQuality" value="-1">

<param name="ViewSize" value="0">

<param name="View" value="0">

<param name="FileWidth" value="0">

<param name="FileHeight" value="0">

<param name="FileName" value>

<param name="LicenseKey" value="demo">

<param name="JPEGQuality" value="100">

<param name="OutputGrayScale" value="0">

<param name="TIFCompression" value="0">

<param name="PDFCreator" value>

<param name="PDFKeyword" value>

<param name="PDFSubject" value>

<param name="PDFTitle" value>

<param name="PDFProducer" value>

<param name="PDFAuthor" value>

<param name="Hue" value="0">

</object>

</p>

</body>

</html>

When a web page contains ActiveX controls, these controls must be downloaded to the machine of the person viewing the web page. Therefore, each person viewing the page receives a copy of the controls on the web page. Licensing prevents the unlicensed use of controls downloaded in this manner.

ActiveX controls usually require a license file (.LIC) file to be used in a development environment. The .LIC file lets the creators of the control distribute it while protecting their ownership. When a browser loads an ActiveX control, it checks for the control's licensing. However, third-party owners of ActiveX controls do not allow you to distribute their .LIC files.

To allow ActiveX controls to work in browsers without the need for distributing .LIC files, Microsoft developed the license package (.LPK) concept. Each .LPK file contains run-time licensing information for all the ActiveX controls on a given web page. When the page is loaded into a browser, each control on the page is checked against the .LPK file. If the control is correctly referenced there, it is allowed to load. Otherwise, a license violation message is displayed. When you are developing pages using third-party controls, you must create an .LPK file for each page containing references to all the ActiveX controls directly on that page. You do not have to have run-time licensing information for ActiveX controls that are inside other objects on the page.

You can create an .LPK file using Microsoft's License Package Authoring Tool (LPK_TOOL). The tool is part of the Internet Client SDK (in the \bin subdirectory), available from the Microsoft website at http://www.microsoft.com.

In Image Viewer CP Pro ActiveX Control setup disk. You can find imageviewer.lpk in REDIST folder, so you do not need create a run-time license using LPK_TOOL. Place the .LPK file on your website in the same directory as your HTML files.