Solved

Win32 RegSetValue variable

Posted on 1997-02-23
2
466 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
Comment Utility
What you can do is the following,
RegSetValueEx(hKey3, "file", 0, REG_SZ, (CONST BYTE *)exemple, exemple.GetLength());
0
 

Expert Comment

by:gurumike
Comment Utility
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

IT, Stop Being Called Into Every Meeting

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now