Solved

Win32 RegSetValueEx

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now