Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

working with registry in c#


// Below is a sample code that illustrates how to query for a given
// Value 'VisualStudio' in the HKLMSOFTWAREMicrosoft tree.


using System;
using System.Runtime.InteropServices;
using LogQuery = Interop.MSUtil.LogQueryClass;
using RegistryInputFormat = Interop.MSUtil.COMRegistryInputContextClass;
using RegRecordSet = Interop.MSUtil.ILogRecordset;

class Program
{
	public static void Main()
	{
		RegRecordSet rs = null;
		try
		{
			LogQuery qry = new LogQuery();
			RegistryInputFormat registryFormat = new RegistryInputFormat();
			string query = @"SELECT Path from HKLMSOFTWAREMicrosoft where
			Value='VisualStudio'";
			rs = qry.Execute(query, registryFormat);
			for(; !rs.atEnd(); rs.moveNext())
				Console.WriteLine(rs.getRecord().toNativeString(","));
		}
		finally
		{
			rs.close();
		}
	}
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# creating an array 
Csharp :: c# optional arguments 
Csharp :: c# gettype 
Csharp :: c# list foreach lambda multiple actions 
Csharp :: c# list remove by index 
Csharp :: How can I display image from database in asp.net mvc. I created image table and image path as varchar 
Csharp :: remove duplicates in the list using linq 
Csharp :: combine two arraylist c# 
Csharp :: Save object to file C# 
Csharp :: c# float 
Csharp :: C# 1 minute delay 
Csharp :: check if two timespans intersect c# 
Csharp :: loading player preferences unity 
Csharp :: c# calendar button random dates 
Csharp :: read json from assets c# 
Csharp :: C# Calculate MD5 Checksum For A File 
Csharp :: linq c# object except two lists 
Csharp :: unity rigidbody freeze rotation y z 
Csharp :: c# external ip 
Csharp :: c# convert string to datetime dd-mm-yyyy hh-mm-ss 
Csharp :: C# check if object is default 
Csharp :: stop playing audiosource 
Csharp :: c# enum to list of strings 
Csharp :: unity hide mouse first person 
Csharp :: browser folder in wpf 
Csharp :: How to create a new object instance from a Type 
Csharp :: c# list get last element 
Csharp :: array sum c# 
Csharp :: c# anonymous type as return value 
Csharp :: create enum from int c# 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =