I have reduced the code to a very simple example with only one control in order to expose my problem in a clearer way.
The whole purpose of this thing is to use GetPrivateProfileString to read values from a ini and set them in vars. Then create all my mainwindow controls and call VarsToControls to adjust their state.
And when i close my app, it will get the current state of the controls and write the to the ini using WritePrivateProfileString before exiting.
Maybe it´s something simple, i don´t know... 2 entire days looking at the whole code, i´m beginning to get lost here.
Any help will be great
Code:
//char strCB1[2]; //This is declared at main.h
------------iniIO.h------------------
int ini_read() { //This is called from main.c before the controls are created.
GetPrivateProfileString("CheckBox1", "state", "1", strCB1, 2, "C:\\myapp\\myapp.ini");
return 0;
}
int VarsToControls() { //This is called from main.c after the controls are created.
if (strCB1==1) {
MessageBox (NULL, TEXT (strCB1), "strCB1 is equal to 1", MB_ICONERROR);
//Theres code doing stuff here, setting edit fields as enabled/disabled, etc//
}
else {
MessageBox (NULL, TEXT (strCB1), "strCB1 is not equal to 1", MB_ICONERROR);
//Theres code doing stuff here, setting edit fields as enabled/disabled, etc//
}
return 0;
}
-----------------------------------------------------------
Here´s the thing: I have placed this msbBoxes there to try to understand whats going on with my code. I always get the "strCB1 is not equal to 1" msgBox, and it shows me the value of strCB1 as 1
No compilor error or warnings using DEV-CPP (mingw 2.0, gcc3.2).