Modifying windows registry key - windows

Does anyone ever used an OLE or an ActiveX to modify the windows registry keys?
I have found some documentation to do it in command line, but I would like a way to program it otherwise.
Our context is an HTA application.

For COM objects to access the Registry from scripts or classic ASP you can choose from :
The "Set" methods of the WMI StdRegProv class : http://msdn.microsoft.com/en-us/library/aa394600%28v=vs.85%29.aspx
or
The WshShell RegWrite method http://msdn.microsoft.com/en-us/library/yfdfhz1b%28v=vs.85%29.aspx

Related

What is the difference between Shell and ShellEx in Windows Registry?

I'm trying to add a custom context menu in windows registry, I found a shell key and shellex key that seems to both work the same thing? Why is there 2 and what are they for?
The Shell key is for static verbs used by ShellExecute and file-type context menus. They are simple to implement because they are just a string that specifies the command. They can be extended with optional COM objects (DropTarget etc.) if required.
The ShellEx key is for shell extensions, these are COM objects and there are various extension points in the shell and each type is a subkey of ShellEx. ShellEx\ContextMenuHandlers is the shell extension version of the plain Shell key. The different types of shell extensions are listed here.

How to know if program is COM and can be browsed in Visual Studio?

I am using VS2005 to develop VBScript tool, I want to use VS2005 Object Browser to browse all objects, I added cscript.exe and excel.exe, but I couldn't find any COMs else, when I tried to add notes.exe, it is said that is not a COM but a FILE!
How can I find all COMs in my Win7?
CScript and Wscript are starter programs. The COM objects reside in C:\Windows\System32\wshom.ocx
The wscript base object is only available to scripts it is running, other sub objects do the following.
Look up in Regedit - HKCR\wscript.shell (the object name) - look up the CLSID under this key at HKCR\CLSID\<the GUID> and look under InProcServer32 for DLLs (and OCXs are DLLs with a funny extension) and EXE under LocalServer32.

QTP AOM Model Intellience Not Working

I want to use QTP AOM(Automation Object Model) using vbscript. I use VbsEdit to develop this script but I did not get any intellience from this editor even I also try this from excel developer window. There also intellence assistance is not available.
I need this because if it is not appear then how can I know the available(open) methods and properties from this COM object.
I have also another question that we write this below line to instantiate a QTP object using vbs
CreateObject("QuickTest.Application")
For excel
CreateObject("Excel.Application")
How can I know the COM objects name means can I list down all COM object name programmatically.
There are two questions here.
Why don't you get intelisense for the QTP object in the IDE you're using (VBSEdit)
Intelisense is a feature of the IDE, you should tag this question VBSEdit, not QTP
Where can I get a list of all the COM objects in the system?
When you use CreateObject you're specifying a ProgID which is a string identifyier for a COM class (slightly more human readable than a CLSID. COM uses the registry to maintain its Prog and Cls IDs, you can find the ProgId's under the HKEY_CLASSES_ROOT registry hive (look for keys with a child CLSID key).

Read and Write to Window Registry in window xp and 7

I'd like to read and write window registry in window xp and 7 by using vb6. I'm not much strong in vb6. I tried this below
Dim str As String
str = GetSetting("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines", "Text", "ImportMixedTypes")
My coding doesn't work. Please point out my missing.
You can't use GetSetting for that setting. That method is only for reading/writing configuration settings for your own application. If you want to read anywhere in the registry you have to use the Windows API function RegOpenKeyEx and friends.
Here's a Microsoft support article that explains how to do this (with sample code): How To Use the Registry API to Save and Retrieve Setting
Note that you will have to have permission to read the relevant place in the registry, I'm not
sure if you'll have access to that key so you'll have to try it out.
HKEY_LOCAL_MACHINE can cause permission problems. described in these article Microsoft API article
procedures works well if you will change HKEY_LOCAL_MACHINE to CURRENT_USER.

Read HKU VB and VBA Program settings

How do I read a particular vb program settings or registry entry from the registry of the key "HKEY_USERS\S-1-5-21-1390067357-1965331169-725345543-1003\Software\VB and VBA Program Settings".A standardized way to read as the part after hikey_users and before software changes with the pc used,but the vb programs do write perfectly at the right place.Is there some variable that defines the registry key location ?
VB6 has built-in functions for manipulating the registry, like GetSetting. These functions use registry keys underneath HKEY_CURRENT_USER\Software\VB and VBA Program Settings
HKEY_USERS\S-1-5-21-1390067357-1965331169-725345543-1003\Software\VB and VBA Program Settings is just another path to the same set of keys: the long string in the middle identifies the current user by their ID, rather than just saying "the current user".
So the answer is:
If you are using VB6, just use GetSetting.
If you are using VBScript, use WshShell.RegRead and work on HKEY_CURRENT_USER\Software\VB and VBA Program Settings. Example code in this article.

Resources