Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store and retrieve data

Status
Not open for further replies.

madhavilt

Programmer
Apr 10, 2003
7
0
0
IN
Hi,
I am newbie to PPC and VC++.
I have created one small PPC 2002 exe file(dialog based).I am adding two edit controls to take name and contact number. I am adding one list box too in the same dialog to show the list of the entries.
The problem is, when ever I close the application and restarts it, the list box is empty b'cos I am not storing the info any where.So,I am trying to store the list entries using registry or .INI file.

OnAdd() function, I need to do this.
As a test, I tried with sample data like this

CWinApp* pApp = AfxGetApp();
pApp->WriteProfileString(LPCTSTR("mysection"),LPCTSTR("myname"),LPCTSTR("madhavi"));
CString name = pApp->GetProfileString(LPCTSTR("mysection"),LPCTSTR("myname"));
AfxMessageBox(name);

when I run the code, blank message box is appearing.

Then, I came to know about SetRegistryKey() method.So, I added this code in InitDialog() method of the dialog

CWinApp* nApp = AfxGetApp();
nApp->SetRegistryKey(_T("nlt2"));

I am getting this error,
Compiling...
nlt2Dlg.cpp
C:\EVC\myprojects\nlt2\nlt2Dlg.cpp(64) : error C2248: 'SetRegistryKey' : cannot access protected member declared in class 'CWinApp'
C:\Windows CE Tools\wce300\Pocket PC 2002\mfc\include\afxwin.h(4196) : see declaration of 'SetRegistryKey'
Error executing cl.exe.

can anyone please help me,

Thanks any advance,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top