Disable files with dhtml/vbs?

  • Thread starter Thread starter Alexander Suhovey
  • Start date Start date
A

Alexander Suhovey

Hi,
Currently i'm trying to look into all this handy dhtml/vbs/cmi stuff to make
custom settings pages for my components. In particular, I have one simple
component that sets pre-login wallpaper to my company's logo as well as
default background color. This component includes two bmps - one for
portrait screen alignment, one for landscape. I already have figured (with
help of this NG of course) how to create a setting page wich allow developer
to choose correct wallpaper. Then script sets correct wallpaper in registry
according to dhtml settings tab. What I also want to achieve is that only
one bmp is copied to image. So I guess I should change component script so
it disables unneeded bmp in component properties so it will not be copied to
image.
Somebody could say "Hey, you can simply create two components instead of
one". Yeah I know, I'm trying to do this rather for educational purposes.

Can it be done this way? If yes, could somebody please provide some vbs
sample?

Thanks in advance,
Al.
 
Uh... I guess I'm asking too much. Well then.

Is there *any* CMI reference available?..
 
Uh... I guess I'm asking too much. Well then.

Is there *any* CMI reference available?..
 
Alexander,

Only resources I know is google (and my components on www.xpefiles.com :-)).
Basically, CMI is undocumented and will unlikely be documented for XPe.
If you want to deal with CMI (I agree - very handy stuff), you will have to
hack it.

From what you wrote it is doable. You will have to work with Resources
collections of IInstance interface. You will just need to disable/enable
particular component (instance) resources like file entries you mentioned.
Similar is implemented in the File filter search of the DependencyExplorer
component from www.xpefiles.com.

KM
 
Forgot to mention that some interesting CMI code you can find exploring MS
XPe QFEs (.sld's).

Also, you may want to use/explore CMI Explorer that is a part of VALUEADD
directory on XPe CD.

KM
 
Mmm...great idea, thanks Konstantin :)

Al

KM said:
Forgot to mention that some interesting CMI code you can find exploring MS
XPe QFEs (.sld's).

Also, you may want to use/explore CMI Explorer that is a part of VALUEADD
directory on XPe CD.

KM
script
 
So if it is that simple the only thing left is to find correct syntax. Hack,
you say? I like how it sounds :)
Thank you.
 
Alexander,

Yes, it always sounds simple when you have done that :-)

A couple of hints for you (so that you don't spend much time on that).

Within the script use cmiThis object to refer to the instance in the context
of which you work.

When you enumerate your component (instance) resources, search for ones with
the property ResourceTypeVSGUID="{E66B49F6-4A35-4246-87E8-5C1A468315B5}".
Those will be the file resources.

A file name will be the value of the extended property "DstName" of the
resource (Properties collection).

So, the VB script that disables a particular file resource of the current
component instance may look like:
For Each oResource In cmiThis.Resources
If ("{E66B49F6-4A35-4246-87E8-5C1A468315B5}" =
oResource.ResourceTypeVSGUID) Then
If oResource.Properties.Exists("DstName") And
oResource.Properties("DstName").Value="<you file name here>" Then
oResource.Properties.Disabled = True
Exit For
End If
End If
Next

(I haven't tested the above you you will need to use/modify it on your own
risk).

For other resources (registry key, reg value, etc.) you will just need to
use different predefined GUIDs (not important for you now but for any future
use).

Regards,
Konstantin
 
Thanks again, Konstantin. Your sample works with minor fix:
"oResource.Properties.Disabled" should be "oResource.Disabled"


Al.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top