Is there a way to create a COM object using only a CLSID
and not a progId? The COM object I wish to create does
not have a progId defined so I must use the CLSID. I was
thinking if I could somehow call CoCreateInstance() this
would achieve what I wanted. I am using either VBScript
or JScript from within IE. I do not want to download a
third party ActiveX control and use a method on this third
party control to call CoCreateInstance(). I would like to
use either a builtin IE control, API, or some COM object
that is guaranteed to be on any client machine running any
version of Windows, to create the object. (Or if there is
some language mechanism in VBScript or JScript that I
don't know about that would be even better).
Thanks in advance!
> Hello,
>
> Is there a way to create a COM object using only a CLSID
> and not a progId? The COM object I wish to create does
> not have a progId defined so I must use the CLSID. I was
> thinking if I could somehow call CoCreateInstance() this
> would achieve what I wanted. I am using either VBScript
> or JScript from within IE.
In IE objects are creatable with an <OBJECT> tag + the
CLSID:
<object id="agent_ctrl"
classid="clsid:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F">
for example launches Microsoft Agent Control 2.0.
you can refer to its ID-value as an object-reference in
scripting, for example:
agent_ctrl.Characters.Load("Merlin");
I do not want to download a
> third party ActiveX control and use a method on this third
> party control to call CoCreateInstance(). I would like to
> use either a builtin IE control, API, or some COM object
> that is guaranteed to be on any client machine running any
> version of Windows, to create the object. (Or if there is
> some language mechanism in VBScript or JScript that I
> don't know about that would be even better).
>
> Thanks in advance!
Afaik most COM-Classes have progids, if they're scriptable.
So it's kind of astonishing, that yours has none. But i am not
sure if the progid is really required to make the class
createable.
--
Gruesse,
Alex
Dim SWs As New SHDocVw.ShellWindows
and this works fine. Looking at OLE/View, ShellWindows implements the
IShellWindows interface, which is a dispatch interface. I would
assume that this interface would therefore be scriptable. Why is
there not a progId if it is scriptable?
[snipped]
"Notre Poubelle" <notre_p...@yahoo.com> wrote in message
news:ae38c758.03072...@posting.google.com...
> Looking at OLE/View, ShellWindows implements the
> IShellWindows interface, which is a dispatch interface. I would
> assume that this interface would therefore be scriptable. Why is
> there not a progId if it is scriptable?
It does sound odd. Don't know if this will help or not, but you haven't
already, you might try Mark Pryor's free TLViewer utility. I find it easier
to get scriptable COM object info through it than through the official MS
stuff.
http://mysite.verizon.net/res1ur2j/tlviewer.htm
Joe Earnest
I cant't give you an answer. I know too little about COM-backgrounds.
I remember that VB - like VBS/JS - uses a the IDispatch-mechanism, when you
create the object with CreateObject and a different mechanism
(the one that result in early binding, forgot the name) if you "create"
the object with "new" and precise typing.
but practically you should test the tip with the <object>-tag.
it really works for me to return a ShellWindows-Collection.
sample:
<html><head><title>Shell Windows</title>
<script language="vbscript">
sub shw()
for each w in sw
w.quit()
next
end sub
</script></head>
<body bgcolor="#C0C0C0" scroll="no">
<object id="sw" classid="clsid:9BA05972-F6A8-11CF-A442-00A0C90A8F39">
</object>
<button onclick="shw()">close all windows!</button>
</body></html>
--
Gruesse,
Alex
> on 24.07.03 22:19 Notre Poubelle wrote:
>> Thanks for the suggestion Alexander. The component I want to create
>> is the ShellWindows coclass, that I believe ships with IE. Looking at
>> the SHDocVw (Microsoft Internet Controls) type libary, the
>> ShellWindows coclass has a CLSID of
>> 9BA05972-F6A8-11CF-A442-00A0C90A8F39, according to OLE/View. I
>> searched the registry for this CLSID and but I couldn't find this key
>> (for reasons I don't understand). Having said this, I can still write
>> VB (not VBScript) code like this:
>>
>>
>> Dim SWs As New SHDocVw.ShellWindows
>>
>> and this works fine. Looking at OLE/View, ShellWindows implements the
>> IShellWindows interface, which is a dispatch interface. I would
>> assume that this interface would therefore be scriptable. Why is
>> there not a progId if it is scriptable?
I think i mixed up the terms "scriptable" and "createable"
afaik ShellWindows is scriptable, but not creatable.
though in msdn they mention a progId "Shell.Windows"
which doesn't exist:
--
Gruesse,
Alex
"Notre Poubelle" <notre_p...@yahoo.com> wrote in message
news:ae38c758.03072...@posting.google.com...
Is this what you're after?
set oShell= createobject("shell.application")
set oShellWindows= oShell.windows
wscript.echo typename(oShellWindows)
If so, you might want to do a Google search, as Michael Harris has posted a
number scripts for getting IE window titles using the object collection.
Joe Earnest
But the OP said in his first post: "...I am using either VBScript or JScript
from within IE...".
The windows collection is not accessible from within IE as a host. The
Shell.Application itself is marked safe for scripting and can be created,
but most of what it exposes is considered UNsafe for scripting and will
generate an error within IE. Now, use within an HTA is another story...
--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
Technet Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp
As I understand by reading the security section of the link Alexander
mentioned in another post, this is by design in a web page. As
Michael also notes the windows collection (and indeed any of the Shell
objects according to the web page link provided by Alexander) are not
marked as safe for scripting and will not run using IE as a host,
unless the user enables the "Initialize and script ActiveX Controls
not marked as safe" option for the security zone in which they are
viewing the page. So, it seems I am out of luck.