Solved

Get Registry Type with C#

Posted on 2009-05-07
4
709 Views
Last Modified: 2013-12-17
I need to retrieve the Registry Type (e.g. REG_SZ) with C#

Any idea how to get this data?
0
Comment
Question by:schubduese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Anthony408
ID: 24331806
Hi schubduese,

I am not quite sure what you mean by Registry Type, but here are some useful C# Registry Links that might point you in the right direction.

C# Registry Basics:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=264

Registry In's and Out's Using C#:
http://www.csharphelp.com/archives2/archive430.html

Read, write and delete from registry with C#"
http://www.codeproject.com/KB/system/modifyregistry.aspx

Sorry if this is not what you are looking for.

-Anthony
0
 
LVL 5

Accepted Solution

by:
rendaduiyan earned 500 total points
ID: 24332681
RegistryValueKind rvk = rkRoot.OpenSubKey(yourkey).GetValueKind(yourkey).
get details with GetValueKind from msdn.
0
 

Author Comment

by:schubduese
ID: 24333800
rendaduiyan, I think you mean .GetValueKind(yourvaluename)

With this, it works... it reports for example "String"
That means I have to change it like this:
private String mValType = String.Empty;
 
switch (rvk.ToString())
{
    case "String":
        mValType = "REG_SZ";
        break;
    ...
    ...
 
}

Open in new window

0
 
LVL 5

Expert Comment

by:rendaduiyan
ID: 24333954
the returned value is a enum,
RegistryValueKind:
String, REG_SZ
ExpandString, REG_EXPAND_SZ
Binary, REG_BINARY
DWord, REG_DWORD
MultiString, REG_MULTI_SZ
QWord, REG_QWORD
Unknown

It is easy for you to handle the enum.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question