Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Neo the great Hacker

Registry + Numbers

This topic is 6118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m trying to get a number from the registry with this code: RegQueryValueEx(hKey, "Number1", NULL, DWORD, Number, &dwBufLen); but somehow this throws this error: error C2275: ''DWORD'' : illegal use of this type as an expression c:\program files\microsoft visual studio\vc98\include\windef.h(141) : see declaration of ''DWORD'' How can I get a number from the registry, because if I modify my code like this: RegQueryValueEx(hKey, "Number1", NULL, NULL, Number, &dwBufLen); it works, but I always get a bizzarr value for Number. Please Help!

Share this post


Link to post
Share on other sites
Advertisement
DWORD is a type. You want to pass REG_DWORD instead.

[EDIT]
Sorry to mislead you, I didn't read your post as thoroughly as I should have, I thought you were setting a value
Krunk is right below.
[/EDIT]

Edited by - Dactylos on October 20, 2001 11:35:59 AM

Share this post


Link to post
Share on other sites
You need to do something like this...

DWORD type; // Set by RegQueryValueEx(...)
DWORD buflen=4; // Tells RegQueryVakueEx the buffer size in bytes
DWORD value; // Set by RegQueryValueEx(...)

RegQueryValueEx(hkey, "Number1", NULL, &type, (LPBYTE)&value, &buflen);

You don`t specify the type of data you are trying to get - the function finds whatever value is stored and tells you what type it is (in the type variable). You need to check that type==REG_DWORD before you use the value (and ensure that the function call succeeded...)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!