ActiveX Object.

JavaScript and client side scripting.

Moderator: General Moderators

User avatar
figaro11
Forum Commoner
Posts: 64
Joined: Mon Sep 17, 2007 11:49 pm

Post by figaro11 »

stereofrog wrote:
figaro11 wrote:I heard somewhere that ActiveX allows you registry access, maybe with a confirmation from the user with a confirmation dialog box.

The reason I'd like to access the registry is to set IE7 homepage. I don't mind if the user would be prompt that this is happening because I would want him to know what is happening.
Hi,

there's no such thing as "ActiveX object model". ActiveX is just the name of the technology, each ActiveX component has its own set of objects and methods, depending on its purpose. For accessing the registry (and other system-level tasks) there is the built-in "Scripting shell" component, here's an example on how to use it:

Code: Select all

// init the component
var wsh = new ActiveXObject("WScript.Shell");

// use it to read a registry value
var value = wsh.RegRead("HKLM\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page");
For writing there's symmetric RegWrite() method, for more info search MSDN on "WScript.Shell".

Of course, IE doesn't allow stuff like this by default, doing this only makes sense in a less secure environment (intranets etc).
Thank you.

I think I understand now. Is there a place on MSDN that documents all the different components or values for ActiveXObject's first parameter. Like, how would I have known to type "WScript.Shell" as a parameter, how did you?
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

Please let us know what sites you are using this code on so we can add them to our black lists.
User avatar
figaro11
Forum Commoner
Posts: 64
Joined: Mon Sep 17, 2007 11:49 pm

Post by figaro11 »

AKA Panama Jack wrote:Please let us know what sites you are using this code on so we can add them to our black lists.
Lol, I don't know if you're being serious or humorous.

But, hey if IE is really that insecure, then don't use the browser.
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

I am being serious and I don't except to test my web work. IE7 isn't any improvment in security either.
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Post by Sindarin »

For personalized settings like that you must always ask the user to accept it. Otherwise it's a privacy and preference violation and don't expect him/her to come back to your site really soon...
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post by stereofrog »

figaro11 wrote: I think I understand now. Is there a place on MSDN that documents all the different components or values for ActiveXObject's first parameter.
No, and this wouldn't be possible. ActiveX component is just a special type of windows programs, there's no place that can list or document all existing programs. However, it's quite possible to view ActiveX's currently installed on your system using "oleview" or similar utility.
Like, how would I have known to type "WScript.Shell" as a parameter, how did you?
MS "Windows Script Technologies" doc discusses it in details. Sorry, I don't know exact url on msdn, I use the offline version.
User avatar
figaro11
Forum Commoner
Posts: 64
Joined: Mon Sep 17, 2007 11:49 pm

Post by figaro11 »

stereofrog wrote:
figaro11 wrote: I think I understand now. Is there a place on MSDN that documents all the different components or values for ActiveXObject's first parameter.
No, and this wouldn't be possible. ActiveX component is just a special type of windows programs, there's no place that can list or document all existing programs. However, it's quite possible to view ActiveX's currently installed on your system using "oleview" or similar utility.
Like, how would I have known to type "WScript.Shell" as a parameter, how did you?
MS "Windows Script Technologies" doc discusses it in details. Sorry, I don't know exact url on msdn, I use the offline version.
I see. So, what are these components really? Maybe I don't understand them fully. For all I know, notepad could have a special component, but how would I know this? Where did you learn about ActiveX in detail?

PS: Why do I find MSDN to be a bit confusing? 8O
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post by stereofrog »

figaro11 wrote:So, what are these components really?
Well, the official definition is "A Microsoft ActiveX control is essentially a simple OLE object that supports the IUnknown interface". Sounds helpful doesn’t it? ;) Informally, it's just an OOP class, compiled in a special way so that other programs, no matter in which language, can instantiate it and use its properties and methods.
Post Reply