Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CObList Pin
Monty226-Dec-03 23:31
Monty226-Dec-03 23:31 
GeneralMessages problems Pin
Atlence25-Dec-03 22:20
Atlence25-Dec-03 22:20 
GeneralRe: Messages problems Pin
valikac26-Dec-03 5:38
valikac26-Dec-03 5:38 
GeneralRe: Messages problems Pin
Atlence26-Dec-03 14:06
Atlence26-Dec-03 14:06 
Generalabout ScrollBar... Pin
Grrrr25-Dec-03 20:56
Grrrr25-Dec-03 20:56 
GeneralRe: about ScrollBar... Pin
Monty225-Dec-03 21:23
Monty225-Dec-03 21:23 
Questionhow to enumerate Input/Output devices ??? Pin
skpanda25-Dec-03 20:43
skpanda25-Dec-03 20:43 
AnswerRe: how to enumerate Input/Output devices ??? Pin
skpanda26-Dec-03 18:36
skpanda26-Dec-03 18:36 
GeneralRe: how to enumerate Input/Output devices ??? Pin
skpanda26-Dec-03 21:22
skpanda26-Dec-03 21:22 
AnswerRe: how to enumerate Input/Output devices ??? Pin
Monty226-Dec-03 23:35
Monty226-Dec-03 23:35 
GeneralRe: how to enumerate Input/Output devices ??? Pin
skpanda28-Dec-03 18:31
skpanda28-Dec-03 18:31 
GeneralRe: how to enumerate Input/Output devices ??? Pin
Monty228-Dec-03 21:01
Monty228-Dec-03 21:01 
GeneralRe: how to enumerate Input/Output devices ??? Pin
skpanda1-Jan-04 23:08
skpanda1-Jan-04 23:08 
QuestionHow to get all desktop icons? Pin
ioat25-Dec-03 19:16
ioat25-Dec-03 19:16 
GeneralRegarding drw_dxf.h Pin
cithu25-Dec-03 18:22
cithu25-Dec-03 18:22 
Questionhow to write and save ini files like some apps do with their ini's Pin
ELY M.25-Dec-03 18:04
ELY M.25-Dec-03 18:04 
AnswerRe: how to write and save ini files like some apps do with their ini's Pin
Michael Dunn25-Dec-03 19:12
sitebuilderMichael Dunn25-Dec-03 19:12 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.25-Dec-03 21:24
ELY M.25-Dec-03 21:24 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 4:27
shultas26-Dec-03 4:27 
AnswerRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 12:49
ELY M.26-Dec-03 12:49 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 14:01
shultas26-Dec-03 14:01 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 14:44
ELY M.26-Dec-03 14:44 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 16:10
shultas26-Dec-03 16:10 
Okay. Gotcha.

What I would do is this. Open up your classview and add a new member to the declaration of your CTESTINI2Dlg.
class CTESTINI2Dlg : public CDialog
{
.......
.......

protected:
HICON m_hIcon;
int topKeyValue; // <------ Add this in there

Then, expand the view for the CTESTINI2Dlg. Double click on the OnInitDialog() method.
Look for the following lines (at the end of this method)

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
topKeyValue = 0; // <----------- Add that in there

Then, double click on your OnAddStrings() method. This should go in there INSTEAD of the for{} loop. Get rid of that loop.

void CTESTINI2Dlg::OnAddstrings()
{
char sIniFile[MAX_PATH];
GetModuleFileName( NULL, sIniFile, MAX_PATH );
strcpy( strrchr( sIniFile, '\\' ) + 1, "strings.ini" );

CEdit* getstring = (CEdit*)GetDlgItem(IDC_EDIT4);
CString putstring;
getstring->GetWindowText(putstring);
CString KeyName;
topKeyValue++;
KeyName.Format("n%ld", topKeyValue);
WritePrivateProfileString("TEST", KeyName, putstring, sIniFile);
MessageBox("Added...");
}

Okay. What this does is add an integer variable to your CTESTINI2Dlg class named topKeyValue. Then, in your OnInitDialog() code, topKeyValue = 0; that is initializing it to 0 when the program starts up. Then, in your OnAddstrings() method, topKeyValue++ increments the member variable by one, formats it in the KeyName.Format string, and writes that number accordingly. Each time you press the add strings button, topKeyValue gets incremented by 1, thus allowing you to write a new line into the file!

So, what are you trying to do, screw with someones MIRC INI files? Wink | ;-)
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 18:42
ELY M.26-Dec-03 18:42 
AnswerRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 16:01
ELY M.26-Dec-03 16:01 

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.