INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a
Computer / IT professional?
Join Tek-Tips Forums!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Microsoft: Visual C++ FAQ
How to read values of the system's registry
Posted: 18 Feb 04
Here is a small piece of code that reads any key/value from registry. This program will compile right away (Win32), tested on VC++6.0 .
int APIENTRY WinMain(HINSTANCE hInstance,
char rgValue ;
char fnlRes ;
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE,
KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS)
RegQueryValueEx( keyHandle, "Productid", NULL, &Type,
sprintf(fnlRes,"Product ID of your Windows system is:: %s",rgValue);
else strcpy(fnlRes,"Couldn't access system information!");
MessageBox(NULL, fnlRes, "Product ID of Windows", MB_SYSTEMMODAL|MB_ICONINFORMATION);
I hope it helps, have fun!
PS: This code snippet should be taken as a starting point, not as a final solution.
Back to Microsoft: Visual C++ FAQ Index
Back to Microsoft: Visual C++ Forum
Join Tek-Tips® Today!
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
- Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More...
Register now while it's still free!
Already a member? Close this window and log in.
Join Us Close