Solved

Win32 RegSetValueEx

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

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…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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