ASP and ActiveX control interactively combat (2)

zhaozj2021-02-16  153

tornado

Keywords: ASP, ActiveX control, digital signature, security

Let's take a look at how to get data from the server and pass it to the ActiveX control.

1) Use parameters binding when initialization

2) Get data at runtime

Open VB6, create a new ActiveX control project.

Engineering Name: FOCX, User Control Name: UC2

For convenience, we use the ActiveX Control Interface Wizard ..., Menu -> Add,> Explorer -> VB 6 ActiveX Control Interface Wizard. OK.

Open ActiveX Control Interface Wizard, Next Members choose Text, next step until completion. There will be some unwanted, delete, and

'note! Don't delete or modify the following is commented!

'MappingInfo = txtinfo, txtinfo, -1, text

Public property get getInfo () AS STRING

GetInfo = txtinfo.text

End Property

Public property let getinfo (Byval new_getinfo as string)

TXTINFO.TEXT () = new_getinfo

PropertyChanged "getInfo"

End Property

Private submmand1_click ()

Label2.caption = getInfo ()

End Sub

'Load the attribute value from the memory

Private sub UserControl_readproperties (Propbag As Propertybag)

Txtinfo.text = propbag.readproperty ("getInfo", "text1")

End Sub

'Write the attribute value to the memory

Private sub UserControl_WriteProperties (Propbag As Propertybag)

Call Propbag.writeProperty ("getInfo", txtinfo.text, "text1")

End Sub

Compiled into an OCX control. Run the generated test page. Default is Text1

How do I pass the server's data to OCX?

Using Microsoft ActiveX Control Pad tools can be easily found.

Use this tool to open the test page.

Menu -> Edit-> Edit ActiveX Control, huh, open a visual interface.

I saw it, there is a property box, we can set it, the code after the completion is as follows:

new page </ title></p> <p></ HEAD></p> <p><Body></p> <p><Object id = "getClient" width = 507 height = 440</p> <p>ClassID = "CLSID: 890D1028-298B-45CF-9A64-6ED5A5BACBC9"</p> <p>Codebase = "http://localhost/xml/focx.ocx"></p> <p><Param name = "_ extentX" value = "13414"></p> <p><Param name = "_ exTenty" value = "11642"> <param name = "getInfo" value = "This is OCX's client reader information"></p> <p></ Object></p> <p></ Body></p> <p></ Html></p> <p>Increase the ID, ID is the sign we use. There is also our property GetInfo, we also set the initial value.</p> <p>Ok, run.</p> <p>There is a value we set in text "This is the information of the client reader" obtained by OCX. "</p> <p>We change the page on the top of the page to the ASP, see the code:</p> <p><Html></p> <p><HEAD></p> <p><Title> Tornado Test Page </ Title></p> <p></ HEAD></p> <p><Body></p> <p><%</p> <p>DIM Svalue</p> <p>Svalue = "This is the information of the client reader obtained by OCX"</p> <p>%></p> <p><Object id = "getClient" width = 507 height = 440</p> <p>ClassID = "CLSID: 56DFCA88-F5B8-4879-853B-97FE504423FD"</p> <p>Codebase = "http://localhost/xml/focx.ocx"></p> <p><Param name = "_ extentX" value = "13414"></p> <p><Param name = "_ excenty" value = "11642"></p> <p><Param name = "getInfo" value = "<% = svalue%>">></p> <p></ Object></p> <p></ Body></p> <p></ Html></p> <p>OK, run</p> <p>Let's take a look at the second situation</p> <p>Get data at runtime</p> <p><Html></p> <p><HEAD></p> <p><Title> Tornado Test Page </ Title></p> <p><%</p> <p>DIM Svalue</p> <p>Svalue = "This is the information of the client reader obtained by OCX"</p> <p>%></p> <p><Script id = client, = javascript></p> <p><! -</p> <p>Function button1_onclick ()</p> <p>{</p> <p>GetClient.getInfo = '<% = svalue%>';</p> <p>}</p> <p>// -></p> <p></ Script></p> <p></ HEAD></p> <p><Body></p> <p><Object id = "getClient" width = 507 height = 440</p> <p>ClassID = "CLSID: 56DFCA88-F5B8-4879-853B-97FE504423FD"</p> <p>Codebase = "http://localhost/xml/focx.ocx"></p> <p><Param name = "_ extentX" value = "13414"></p> <p><Param name = "_ excenty" value = "11642"></p> <p></ Object></p> <p><Input ID = Button1 Type = Button Value = Button Name = Button1 Language = JavaScript οnclick = "Return Button1_Onclick ()> </ body></p> <p></ Html></p> <p>After running, click the button to see the effect.</p> <p>Last continued</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-7933.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="7933" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.067</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'gbh1wa3csiLmhH2jLt59LePc_2FmKseqE_2BtQLDKWhqWuDFicunP06039j1OCQA3ZcjNxqB9Ndq9G75kCXriKtVow_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>