Page 2 of 2

Posted: Thu Sep 27, 2007 1:00 am
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?

Posted: Thu Sep 27, 2007 2:09 am
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.

Posted: Thu Sep 27, 2007 2:13 am
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.

Posted: Thu Sep 27, 2007 5:05 am
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.

Posted: Thu Sep 27, 2007 5:35 am
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...

Posted: Thu Sep 27, 2007 12:32 pm
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.

Posted: Thu Sep 27, 2007 12:55 pm
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

Posted: Thu Sep 27, 2007 2:37 pm
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.