Click here to Skip to main content
15,919,422 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Self delete Pin
jhwurmbach9-Aug-07 0:52
jhwurmbach9-Aug-07 0:52 
GeneralRe: Self delete Pin
toxcct9-Aug-07 1:30
toxcct9-Aug-07 1:30 
GeneralRe: Self delete Pin
jhwurmbach9-Aug-07 1:32
jhwurmbach9-Aug-07 1:32 
GeneralRe: Self delete Pin
Rage9-Aug-07 5:20
professionalRage9-Aug-07 5:20 
AnswerRe: Self delete Pin
David Crow9-Aug-07 3:08
David Crow9-Aug-07 3:08 
AnswerRe: Self delete Pin
Russell'9-Aug-07 3:15
Russell'9-Aug-07 3:15 
GeneralRe: Self delete Pin
Russell'9-Aug-07 3:17
Russell'9-Aug-07 3:17 
QuestionCreate Registry Key with C++ Pin
J_E_D_I9-Aug-07 0:26
J_E_D_I9-Aug-07 0:26 
I am wondering if anybody could help. I have written a program in C++ and now I need to read and create Registry Keys. I know how to do it in VB (it's pretty simple) but I have no idea on how to do it in C++. I didn't find VS and MSDN online help resources very useful.

To read a key I have tried:

#include "stdafx.h"
#include <ctime>
#include <math.h>
#include <fstream>
#include <string>
#include <iostream>
using std::dec;
using std::hex;
using namespace std;
#include <iomanip>
using std::setprecision;
using std::setbase;
#include <cstdlib>
using std::atof;
#include <windows.h>

#pragma comment(lib, "user32.lib ")
#include <stdio.h>

int_tmain(int argc, _TCHAR* argv[])
{
HKEY temporarykey;
TCHAR License[64];
DWORD lpcbData = 64;

LPCWSTR lpPointer;

char Licenza[] = "License";
lpPointer = &Licenza[0];

lpPointer

RegOpenKeyEx(HKEY_LOCAL_MACHINE,

"SOFTWARE\\XXX\\License",0,
KEY_QUERY_VALUE ,&temporarykey);

RegQueryValueEx(temporarykey,

"License", NULL, NULL,
(LPBYTE)License, &lpcbData);

RegCloseKey(temporarykey);

return 0;
}

But I get these two errors:
Error 1 error C2664: 'RegOpenKeyExW' : cannot convert parameter 2 from 'const char [23]' to 'LPCWSTR' c:\documents and settings\edy\my documents\my programs\giovi read reg key\giovi read reg key\giovi read reg key.cpp 31

Error 2 error C2664: 'RegQueryValueExW' : cannot convert parameter 2 from 'const char [8]' to 'LPCWSTR' c:\documents and settings\edy\my documents\my programs\giovi read reg key\giovi read reg key\giovi read reg key.cpp 34

What am I doing wrong? I am working in c++ / Console Win32. Any advice please? Thank you

jEDI
AnswerRe: Create Registry Key with C++ Pin
Ranjoy Guha9-Aug-07 0:40
Ranjoy Guha9-Aug-07 0:40 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I9-Aug-07 0:53
J_E_D_I9-Aug-07 0:53 
GeneralRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 0:56
jhwurmbach9-Aug-07 0:56 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I9-Aug-07 1:13
J_E_D_I9-Aug-07 1:13 
GeneralRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 1:18
jhwurmbach9-Aug-07 1:18 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I9-Aug-07 2:05
J_E_D_I9-Aug-07 2:05 
GeneralRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 2:26
jhwurmbach9-Aug-07 2:26 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I9-Aug-07 4:01
J_E_D_I9-Aug-07 4:01 
GeneralRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 5:36
jhwurmbach9-Aug-07 5:36 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I11-Aug-07 3:06
J_E_D_I11-Aug-07 3:06 
GeneralRe: Create Registry Key with C++ Pin
David Crow9-Aug-07 3:16
David Crow9-Aug-07 3:16 
GeneralRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 3:35
jhwurmbach9-Aug-07 3:35 
GeneralRe: Create Registry Key with C++ Pin
Ranjoy Guha9-Aug-07 1:25
Ranjoy Guha9-Aug-07 1:25 
AnswerRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 0:54
jhwurmbach9-Aug-07 0:54 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I9-Aug-07 1:10
J_E_D_I9-Aug-07 1:10 
GeneralRe: Create Registry Key with C++ Pin
jhwurmbach9-Aug-07 1:15
jhwurmbach9-Aug-07 1:15 
GeneralRe: Create Registry Key with C++ Pin
Jim Crafton9-Aug-07 8:33
Jim Crafton9-Aug-07 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.