I have another dialog called Login Dialog.
Basically it has two text boxes. One is Username_Box and another is Password_Box.
this is basically just to login to my main dialog.
however I get an assertion error when I try to read registry values and set it into these two boxes from my main dialog code.
i guess that 'RegQueryValueEx' writes the data into 'szString'. so what's 'szString'? has it enough capacity to hold the data? contains 'dwSize' the correct number of bytes for 'szString'?
it seems to fail on the part of the code where it checks if the dialog is a window....
this sounds as if the window (logindlg? Username_Box?) doesn't exists when you call SetWindowTextA. So you have to call it later. but i can't tell you where or when. Is it MFC? then having the class is not enough...
yes it is MFC.....what do u mean by having the classs is not enough?even if i call it later like after logindlg.domodal()...it still hits the assertion error.
BOOL CSimpleDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_cMyEdit.SetWindowText(_T("My Name")); // Initialize control values
m_cMyList.ShowWindow(SW_HIDE); // Show or hide a control, etc.
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
well that excerpt doesn't tell enough.
What about CDialog::OnCancel();? Doesn't it end your dialog and hence destroy all your windows (including Username_Box)?
You should post it in Windows section of this board
this is general C++ programming section and your problem is a MFC related. Looking for a Windows/MFC-forum wouldn't be the worst thing you can do (www.codeproject.com seems not so bad for instance).