Results 1 to 2 of 2

Thread: setting properties

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168
    I am trying to set the property of an ActiveX control I made in html/vbscript.

    Here is the ActiveX Control's code:
    Code:
    Private MyJobKey As Variant
    
    Public Property Let JobKey(ByVal NewValue As Variant)
      MyJobKey = NewValue
    End Property
    
    Public Property Get JobKey() As Variant
      JobKey = MyJobKey
    End Property
    
    Private Sub Command1_Click()
      MsgBox Me.JobKey
    End Sub
    Here is the code for the vbscript:
    Code:
    <object 
    	ID="MyControl"
    	classid="CLSID:48A068E9-B3C8-4EB8-B0E8-60AF511F30EB"
    	width=80
    	height=30>
    </object>
    
    <script language=vbscript>
      MyControl.JobKey = 1
    </script>

    So the script should have set the MyControl's JobKey to 1, but when I click on Command1 the message box doesn't display 1. Any ideas?

    Thanks!
    Thai

  2. #2
    Lively Member The_Fog's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Posts
    65
    New activeX Com!

    Create the following code in a class called "GlobalKey"

    Public function jobKey(myKey as integer)
    MsgBox (myKey)
    End funtion

    save and compile it as Key.dll
    then use regsvr32 to register the dll.

    "regsvr32 key.dll"

    New Script:

    <script language="vbscript">
    set myControl = CreateObject("Key.GlobalKey")
    s = myControl.jobKey(1)
    </script>


    This will result in a msgbox (containing "1")displayed by the Com-Object.
    Hope this helped.

    The Fog
    They will try to steal everything you own,
    It goes on and on and on...


    Pain - On and On

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width