Question regarding reading from registry (Win32) VC6

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2004
Posts: 5
Reputation: Caps is an unknown quantity at this point 
Solved Threads: 0
Caps Caps is offline Offline
Newbie Poster

Question regarding reading from registry (Win32) VC6

 
0
  #1
May 7th, 2004
I'm working on an aim profiler program in C++ using VC6, and
I'm trying to take the last login name for AIM from the registry and store it in a variable. I'm not that experienced with the Win32 Api, but I'm trying. Here's my code: (I took it off a code example site, then butchered it for my needs, which is most likely why it doesn't work)

  1.  
  2. HKEY hKey;
  3. REG_SZ dwSize = "";
  4. REG_SZ dwDataType = "";
  5. REG_SZ dwValue = "";
  6.  
  7. if(::RegOpenKeyEx(HKEY_CURRENT_USER,
  8. "Software\\America Online\\AOL Instant Messenger\\CurrentVersion\\Login",
  9. 0,
  10. KEY_QUERY_VALUE,
  11. &hKey) == ERROR_SUCCESS)
  12. {
  13. //Get Last Login Name from opened Key
  14. if(::RegQueryValueEx(hKey,
  15. "Screen Name",
  16. 0,
  17. &dwDataType,
  18. &dwValue,
  19. &dwSize) != ERROR_SUCCESS)
  20. {
  21. // Close key
  22. ::RegCloseKey(hKey);
  23. }
  24.  
  25. // Close key
  26. ::RegCloseKey(hKey);
  27. }

These are my includes, which I'm not sure about either

  1.  
  2. #include "stdafx.h"
  3. #include "conio.h"
  4. #include "fstream.h"
  5. #include "stdio.h"
  6. #include "iostream"
  7. #include "cstdlib"
  8. #include "windows.h"
  9. #include "winreg.h"

it gives me a bunch of error about undeclared identifiers in the top 4 lines and it also says:

"error C2440: '=' : cannot convert from 'char [1]' to 'int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast"

for the top 4 lines.

I'm probably doing a lot wrong, but hopefully someone can tell me what I need to do. If you look in regedit at "Software\\America Online\\AOL Instant Messenger\\CurrentVersion\\Login" you'll see the key that says "Screen Name" and then the last login, I want that last login screename in a variable.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC