Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How could I show the time in View Pin
Parthi_Appu27-Jul-06 19:45
Parthi_Appu27-Jul-06 19:45 
QuestionMacro Pin
Hing27-Jul-06 16:10
Hing27-Jul-06 16:10 
AnswerRe: Macro Pin
Hing27-Jul-06 16:24
Hing27-Jul-06 16:24 
QuestionWM_DROPFILES for individual control... Pin
Nitron27-Jul-06 11:08
Nitron27-Jul-06 11:08 
AnswerRe: WM_DROPFILES for individual control... Pin
led mike27-Jul-06 11:43
led mike27-Jul-06 11:43 
GeneralRe: WM_DROPFILES for individual control... Pin
Nitron27-Jul-06 18:18
Nitron27-Jul-06 18:18 
QuestionReadinf From The Registry [modified] Pin
Semion_N27-Jul-06 9:43
Semion_N27-Jul-06 9:43 
AnswerRe: Readinf From The Registry [modified] Pin
PJ Arends27-Jul-06 10:13
professionalPJ Arends27-Jul-06 10:13 
Semion_N wrote:
CRegKey key;
key.Open(HKEY_LOCAL_MACHINE,"Software\\MyProject\\key");


What is the return value? Open will fail if HKLM\Software\MyProject\key does not exist. Use CRegKey::Create() instead.

Semion_N wrote:
Every time I execute the program I'm getting an assertation that m_hKey ! = 0

key.open() is failing, so CRegKey::m_hKey is zero.

Do not remove the ASSERTS, they are used to tell you when you do something wrong.

Semion_N wrote:
key.QueryStringValue(?,?,?)

From MSDN:
Parameters
pszValueName
Pointer to a null-terminated string containing the name of the value to query.

pszValue
Pointer to a buffer that receives the string data.

pnChars
The size, in TCHARs, of the buffer pointed to by pszValue. When the method returns, pnChars contains the size, in TCHARs, of the string retrieved, including a terminating null character.

Return Value
If the method succeeds, ERROR_SUCCESS is returned. If the method fails to read a value, it returns a nonzero error code defined in WINERROR.H. If the data referenced is not of type REG_SZ, ERROR_INVALID_DATA is returned. If the method returns ERROR_MORE_DATA, pnChars equals zero, not the required buffer size in bytes.


CRegKey key;
if (ERROR_SUCCESS == key.Create(HKEY_LOCAL_MACHINE, "Software\\MyProject\\key"))
{
   if (ERROR_SUCCESS == key.SetStringValue("TRUE_KEY", "TRUE_VALUE"))
   {
      char readbuffer[30] = {0};
      ULONG buffersize = 30;
      if (ERROR_SUCCESS == key.QueryStringValue("TRUE_KEY", readbuffer, &buffersize))
      {
         if (0 == strcmp(readbuffer, "TRUE_VALUE"))
         {
            MessageBox("TRUE");
         }
      }
   }
}

GeneralRe: Readinf From The Registry Pin
Semion_N28-Jul-06 9:47
Semion_N28-Jul-06 9:47 
GeneralRe: Readinf From The Registry Pin
PJ Arends31-Jul-06 10:38
professionalPJ Arends31-Jul-06 10:38 
Questionparameter question Pin
Jay0327-Jul-06 9:41
Jay0327-Jul-06 9:41 
AnswerRe: parameter question Pin
valikac27-Jul-06 10:09
valikac27-Jul-06 10:09 
GeneralRe: parameter question Pin
Jay0327-Jul-06 10:29
Jay0327-Jul-06 10:29 
GeneralRe: parameter question Pin
Alex_Y27-Jul-06 11:34
Alex_Y27-Jul-06 11:34 
QuestionRe: parameter question Pin
Alex_Y27-Jul-06 10:31
Alex_Y27-Jul-06 10:31 
AnswerRe: parameter question Pin
Jay0327-Jul-06 10:41
Jay0327-Jul-06 10:41 
AnswerRe: parameter question Pin
David Crow27-Jul-06 10:53
David Crow27-Jul-06 10:53 
GeneralRe: parameter question Pin
Alex_Y27-Jul-06 11:31
Alex_Y27-Jul-06 11:31 
AnswerRe: parameter question Pin
Christian Graus27-Jul-06 11:16
protectorChristian Graus27-Jul-06 11:16 
GeneralRe: parameter question Pin
Jay0328-Jul-06 5:53
Jay0328-Jul-06 5:53 
GeneralRe: parameter question Pin
Christian Graus28-Jul-06 10:45
protectorChristian Graus28-Jul-06 10:45 
GeneralRe: parameter question Pin
Jay0328-Jul-06 7:07
Jay0328-Jul-06 7:07 
AnswerRe: parameter question Pin
toxcct27-Jul-06 21:34
toxcct27-Jul-06 21:34 
GeneralRe: parameter question Pin
Jay0328-Jul-06 7:00
Jay0328-Jul-06 7:00 
AnswerRe: parameter question Pin
Zac Howland28-Jul-06 9:34
Zac Howland28-Jul-06 9:34 

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.