Code:
//#define UNICODE //Uncomment for unicode build (Faster on NT/XP)
//#define _UNICODE//Uncomment for unicode build (Not for Win95/98)
#include <windows.h>
#include <tchar.h>
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE,LPSTR,int){
const int cBuffSize = 255;//Size of buffer
TCHAR szBuff[cBuffSize] = {0},//Actual buffer
*szPath = //Path of key
_T("SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage");
HKEY hKey = NULL;//Key used to hget value
DWORD dwSize = cBuffSize; //To tell buff size and recieve actual size
//First open a key to allow you to read the registry
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,//Main key to browse
szPath,//sub key
0,
KEY_READ,//access rights - we want to read
&hKey)//Recieve the key we want to use
!= ERROR_SUCCESS){
MessageBox(HWND_DESKTOP,_T("Could not open key"),NULL,MB_OK);
return 1;
}
if(RegQueryValueEx(hKey,//From previous call
_T("ACP"),//value we want to look at
0,
NULL,//not needed,we know its a string
(UCHAR*)szBuff,//Put info here
&dwSize)//How big is the buffer?
!= ERROR_SUCCESS){
MessageBox(HWND_DESKTOP,_T("Could not get value"),NULL,MB_OK);
return 1;
}
MessageBox(HWND_DESKTOP,szBuff,_T("Result"),MB_OK);
RegCloseKey(hKey);//Dont forget to cleanup!!!!
return 0;
}
>>*cough* MSDN you freak!! *cough*
Cute!