Solved

Win32 RegSetValue variable

Posted on 1997-02-23
2
476 Views
Last Modified: 2013-12-04
Hi,

I want to stores data in the value field of an open registry key
with RegSetValue but value to store is a CString variable.

How do I do ?

CString exemple;

RegSetValueEx(hKey3, "file", 0, REG_SZ, (LPBYTE)exemple, 14 );
0
Comment
Question by:puce020497
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 0 total points
ID: 1334181
What you can do is the following,
RegSetValueEx(hKey3, "file", 0, REG_SZ, (CONST BYTE *)exemple, exemple.GetLength());
0
 

Expert Comment

by:gurumike
ID: 1334182
Actually, you need to change that last parameter to exemple.GetLength()+1, since the registry needs to allocate enough space to include the terminating null character.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run Program using VBScript 3 73
mixing C++ & C# in Vis Studio 2013 7 202
String manipulation in Visual Basic 7 73
How can my static class become undefined?? 8 64
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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