CODE:external (INT, "GetPrivateProfileString", "GetPrivateProfileStringA", "kernel32.dll");
external (INT, "WritePrivateProfileString", "WritePrivateProfileStringA", "kernel32.dll");
char str[255];
string path="C:\Настр.ini"; // путь к файлу настроек
int pos_size_button0[1][4];
string text_button0[1];
int flag_button0[1];
pos_size_button0[0][0]=20; pos_size_button0[0][1]=200; pos_size_button0[0][2]=130; pos_size_button0[0][3]=20;
text_button0[0]="Сохранить настройки";
/////
////// начало с редактора диалогов
int pos_size_check0[4][4];
string text_check0[4];
int flag_check0[4];
pos_size_check0[0][0]=12; pos_size_check0[0][1]=20; pos_size_check0[0][2]=60; pos_size_check0[0][3]=20;
pos_size_check0[1][0]=12; pos_size_check0[1][1]=46; pos_size_check0[1][2]=60; pos_size_check0[1][3]=20;
pos_size_check0[2][0]=12; pos_size_check0[2][1]=110; pos_size_check0[2][2]=60; pos_size_check0[2][3]=20;
pos_size_check0[3][0]=13; pos_size_check0[3][1]=134; pos_size_check0[3][2]=60; pos_size_check0[3][3]=20;
text_check0[0]="Галка 0"; text_check0[1]="Галка 1"; text_check0[2]="Галка 2"; text_check0[3]="Галка 3";
flag_check0[0]=0; flag_check0[1]=0; flag_check0[2]=0; flag_check0[3]=0;
//////////
int pos_size_combo0[1][4];
string text_combo0[1][4];
int strok_combo0[1];
int flag_combo0[1];
pos_size_combo0[0][0]=12; pos_size_combo0[0][1]=79; pos_size_combo0[0][2]=100; pos_size_combo0[0][3]=100;
strok_combo0[0]=4;
text_combo0[0][0]="65"; text_combo0[0][1]="75"; text_combo0[0][2]="150"; text_combo0[0][3]="уп";
flag_combo0[0]=0;
//////////
createdialog(0, CHECK, #pos_size_check0[0][0], #text_check0[0], #flag_check0[0] |
COMBO, #pos_size_combo0[0][0], #text_combo0[0][0], #strok_combo0[0], #flag_combo0[0] |
BUTTON, #pos_size_button0[0][0], #text_button0[0], #flag_button0[0]);
//////////
showdialog(0, "Диалог", 835, 390, 250, 300, 1, 1);
//////////
////// конец с редактора диалогов
if(fopen(path, "r")!=0) // если файл с настройками открылся, т. е. существует
{
fclose();
sleep(300);
if(GetPrivateProfileString ("Default", "combo", 0, address (#str[0]), 255, path))
flag_combo0[0]=formatsn(format (#str[0]));
if(GetPrivateProfileString ("Default", "Button0", 0, address (#str[0]), 255, path))
flag_check0[0]=formatsn(format (#str[0]));
if(GetPrivateProfileString ("Default", "Button1", 0, address (#str[0]), 255, path))
flag_check0[1]=formatsn(format (#str[0]));
if(GetPrivateProfileString ("Default", "Button2", 0, address (#str[0]), 255, path))
flag_check0[2]=formatsn(format (#str[0]));
if(GetPrivateProfileString ("Default", "Button3", 0, address (#str[0]), 255, path))
flag_check0[3]=formatsn(format (#str[0]));
}
enabletimer(0);
loop()sleep(100);
CREATE_TIMER(0, 200)
{
if(flag_button0[0])
{
flag_button0[0]=0;
WritePrivateProfileString ("Default", "combo", format(flag_combo0[0]), path);
WritePrivateProfileString ("Default", "Button0", format(flag_check0[0]), path);
WritePrivateProfileString ("Default", "Button1", format(flag_check0[1]), path);
WritePrivateProfileString ("Default", "Button2", format(flag_check0[2]), path);
WritePrivateProfileString ("Default", "Button3", format(flag_check0[3]), path);
messagebox("Настройки сохранены");
}
}