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:
// 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?
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...
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.
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?
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.