Solved

How to use ocx in asp.net page

Posted on 2009-04-07
6
561 Views
Last Modified: 2012-05-06
I am trying to include the ocx in the webpage

please guide me
0
Comment
Question by:PBCHANDRAN
  • 3
  • 3
6 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 20 total points
ID: 24084826
OCX is a client side object, you can embed it into webpage using object tag, like this:

<script language="javascript">
function CJSObject() {
      this.mAttrName = new Array();
      this.mAttrValue = new Array();
      this.mAttrNameNoValue = new Array();
      this.mParamName = new Array();
      this.mParamValue = new Array();
      this.SetAttr = function(sAttrName, sAttrValue) {
            this.mAttrName[this.mAttrName.length] = sAttrName;
            this.mAttrValue[this.mAttrValue.length] = sAttrValue;
      }
      this.SetAttrNoValue = function(sAttrName) {
            this.mAttrNameNoValue[this.mAttrNameNoValue.length] = sAttrName;
      }
      this.SetParam = function(sParamName, sParamValue) {
            this.mParamName[this.mParamName.length] = sParamName;
            this.mParamValue[this.mParamValue.length] = sParamValue;
      }
      this.GetObjectHTML = function() {
            var sRet = "";
            
            sRet += "<";
            sRet += "ob";
            sRet += "je";
            sRet += "ct";
            for (var i = 0; i < this.mAttrName.length; i++) {
                  sRet += " " + this.mAttrName[i] + "=\"" + this.mAttrValue[i] + "\"";
            }
            for (var i = 0; i < this.mAttrNameNoValue.length; i++) {
                  sRet += " " + this.mAttrNameNoValue[i];
            }
            sRet += "\">\r\n";
            for (var i = 0; i < this.mParamName.length; i++) {
                  sRet += "\t<";
                  sRet += "pa";
                  sRet += "ram";
                  sRet += " name=\"" + this.mParamName[i];
                  sRet += "\" value=\"" + this.mParamValue[i];
                  sRet += "\">\r\n";
            }
            sRet += "</";
            sRet += "obj";
            sRet += "e";
            sRet += "ct";
            sRet += ">\r\n";
            
            return sRet;                        
      }
}
</script>

then:

<script type="text/javascript">
      var gobjSLV = new CJSObject();

      gobjSLV.SetAttr("id", "yourObjID");
      gobjSLV.SetAttr("name", "objname");
      gobjSLV.SetAttr("width", "1px");
      gobjSLV.SetAttr("height", "1px");
      gobjSLV.SetAttr("classid", "clsid:E59B6131-5F73-B202-856F-146921A178BB");

      gobjSLV.SetAttr("type", "application/x-oleobject");
      gobjSLV.SetAttrNoValue("whatever");

      var sHtml = gobjSLV.GetObjectHTML();
      document.write(sHtml);
</script>

or follow link:

http://www.fpoint.com/support/whitep/ActiveX/ax1999.aspx#content
0
 

Author Comment

by:PBCHANDRAN
ID: 24085286
I want to access the function in asp.net by using ocx

and ocx will be writtern in vc++
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 24085298
ocx is not a server side object, you only can interact with it by javascript.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:PBCHANDRAN
ID: 24094647
I am using this Object tag in the Html page
I want to draw the lines in that object for that i have writtern ocx
The thing is  i have writtern draw function in ocx but it doesnt display in the  html page.
How to do it.
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 24095551
>>The thing is  i have writtern draw function in ocx but it doesnt display in the  html page.

Seems that you got some problem on your object, you can try post another question so that other experts can help you debug your object scripts.
0
 

Author Comment

by:PBCHANDRAN
ID: 24105001
yes the object is working fine
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Translate a cURL request to Classic ASP 4 346
post data with a link 8 49
Out the count variables 6 48
Auto Submit on dropdown box 3 36
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now