+ Start a Discussion

ActiveX control - passing parameters

I have developed an activex control in VB6 which will be deployed as a sForce control. I am not able to retrieve the parameters passed to activex control from the Object tag:

<OBJECT ID="SchedTasks"

<PARAM Name="ServerURL" Value="{!API_Enterprise_Server_URL}">


The ReadProperties event in activex control is never fired. The reason I think is that Internet Explorer treats my control as unsafe (it displays a warning), though my component is marked safe for scripting and initialization.

I will appreciate if someone can give me a working example showing how to fix it.



Hi agarg,

I don't know how to fix it, but I do have a work around.   You can create a javascript snippet that sets properties on the control using the control's id.  You would create public properties on your control for the properties you want to expose to javascript such as Public Property Let EnterpriseServerUrl(byval value as string)

Then in the javascript you would do something like:

<script defer>SchedTasks.EnterpriseServerUrl = '{API_Enterprise_Server_Url}';</script>

The defer attribute of the script tag will cause it to wait to be executed until the document is done loading, thereby assuring that the SchedTask object will be available.




Thank you Dave. Your suggestion about exposing the properties from ActiveX control helped me fix the problem. The <Script Defer> thing did not work but the following did:

function setVal() {
<BODY onload="setVal();">

A Garg




Ron HessRon Hess

I am also trying to pass paramaters into active X scontrol and using the onLoad="setval()" i get a warning message everytime i open the page.  The message is

an active x control on this page might be unsafe to interact with other parts of the page, do you want to allow y ? n

Is there any way to avoid this explorer message ?

ok, I found the answer---

need to add the safe to script and safe to init keys into the registry under this control, i thought the cab install would do this for me, but appears that i was missing this when testing localy

Message Edited by Ron Hess on 05-08-2004 09:32 AM


Could someone please tell me what is wrong with this script:

<p>Hello World Control<br> <br>
<object id="HelloWorldControl1"
height="500" width="500">   

The Hello World Control and Done text appear, however, the ActiveX control only shows up as a dimmed vertical scroll bar. 

The ActiveX control is very simple.  It generates a button that when clicked produces a line of text.  The ActiveX control is written in C#.  I've tried this out on a webserver outside of SF and it works fine.

Thanks in advance for your help.




The clsid parameter looks wrong to me. Shouldn't it contain a GUID (see the example at the top of the thread)

I'm guessing this is going to be much more difficult than I had hoped.  I found this link on MSFT site (http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx).  My question to SForce is can I use the new classid syntax ?

ActiveX controls, .NET controls are loaded via the HTML OBJECT tag. Note the syntactical differences, though. A typical ActiveX OBJECT tag looks like this:

<OBJECT id="upload1" classid="CLSID:EE0C7AF7-6744-4017-93C5-

In ActiveX, all objects are identified by their CLASSID, a 128-bit Global Unique Identifier (GUID). The CODEBASE attribute is used to specify either the portable executable (PE) in which the object resides, or a Cabinet file containing the PE.
.NET, by contrast, uses what is called no touch deployment, meaning that .NET assemblies do not have to alter the registry or any other system files in order to be recognized by the runtime. If you run the Visual Studio-based utility DUMPBIN on a .NET DLL, you'll notice that the familiar COM exports, such as DllRegisterServer, are absent. So the OBJECT tag looks a little different:

<OBJECT id="upload1" classid=
width=800 height=300 style="font-size:12;">
<PARAM Name="FileUploadURL" 
<PARAM Name="MaxSessionUpload" 

The CODEBASE attribute is gone; instead, I overload the CLASSID attribute with the following syntax


where component-name identifies the .NET assembly, namespace-path names the namespace in which the Windows Forms control is located, and control-name is the name of your Windows Forms control subclass. Internet Explorer parses this string and looks for the assembly in the specified location. By default, it looks in the current Web server directory (APPBASE), and then in that directory's bin directory.



Hi ScottB,

You won't be able to use a UserControl (formerly activeX) written using any .Net language.  The reason is the MS in their (fill in the blank) wisdom have made the security model dependent on the server that is hosting the control.  This means that the server must be an IIS 5.0 server.  The control inherits some security information from the IIS server that hosts the control.  salesforce.com does not run IIS, and therefore, you cannot use a UserControl in the same way you would use an ActiveX control.





Would it be possable to use an activeX control that references a .NET dll that has a strong name and has been registered via gacutil?

I'd wrap the activeX up in a CAB and assume that the local computer running the tool has the .NET framework installed (in order to use it and run gacutil.exe)

This way I could use VB6 to build the interface but have all of the guts running in .NET.



Hi GlennW,

Sound like a mystery wrapped in an enigma, but hey, give it a try.  You don't even have to have the user control do anything.  Just see if you can get it to operate with "hello world".


Well A Garg,

i can't get this code work:



in my activex.exe/dll i've defined:

Private Sub Class_ReadProperties(PropBag As PropertyBag)
    MsgBox "READ : "
    AccountId = PropBag.ReadProperty("AccountId")

End Sub

Private Sub Class_WriteProperties(PropBag As PropertyBag)
    MsgBox "WRITE"
PropBag.WriteProperty "AccountId", AccountId
End Sub

Public Property Let LetAccountId(ByVal value As String)
    MsgBox "LET"
    AccountId = value
End Property


Any suggestion/hint you can tell me?

Many Thanks


Enrico Fantini





<OBJECT ID="obj"

<PARAM NAME="AccountId" VALUE="{!Account_ID}">

<script defer>obj.LetAccountId ="001200000011F8P";</script>

function setVal() {
obj.LetAccountId = "001200000011F8P";
<BODY onload="setVal();">