Visit Gigasoft's Web Site
 ProEssentials v9 Help
Chapter 3: ActiveX ASP Walk-Through

The following information demonstrates how to create your first ASP / ProEssentials implementation. It discusses using ASP to serve up a dynamically generated PNG image. Other examples are provided within the product/evaluation. If working with the Standard version, refer to the Readme.htm and AspReadMe.htm files installed onto your system with the eval/product (accessible via Start menu).


To see a similar pre-built example, within the included ASP.NET_WebDemo project. See example 8, with related files within the Walk-ThroughAsp folder.


When installing the ProEssentials evaluation and/or product, the setup program installs the ProEssentials DLL and ActiveX interfaces into the system directory. Files relevant to ASP development are:



ProEssentials Pro DLL
PEGOG.OCX Graph Object
PESGOG.OCX Scientific Graph Object
PE3DOG.OCX 3D Scientific Graph Object
PEPSOG.OCX Polar Object
PEPCOG.OCX Pie Chart Object
PE9API.INC ProEssentials ASP Include File


ProEssentials Standard DLL
PEGOSG.OCX Graph Object
PESGOSG.OCX Scientific Graph Object
PE3DOSG.OCX 3D Scientific Graph Object
PEPSOSG.OCX Polar Object
PEPCOSG.OCX Pie Chart Object
PE9API.INC ProEssentials ASP Include File

The setup program also registers the ActiveXs with the operating system which prepares IIS for creating ProEssentials components. You can manually register an ActiveX with "REGSVR32.EXE" found in your system/system32 dir. You can also use this utility to manually un-register an ActiveX by using the "-u" command. Un-Registering is useful when you want to test CAB download/installation issues on your development machine.


myfirst.htm / myfirst.asp Serving up a PNG...





<P>Run ASP Server Script via IMG src</P>

<IMG src = "myfirst.asp">



Open Notepad and enter the code shown to the left.


For simplicity, we recommend the IMG src line reference just a file name, with no path, but make sure to save files into the wwwroot dir.


Name this file "MyFirst.htm". Your server's local root directory is commonly C:\Inetpub\wwwroot.


This simple web page contains a single line paragraph followed by an image. The image's src is pointing to an ASP page "MyFirst.asp" which causes server-side code to execute and send back the image in a binary stream, ideal for web-farm environments.


myfirst.htm / myfirst.asp Serving up a PNG...



dim myobj

Set myobj = server.CreateObject("PEGOG.PegogCtrl.1")

myobj.MainTitle = "Hello Internet"

myobj.SubTitle = ""

myobj.PrepareImages = True

myobj.Subsets = 4

myobj.Points = 12

dim i

dim j

for i = 0 to 3

   for j = 0 to 11

      myobj.YData(i,j) = 5 + Rnd(20)



Response.BinaryWrite (myobj.PNGToStream(300,300))

Set myobj = Nothing



Using NotePad, create another file called "MyFirst.asp" and enter the corresponding code shown to the left.


Again, save this file into your web server's local root directory as you did with "MyFirst.htm".


Note the entire contents of "MyFirst.asp" are within <% ... %> tags.


"MyFirst.asp" contains ASP code (VBScript) which creates a ProEssentials component via the CreateObject method. CreateObject's only argument is a ClassID. In this case, PEGOE.Pegoectrl.1 is the ClassID for the ProEssentials Graph Object. Note, Standard users use PEGOGSTE.PegogStdCtrl.1


Next, the code sets the control's MainTitle and SubTitle properties.


Next, Subsets and Points properties are set and define the amount of data the control will contain.


Then, a nested for-next loop passes 48 random data points into the YData(s,p) two dimensional property array.


Next, FontSize is set to 0 which denotes large font. You will likely use our ProEssentials ASP Include file and then prototype your ASP code within Visual Basic. This lets you copy and paste your Visual Basic code directly into an ASP page because the include file holds the declarations for property enumerations.



myfirst.htm / myfirst.asp Serving up a PNG...


Finally, the Response.BinaryWrite ASP function retrieves a stream of image data from the ProEssentials PNGToStream method and passes it to the client's browser.


If you point your internet browser towards the file "MyFirst.htm", you will see a page similar to that shown to the left.


Refer to the "ASP Readme" file accessed via the Start menu to see more examples, including, rendering as an ActiveX, automatic downloading the ActiveX, client-side event scripting, and more.