Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to convert CString to char*? Pin
Williams23-Jul-02 3:19
Williams23-Jul-02 3:19 
GeneralDialog window tricks Pin
NickOne22-Jul-02 11:00
NickOne22-Jul-02 11:00 
GeneralRe: Dialog window tricks Pin
Christian Graus22-Jul-02 12:26
protectorChristian Graus22-Jul-02 12:26 
GeneralRe: Dialog window tricks Pin
Philippe Mori22-Jul-02 12:41
Philippe Mori22-Jul-02 12:41 
GeneralRe: Dialog window tricks Pin
Shog922-Jul-02 12:52
sitebuilderShog922-Jul-02 12:52 
GeneralProblems reading from registry Pin
esapp42022-Jul-02 10:12
esapp42022-Jul-02 10:12 
GeneralRe: Problems reading from registry Pin
Le centriste22-Jul-02 10:28
Le centriste22-Jul-02 10:28 
GeneralRe: Problems reading from registry Pin
Len Holgate22-Jul-02 10:47
Len Holgate22-Jul-02 10:47 
lpdwLength should be the address of a dword, not an uninitialised pointer pointing into randomness.

The value in that dword is size of the buffer you're passing in, or 0 if you're not passing a buffer. After the call it's the size of the buffer required (or the size of the buffer that was used (same thing)). It kinda says all that in the MSDN docs.

So, something like this might work (beware, it hasn't seen a compiler). Or you can try a wrapper class, like the one I wrote about here.

HKEY hKey = NULL

long ret = ::RegCreateKeyEx(
   HKEY_CLASSES_ROOT, 
   "CLSID", 
   0, 
   NULL, 
   REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, 
   NULL, 
   &hKey, 
   NULL);

if (ret == ERROR_SUCCESS)
{ 
   CHAR szBuf[100];
   DWORD dwLength = sizeof(szBuf);

   ret = ::RegQueryValueEx(hKey, "E1", 0, 0, (LPBYTE)szBuf, &dwLength);

   if (ret == ERROR_SUCCESS)
   {
      // got a value...
   }

   ::RegCloseKey(hKey);
}
else
{
   // error, deal with it.
}


Len Holgate
www.jetbyte.com
The right code, right now.
GeneralRe: Problems reading from registry Pin
esapp42022-Jul-02 11:05
esapp42022-Jul-02 11:05 
GeneralRe: Problems reading from registry Pin
Len Holgate22-Jul-02 11:44
Len Holgate22-Jul-02 11:44 
Generalautomation.. Pin
pnpfriend22-Jul-02 10:00
pnpfriend22-Jul-02 10:00 
Generalemail and www link on a dialog Pin
d.schaeflein22-Jul-02 8:39
d.schaeflein22-Jul-02 8:39 
GeneralRe: email and www link on a dialog Pin
Steve L.22-Jul-02 9:22
Steve L.22-Jul-02 9:22 
GeneralRe: email and www link on a dialog Pin
d.schaeflein22-Jul-02 22:48
d.schaeflein22-Jul-02 22:48 
GeneralC/C++ problem. Pin
Michael Liu22-Jul-02 8:38
Michael Liu22-Jul-02 8:38 
GeneralRe: C/C++ problem. Pin
Bill Wilson22-Jul-02 8:46
Bill Wilson22-Jul-02 8:46 
GeneralRe: C/C++ problem. Pin
realfly22-Jul-02 15:24
realfly22-Jul-02 15:24 
GeneralRe: C/C++ problem. Pin
Alexandru Savescu22-Jul-02 21:47
Alexandru Savescu22-Jul-02 21:47 
GeneralCSliderCtrl help Pin
JennyP22-Jul-02 8:31
JennyP22-Jul-02 8:31 
GeneralRe: CSliderCtrl help Pin
benjymous22-Jul-02 22:39
benjymous22-Jul-02 22:39 
GeneralRe: CSliderCtrl help Pin
JennyP23-Jul-02 6:45
JennyP23-Jul-02 6:45 
GeneralRe: CSliderCtrl help Pin
benjymous23-Jul-02 11:10
benjymous23-Jul-02 11:10 
GeneralICMP Messages Pin
orcun colak22-Jul-02 8:14
orcun colak22-Jul-02 8:14 
Questioninformation for IExplorer plugins? Pin
OmarLodhi22-Jul-02 7:50
OmarLodhi22-Jul-02 7:50 
Generaldisabling menus Pin
SilentWarrior22-Jul-02 7:38
SilentWarrior22-Jul-02 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.