Solved

Win32 RegSetValueEx

Posted on 1997-02-22
1
419 Views
Last Modified: 2013-12-04
Hello,

Why I compile this, he said E:\projet compress\exDlg.cpp(218) : error C2664: 'RegSetValueExA' : cannot convert parameter 5 from 'char [3]' to 'const unsigned char *' (new behavior; please see help)


DWORD dwType;
HKEY hKey;
LONG retCode;
DWORD dwBytes = 128;
unsigned char szBuffer[256];

retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                                          "SOFTWARE\\FILE",
                                          0,
                                          KEY_SET_VALUE,
                                          &hKey3);
            RegQueryValueEx(hKey, "subkey1", 0, &dwType,
                              szBuffer3, &dwBytes);
            RegSetValueEx(hKey, "subkey2", 0, REG_SZ, "ab", 14 );
            RegCloseKey(hKey);

Thanks in advance for the response

0
Comment
Question by:puce020497
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
gvg earned 5 total points
ID: 1298770
I can't see where you declair hKey3 but I guess you do it like this

HKEY  hKey3[ 3 ];

now hKey3 is of the type HKEY[ 3 ] ( *char[3]  )

so if you do &hKey3 you have the type char[ 3 ] but you need a pointer.
You could do it like this

&hKey[ 0 ];

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question