Solved

Win32 RegSetValueEx

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…

752 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