Solved

Win32 RegSetValueEx

Posted on 1997-02-22
1
408 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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