Using an ActiveX control within MSG.WSC 
Author Message
 Using an ActiveX control within MSG.WSC

Hell is when you make something, other people break it, and then they ask you why it doesn't work... ;)

I found this interesting behavior using MSG.WSC; it *sort* of makes sense, but I'm not sure of the way out.

I have the "My Computer" zone set to allow everything before I run this.  I embedded a reference to an ActiveX control in the HTML window for MSG.WSC.  A VBS calling it runs fine.  However, as soon as I add a sub that modifies the object, I get the classic message:

"An ActiveX control on this page is not safe.  
Your current security settings prohibit running unsafe controls on this page.  
As a result, this page may not display as intended."

MSG.WSC has been drastically modified, of course, but that's probably not the issue; I think that IE believes the WSC is being run from another zone.

Below are both the segment of my VBS which instantiates the WSC and the modified portion of the WSC embedded HTML.  Is there a way around this being considered unsafe?

'===from VBScript
sFolder = Replace(WScript.ScriptFullName,wscript.scriptname,"")
set oCodeConsole = getobject("script:" & sFolder & "CodeConsole.wsc")
sFolder = empty
wscript.connectobject oCodeConsole,"oCodeConsole_"
oCodeConsole.show

' ====From header and body of the HTML resource within MSG.WSC
 Sub window_onload
  Setup_CodeWindow CSin
  'Setup_CodeWindow CSout
 End Sub

 Sub Setup_CodeWindow(oWinID)
  oWinID.GlobalProps = True
  oWinID.SelBounds = True
  oWinID.StealKeys = True
  oWinID.LineNumbering = True
  oWinID.LineNumberStart = 1
  oWinID.AutoIndentMode = 2
  oWinID.EnableDragDrop = True
  oWinID.DisplayLeftMargin = True
  oWinID.borderstyle = 10
  oWinID.object.Language = "Basic"
  oWinID.ColorSyntax = True
  oWinID.HScrollVisible = False
 End Sub

</script>
</head>
<body>
<div id=divHeader></div>
<div id=divInput><object
id=CSin
classid=clsid:A0F69707-2D87-4B20-9471-FBC003427134
width=800 height=240 ></object></div>



Sat, 28 Aug 2004 12:30:25 GMT  
 Using an ActiveX control within MSG.WSC
FYI,
the problem shows up when initiated via the line

set oCodeConsole = getobject("script:" & sFolder & "CodeConsole.wsc")

IE appears to think it is being run from the Internet zone.


Hell is when you make something, other people break it, and then they ask you why it doesn't work... ;)

(SNIP)



Sat, 28 Aug 2004 14:49:15 GMT  
 Using an ActiveX control within MSG.WSC
Add a <registration> element and register the WSC.  

Then try CreateObject("your.progid") and see if that makes a difference.  Since the "script:" moniker can reference an http based url, IE *may* consider any use of "script:" to be (at least potentially) in a security zone other than "My Computer".

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

FYI,
the problem shows up when initiated via the line

set oCodeConsole = getobject("script:" & sFolder & "CodeConsole.wsc")

IE appears to think it is being run from the Internet zone.


Hell is when you make something, other people break it, and then they ask you why it doesn't work... ;)

(SNIP)



Sun, 29 Aug 2004 08:21:15 GMT  
 Using an ActiveX control within MSG.WSC
That's exactly what it seems to do either way - even with CreateObject.

I'll find a workaround somehow.  Or maybe I can "enhance" PythonWin since it has similar functionality...


Add a <registration> element and register the WSC.  

Then try CreateObject("your.progid") and see if that makes a difference.  Since the "script:" moniker can reference an http based url, IE *may* consider any use of "script:" to be (at least potentially) in a security zone other than "My Computer".

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

FYI,
the problem shows up when initiated via the line

set oCodeConsole = getobject("script:" & sFolder & "CodeConsole.wsc")

IE appears to think it is being run from the Internet zone.


Hell is when you make something, other people break it, and then they ask you why it doesn't work... ;)

(SNIP)



Mon, 30 Aug 2004 12:23:15 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. pb with a msg box while executing activeX control within a page

2. msg.wsc

3. MSG.wsc

4. HOWTO: Enhanced WSH output with MSG.WSC

5. FYI - IE 5.5 and msg.wsc

6. Instancing ActiveX controls within WSH Scripts

7. Referencing ActiveX Control within html form tag

8. HOWTO: Enhanced WSH output with MSG.WSC

9. ActiveX Control Container for VBCCE5 ActiveX Controls!?

10. Repost: Problems working with a MSChart ActiveX control using VBScript

11. HELP: Using ActiveX Control in web page

12. Using ActiveX control from VBScript

 

 
Powered by phpBB® Forum Software