| | |
Question regarding reading from registry (Win32) VC6
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2004
Posts: 5
Reputation:
Solved Threads: 0
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)
These are my includes, which I'm not sure about either
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.
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)
C++ Syntax (Toggle Plain Text)
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
C++ Syntax (Toggle Plain Text)
#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.
![]() |
Similar Threads
- registry help Win32 (C++)
- Quick Question (C++)
- Question on loops (C++)
- Search the windows registry. (C++)
- Question? (C++)
- Reading a Registry Key path from a file (C++)
- progress bar (Visual Basic 4 / 5 / 6)
- Question:: reading from an input stream. (C++)
Other Threads in the C++ Forum
- Previous Thread: Function that returns void
- Next Thread: missing function header
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete deploy desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





