[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Reading Value from Registry Key.

Hi, I'm using VB2005 (still) and working in WinForms. I have a question that may be a little off topic on the NET side of the house, but its still VB related, so I'll ask it anyway in hope that someone can help.

I need to read a Registry Key from a Windows XP machine. Let's say I wanted to read the type of Default Printer that a computer is using. I would need to read something like:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device -- (I think this is where Windows keeps the "Default" printer from the Control Panel).

How would I do that?

Here's the part that is maybe off topic here...and very tricky!!!

I would like to add that code to an MS Word Document in the Macros section, where you can code in VB and have the document print the name of Default printer when it prints out a print job.

So, this is a two step question:

1). How would I read out of that Registry in VB.NET and print it out to say the console?
2). How would I add that code to the Macro's area of an MS Word Document and get the Word document to print out the name of the printer it used when it prints a print job?

Thank you,
Fulano
0
Mr_Fulano
Asked:
Mr_Fulano
  • 3
  • 3
1 Solution
 
Mr_FulanoAuthor Commented:
CodeCruiser...you're just too good!!! Wow, is there anything you don't know how to program?

Thanks for the help,
Fulano
0
 
Mr_FulanoAuthor Commented:
Great help!!! Thank you.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
CodeCruiserCommented:
Fulano,
EE provides a very good opportunity to learn new things which I dont usually do otherwise.

Thanks for the compliment :-)
0
 
CodeCruiserCommented:
By the way, just realized that I pasted the same link twice for VB.NET!
0
 
Mr_FulanoAuthor Commented:
That's OK, I usually need to read things more than once to understand them anyway...: )
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now