Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Win32 RegSetValue variable

Posted on 1997-02-23
2
Medium Priority
?
494 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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 …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

772 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