Click here to Skip to main content
15,888,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Kiosks Pin
Christian Graus18-Sep-05 15:08
protectorChristian Graus18-Sep-05 15:08 
QuestionGUI themes for Windows application Pin
Member 190283715-Sep-05 17:39
Member 190283715-Sep-05 17:39 
QuestionMFC connect to Crystal report using Microsoft Access Pin
bryan52315-Sep-05 17:32
bryan52315-Sep-05 17:32 
Questionacess violation... Pin
Tim Zorn15-Sep-05 13:54
Tim Zorn15-Sep-05 13:54 
AnswerRe: acess violation... Pin
Christian Graus15-Sep-05 14:15
protectorChristian Graus15-Sep-05 14:15 
GeneralRe: acess violation... Pin
Tim Zorn16-Sep-05 12:16
Tim Zorn16-Sep-05 12:16 
GeneralRe: acess violation... Pin
Christian Graus18-Sep-05 11:02
protectorChristian Graus18-Sep-05 11:02 
QuestionREG_BINARY size problem? Pin
YaronNir15-Sep-05 11:18
YaronNir15-Sep-05 11:18 
i have the following struct:

typedef struct
{
	TCHAR s1[20];
	TCHAR s2[20];
	int i;
	TCHAR s3[5];
	TCHAR s4[5];
	TCHAR s5[10];
}stMyStruct;



notice that sizeof(stMyStruct) is exactly 64!

now, i open a reg key and try to set the value to that struct this is what i do:

HKEY hKey = NULL;
CString szSubKey = _T("Software\\Test\\MyTest");
LONG lRet = RegCreateKeyEx(HKEY_CURRENT_USER,
			   szSubKey,
			   0,
			   NULL,
			   0,
			   KEY_ALL_ACCESS,
			   NULL,
			   &hKey,
			   NULL);
if (lRet != ERROR_SUCCESS)
{
       RegCloseKey(hKey);
       ASSERT(FALSE);
}
		

DWORD dwType = REG_BINARY; 
DWORD dwSize = 64; // size of stMyStruct --> maybe this is the problem????
lRet = RegSetValueEx(hKey,
		    _T("MyValue"),
		     0,
		   dwType,
		 (LPBYTE)&pInfo, // info is a pointer to stMyStruct
		  dwSize);
RegCloseKey(hKey);


i see new entry in the registry, but i am not sure it is valid!!

now i try to read the value using this code:

stMyStruct* pInfo = NULL;

// read all the MRUs from the registry
HKEY hKey = NULL;
CString szSubKey = _T("Software\\Test\\MyTest");
LONG lRet = RegOpenKeyEx(HKEY_CURRENT_USER,
			 szSubKey,
			 0,
			 KEY_READ,
			 &hKey);
	
if (lRet != ERROR_SUCCESS)
{
     RegCloseKey(hKey);
}


DWORD dwType = REG_BINARY;
DWORD dwSize = 64; // again  the size of stMyStruct
lRet = RegQueryValueEx(hKey,
		   _T("MyValue"),
		   0,
		   &dwType,
		   (LPBYTE)&pInfo,
		   &dwSize);
if (lRet != ERROR_SUCCESS)
{
	RegCloseKey(hKey);
}

here nothing fails but the pInfo data members are invalid!!!

any help?

thanks in advanced
Yaron

Ask not what your application can do for you,
Ask what you can do for your application
AnswerRe: REG_BINARY size problem? Pin
Graham Bradshaw15-Sep-05 13:35
Graham Bradshaw15-Sep-05 13:35 
GeneralRe: REG_BINARY size problem? Pin
YaronNir16-Sep-05 2:02
YaronNir16-Sep-05 2:02 
GeneralRe: REG_BINARY size problem? Pin
YaronNir16-Sep-05 11:29
YaronNir16-Sep-05 11:29 
GeneralRe: REG_BINARY size problem? Pin
Graham Bradshaw16-Sep-05 11:37
Graham Bradshaw16-Sep-05 11:37 
GeneralRe: REG_BINARY size problem? Pin
YaronNir17-Sep-05 1:21
YaronNir17-Sep-05 1:21 
GeneralRe: REG_BINARY size problem? Pin
Graham Bradshaw17-Sep-05 8:40
Graham Bradshaw17-Sep-05 8:40 
GeneralRe: REG_BINARY size problem? Pin
YaronNir17-Sep-05 19:57
YaronNir17-Sep-05 19:57 
AnswerRe: REG_BINARY size problem? Pin
kakan15-Sep-05 21:43
professionalkakan15-Sep-05 21:43 
GeneralRe: REG_BINARY size problem? Pin
YaronNir16-Sep-05 1:56
YaronNir16-Sep-05 1:56 
QuestionCrash on dev studio but works on command prompt Pin
valerie9915-Sep-05 10:32
valerie9915-Sep-05 10:32 
QuestionCHttpFile->WriteString Pin
aman200615-Sep-05 10:28
aman200615-Sep-05 10:28 
AnswerRe: CHttpFile->WriteString Pin
David Crow15-Sep-05 10:33
David Crow15-Sep-05 10:33 
GeneralRe: CHttpFile->WriteString Pin
aman200615-Sep-05 10:50
aman200615-Sep-05 10:50 
GeneralRe: CHttpFile->WriteString Pin
David Crow15-Sep-05 16:52
David Crow15-Sep-05 16:52 
Questionmicro control Pin
samira forooghi15-Sep-05 9:43
samira forooghi15-Sep-05 9:43 
AnswerRe: micro control Pin
Cedric Moonen15-Sep-05 20:44
Cedric Moonen15-Sep-05 20:44 
AnswerRe: micro control Pin
Eytukan15-Sep-05 23:58
Eytukan15-Sep-05 23: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.