Click here to Skip to main content
15,898,826 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralClear the screen Pin
Larsson14-Apr-05 21:10
Larsson14-Apr-05 21:10 
GeneralRe: Clear the screen Pin
IdUnknown15-Apr-05 15:23
IdUnknown15-Apr-05 15:23 
General2005 Beta-1 C++/CLI Pin
TFB14-Apr-05 7:30
TFB14-Apr-05 7:30 
GeneralRe: 2005 Beta-1 C++/CLI Pin
Sheng Jiang 蒋晟20-Apr-05 12:33
Sheng Jiang 蒋晟20-Apr-05 12:33 
GeneralRe: 2005 Beta-1 C++/CLI Pin
TFB21-Apr-05 6:58
TFB21-Apr-05 6:58 
GeneralMicrosoft Word - Read Only and DisplayAlerts Ignored (important) Pin
User 172888413-Apr-05 23:43
User 172888413-Apr-05 23:43 
GeneralRe: Microsoft Word - Read Only and DisplayAlerts Ignored (important) Pin
ursus zeta14-Apr-05 10:04
ursus zeta14-Apr-05 10:04 
GeneralAccess Denied Reading Registry Pin
rexpiper13-Apr-05 7:25
rexpiper13-Apr-05 7:25 
Perhaps some of you who are more experienced with Windows programming could answer this question for me. I have the ability to access values in the Windows registry but when I try to access a variable which holds path information, I get an "Access Denied" error. The variable I am trying to read is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History. I'm using RegOpenKeyEx and RegQueryValueEx to read the value but I must be missing something here. This is the code I'm using.

void ShowError()
{
LPVOID lpMsgBuf;
if (!FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL ))
{
// Handle the error.
return;
}

// Process any inserts in lpMsgBuf.
// ...

// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );

// Free the buffer.
LocalFree( lpMsgBuf );
}

BOOL GetHistoryFolder()
{
HKEY hKey;
char szHistory[100];
DWORD dwBufLen=100;
LONG lRet;
LPDWORD Type;

lRet = RegOpenKeyEx( HKEY_CURRENT_USER,
"Software\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS ) {
ShowError();
return FALSE;
}
lRet = RegQueryValueEx( hKey, "History", NULL, (LPDWORD) &Type, (LPBYTE) szHistory, dwBufLen);
if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) {
ShowError();
if (Type == (LPDWORD)REG_SZ)
printf("Type is REG_SZ\n");
else
printf("Type is %ld\n",Type);
return FALSE;
}

RegCloseKey( hKey );
printf("History is [%s]\n",szHistory);
return(TRUE);
}

Please help!

Rex
GeneralRe: Access Denied Reading Registry Pin
rexpiper13-Apr-05 7:37
rexpiper13-Apr-05 7:37 
Generalout of paper error Pin
thamate12-Apr-05 22:28
thamate12-Apr-05 22:28 
Generalstoring diffgram element values in database tables Pin
gauravmitra12-Apr-05 0:59
gauravmitra12-Apr-05 0:59 
GeneralConvert char to int Pin
Larsson10-Apr-05 8:21
Larsson10-Apr-05 8:21 
GeneralRe: Convert char to int Pin
Christian Graus10-Apr-05 11:53
protectorChristian Graus10-Apr-05 11:53 
GeneralRe: Convert char to int Pin
ddmcr11-Apr-05 9:07
ddmcr11-Apr-05 9:07 
GeneralRe: Convert char to int Pin
Larsson12-Apr-05 5:30
Larsson12-Apr-05 5:30 
GeneralRe: Convert char to int Pin
Christian Graus12-Apr-05 15:10
protectorChristian Graus12-Apr-05 15:10 
GeneralVC++.NET2003 - Error C2146 Compiler Conformance Pin
JSadleir10-Apr-05 0:39
JSadleir10-Apr-05 0:39 
GeneralRe: VC++.NET2003 - Error C2146 Compiler Conformance Pin
Nick_Kisialiou10-Apr-05 13:43
Nick_Kisialiou10-Apr-05 13:43 
GeneralRe: VC++.NET2003 - Error C2146 Compiler Conformance Pin
JSadleir10-Apr-05 13:53
JSadleir10-Apr-05 13:53 
Generallinking error Pin
Member 16179999-Apr-05 5:46
Member 16179999-Apr-05 5:46 
GeneralRe: linking error Pin
ursus zeta10-Apr-05 11:14
ursus zeta10-Apr-05 11:14 
GeneralRe: linking error Pin
Member 161799912-Apr-05 4:49
Member 161799912-Apr-05 4:49 
GeneralRe: linking error Pin
ursus zeta14-Apr-05 10:29
ursus zeta14-Apr-05 10:29 
GeneralRe: linking error Pin
Member 161799914-Apr-05 14:30
Member 161799914-Apr-05 14:30 
GeneralCopy of MSFN post Pin
ursus zeta19-Apr-05 9:58
ursus zeta19-Apr-05 9:58 

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.