Caps 0 Newbie Poster

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)

HKEY hKey;
REG_SZ dwSize = "";
REG_SZ dwDataType = "";
REG_SZ dwValue = "";

if(::RegOpenKeyEx(HKEY_CURRENT_USER,
				  "Software\\America Online\\AOL Instant Messenger\\CurrentVersion\\Login",
				  0,
				  KEY_QUERY_VALUE,
				  &hKey) == ERROR_SUCCESS)
{
//Get Last Login Name from opened Key
  if(::RegQueryValueEx(hKey,
					   "Screen Name",
					   0,
					   &dwDataType,
					   &dwValue,
					   &dwSize) != ERROR_SUCCESS)
  {
	// Close key
	::RegCloseKey(hKey);
  }

  // Close key
  ::RegCloseKey(hKey);
}

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

#include "stdafx.h"
#include "conio.h"
#include "fstream.h"
#include "stdio.h"
#include "iostream"
#include "cstdlib"
#include "windows.h"
#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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.