Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WSC and ProgID Versions

29 views
Skip to first unread message

Jon

unread,
Sep 19, 2001, 11:45:51 AM9/19/01
to
Hello,

I'm having difficulty creating versions of my "AAA.Widget" component.

How does one go about creating versions of AAA.Widget ?

my .wsc files are below.

e.g. here is my test script.
----------------------------------------
t.wsf -----------------------------------------
<Job id="Test">
<script language="JScript" />
<script language="JSCript">

WScript.Echo("Start");

try {
oWidget1 = new ActiveXObject("AAA.Widget.1");
}
catch (oError) {
WScript.Echo("Failed to create AAA.Widget.1");
}

try {
oWidget2 = new ActiveXObject("AAA.Widget.2");
}
catch (oError) {
WScript.Echo("Failed to create AAA.Widget.2");
}

WScript.Echo("Finished");
</Script>
</Job>

-----------------------------------
widget1.wsc ---------------------------------------------------
<?xml version="1.0"?>
<component>

<?component error="true" debug="true"?>

<registration
description="AAA Widget 1 Description"
progid="AAA.Widget"
version="1"
classid="{867c8a54-8f8c-4372-addd-fad05ed0c264}"
>
</registration>

<public>
<property name="ID">
<get/>
<put/>
</property>
<method name="Version">
</method>
</public>

<script language="JScript">
<![CDATA[

var description = new Widget;

function Widget()
{
this.get_ID = get_ID;
this.put_ID = put_ID;

this.Version = Version;
}

var ID = "WidgetID";

function get_ID()
{
return ID;
}

function put_ID(newValue)
{
ID = newValue;
}

function Version()
{
return "Temporary Value";
}

]]>
</script>
</component>

-----------------------------------
widget2.wsc ---------------------------------------------------
<?xml version="1.0"?>
<component>

<?component error="true" debug="true"?>

<registration
description="AAA Widget 2 Description"
progid="AAA.Widget"
version="2"
classid="{35d2827e-db50-43c7-a24f-9be24bae750d}"
>
</registration>

<public>
<property name="ID">
<get/>
<put/>
</property>
<method name="Version">
</method>
</public>

<script language="JScript">
<![CDATA[

var description = new Widget;

function Widget()
{
this.get_ID = get_ID;
this.put_ID = put_ID;

this.Version = Version;
}

var ID = "WidgetID";

function get_ID()
{
return ID;
}

function put_ID(newValue)
{
ID = newValue;
}

function Version()
{
return "Temporary Value";
}

]]>
</script>
</component>

Jon Morgan

unread,
Sep 25, 2001, 8:21:21 PM9/25/01
to
Can anyone explain this problem ?

I really believe it's a Windows Scripting Component registration *bug*.

"Jon" <z...@hotmail.com> wrote in message
news:OGzmNQSQBHA.1524@tkmsftngp05...

Michael Harris (MVP)

unread,
Sep 26, 2001, 11:53:03 AM9/26/01
to
Not sure why it doesn't work for you but it does for me...

progid="foo.bar"
version="x"

does create 2 progids that map to the same clsid

foo.bar and foo.bar.x

progid="foo.bar"
version="x.y"

creates 2 progids that map to the same clsid

foo.bar and foo.bar.x.y

And I can create an instance using any of the registered progids...

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Jon Morgan" <mor...@mincom.com> wrote in message news:OE76rViRBHA.1528@tkmsftngp05...

Jon Morgan

unread,
Sep 30, 2001, 9:21:06 PM9/30/01
to
Please supply your source code and your method of registrating the
components to demonstrate.

"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:O1pkWNqRBHA.1444@tkmsftngp03...

Michael Harris (MVP)

unread,
Oct 1, 2001, 10:02:13 AM10/1/01
to
Registering the component below produces 2 entries under HKCR for 2 progids: "foo.wsc" and "foo.wsc.1". If I change the version to "1.99" and re-register, a 3rd progid of "foo.wsc.1.99" is added. If I unregister and re-register, then there will only be 2 progids: "foo.wsc" and "foo.wsc.1.99".

Registration was via the Explorer context menu command "Register" (created by the Windows Script installation) which maps to:

"C:\WINNT\System32\REGSVR32.EXE" /i:"%1" "C:\WINNT\System32\scrobj.dll"

===foo.wsc===

<component>
<?component debug="true"?>
<registration
description="foo component"
progid="foo.wsc"
version="1"
classid="{4d8fd870-6533-11d3-a591-0010e37c63c8}"
>
</registration>

<public>
<method name="test">
<parameter name="arg"/>
</method>
</public>

<script language="vbscript">
function test(arg)
test = ucase(arg)
end function
</script>
</component>


--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Jon Morgan" <mor...@mincom.com> wrote in message news:eqrwpdhSBHA.2004@tkmsftngp04...

Jon

unread,
Oct 2, 2001, 4:36:16 AM10/2/01
to
Yes although i'm attemping two component files to be registered and
available on the system at the same time.
i.e.. foo.wsc.1 and foo.wsc.1.99 belong each in their own .wsc file. e.g.
foo1.wsc and foo199.wsc

foo1.wsc should contain the registration : ProgID=foo.wsc Version=1
foo199.wsc should contain the registration : ProgID=foo.wsc Version=1.99

Now once the above two wsc files are registered, they should both appear in
the OLE/COM Object Viewer tool at the same time.

The Widget1.wsc and Widget2.wsc files that i posted earlier should do this?
We wrote a Visual C equivalent of the Widget example and they both appeared
in the OLE/COM Object Viewer tool as expected,
i.e. AAA.Widget.1 and AAA.Widget.2

Regardless of being a C program or .wsc it should work the same, unless I'm
completely wrong about how ProgID's and the Versioning is supposed to work
??

"Michael Harris (MVP)" <mik...@mvps.org> wrote in message

news:u$yWwGoSBHA.2076@tkmsftngp03...

Michael Harris (MVP)

unread,
Oct 2, 2001, 12:36:14 PM10/2/01
to
[...]

foo1.wsc should contain the registration : ProgID=foo.wsc Version=1
foo199.wsc should contain the registration : ProgID=foo.wsc Version=1.99
[...]

Given the way the progid/version values are used when registering WSCs, this is never going to work. You simply can't have 2 different WSCs that share the same non-version specific progid, not to mention the common classid...

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Jon" <z...@hotmail.com> wrote in message news:e$zM$8xSBHA.1472@tkmsftngp05...

Jon Morgan

unread,
Oct 2, 2001, 11:02:26 PM10/2/01
to

> Given the way the progid/version values are used when registering WSCs,
this is never going to work

Why? is this a limitation or a bug ?

> not to mention the common classid...

No, the ClassIds are different in the Widget example I posted.

> You simply can't have 2 different WSCs that share the same non-version

specific progid.

See below..

The following two .rgs files allow two different versions of
"VerDemo.Abcde",
which live in seperate dlls and have different clsids.

VerDemo.Abcde.1
VerDemo.Abcde.2


HKCR
{
VerDemo.Abcde.1 = s 'Abcde Class'
{
CLSID = s '{98739448-E5AC-404C-851C-08909FB36775}'
}
VerDemo.Abcde = s 'Abcde Class'
{
CLSID = s '{98739448-E5AC-404C-851C-08909FB36775}'
CurVer = s 'VerDemo.Abcde.1'
}
NoRemove CLSID
{
ForceRemove {98739448-E5AC-404C-851C-08909FB36775} = s 'Abcde Class'
{
ProgID = s 'VerDemo.Abcde.1'
VersionIndependentProgID = s 'VerDemo.Abcde'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{F22E4D36-9F97-4245-B6CC-730900A35792}'
}
}
}


HKCR
{
VerDemo.Abcde.2 = s 'Abcde Class'
{
CLSID = s '{0A627588-B26E-4CD7-8512-9CE7B3978FF1}'
}
VerDemo.Abcde = s 'Abcde Class'
{
CLSID = s '{0A627588-B26E-4CD7-8512-9CE7B3978FF1}'
CurVer = s 'VerDemo.Abcde.2'
}
NoRemove CLSID
{
ForceRemove {0A627588-B26E-4CD7-8512-9CE7B3978FF1} = s 'Abcde Class'
{
ProgID = s 'VerDemo.Abcde.2'
VersionIndependentProgID = s 'VerDemo.Abcde'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{33D70177-CF4E-41E3-90AA-92703F46A34D}'
}
}
}


"Michael Harris (MVP)" <mik...@mvps.org> wrote in message

news:uGdefB2SBHA.1924@tkmsftngp07...

Michael Harris (MVP)

unread,
Oct 3, 2001, 10:14:32 AM10/3/01
to
You seem determined on having 2 separate WSC files that use the same progid, different versions, and different classids. This does NOT work because the shared progid can NOT point to 2 different hkcr\clsid\{classid-guid} registry keys. Think about it -- you are never going to get around the collision on the generic (version independent) progid that the registration of either will create.

Note that the version attribute is optional. I suggest that you use progid attribute values that explicitly incorporate the version directly (e.g., foo.wsc.1 / foo.wsc.1.99 / etc.) each with a new classid for each. In effect all you are doing here is creating independent WSCs that only superficially share a common progid naming scheme and common functionality, but *not* a shared generic progid.

0 new messages