Click here to Skip to main content
15,898,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC example Pin
BobInNJ15-Oct-08 14:44
BobInNJ15-Oct-08 14:44 
QuestionRe: MFC example Pin
David Crow15-Oct-08 17:32
David Crow15-Oct-08 17:32 
AnswerRe: MFC example Pin
CPallini15-Oct-08 21:56
mveCPallini15-Oct-08 21:56 
GeneralRe: MFC example Pin
BobInNJ16-Oct-08 4:44
BobInNJ16-Oct-08 4:44 
QuestionEnvironment Variables Pin
jpyp15-Oct-08 11:47
jpyp15-Oct-08 11:47 
AnswerRe: Environment Variables Pin
Mark Salsbery15-Oct-08 13:30
Mark Salsbery15-Oct-08 13:30 
GeneralRe: Environment Variables Pin
jpyp16-Oct-08 8:26
jpyp16-Oct-08 8:26 
GeneralRe: Environment Variables [modified] Pin
Mark Salsbery16-Oct-08 9:11
Mark Salsbery16-Oct-08 9:11 
You couldn't possibly compile that Smile | :)

Try
HKEY hMyKey;

if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Environment"), 0, KEY_QUERY_VALUE, &hMyKey))
{
   DWORD KeyType;
   DWORD KeySize = 0;
   TCHAR strKeyName[] = _T("SSSRights");

   if (ERROR_SUCCESS == ::RegQueryValueEx(hMyKey, strKeyName, NULL, &KeyType, NULL, &KeySize))
   {
      <code>// Note:  Assumes we KNOW the data type is REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ!!</code>

      TCHAR *pKeyVal = new TCHAR[KeySize / sizeof (TCHAR)];

      ::RegQueryValueEx(hMyKey, strKeyName, NULL, &KeyType, (LPBYTE)pKeyVal, &KeySize);

      // ... do something with the retrieved value (in the pKeyVal array) ...

      delete[] pKeyVal;
   }

   ::RegCloseKey(hMyKey);
}


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

modified on Thursday, October 16, 2008 3:51 PM

GeneralRe: Environment Variables Pin
jpyp16-Oct-08 10:15
jpyp16-Oct-08 10:15 
GeneralRe: Environment Variables [modified] Pin
Mark Salsbery16-Oct-08 10:27
Mark Salsbery16-Oct-08 10:27 
GeneralRe: Environment Variables Pin
jpyp16-Oct-08 10:52
jpyp16-Oct-08 10:52 
GeneralRe: Environment Variables Pin
Mark Salsbery16-Oct-08 11:03
Mark Salsbery16-Oct-08 11:03 
QuestionWeird error... Pin
Megidolaon15-Oct-08 11:08
Megidolaon15-Oct-08 11:08 
AnswerRe: Weird error... PinPopular
led mike15-Oct-08 11:32
led mike15-Oct-08 11:32 
GeneralRe: Weird error... Pin
Megidolaon15-Oct-08 11:37
Megidolaon15-Oct-08 11:37 
GeneralRe: Weird error... Pin
CPallini15-Oct-08 21:51
mveCPallini15-Oct-08 21:51 
QuestionRe: Weird error... Pin
David Crow15-Oct-08 17:29
David Crow15-Oct-08 17:29 
Questionautomatically click a button in another application Pin
Russell'15-Oct-08 9:34
Russell'15-Oct-08 9:34 
QuestionRe: automatically click a button in another application Pin
David Crow15-Oct-08 10:57
David Crow15-Oct-08 10:57 
AnswerRe: automatically click a button in another application Pin
Russell'15-Oct-08 11:28
Russell'15-Oct-08 11:28 
GeneralRe: automatically click a button in another application Pin
Russell'15-Oct-08 11:57
Russell'15-Oct-08 11:57 
QuestionSpin Control Pin
WayneK10015-Oct-08 9:03
WayneK10015-Oct-08 9:03 
AnswerRe: Spin Control Pin
David Crow15-Oct-08 10:58
David Crow15-Oct-08 10:58 
QuestionWhy the activex .ocx can't find msvcr80.dll & mfc80.dll even if I install the 2005 sp1 redist.exe ? Pin
oppstp15-Oct-08 7:11
oppstp15-Oct-08 7:11 
GeneralRe: Why the activex .ocx can't find msvcr80.dll & mfc80.dll even if I install the 2005 sp1 redist.exe ? Pin
oppstp16-Oct-08 0:07
oppstp16-Oct-08 0:07 

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.