Пример данных из блокнота
Примеры данных из блокнотов (Отобразить)
Блокнот 2
и.т.д. любые значения и символы с новой строки
Цитата:
Блокнот 1
ffd
r-ffd-dd
fff rfeg
sfSdffs3
sghh-
ffd
r-ffd-dd
fff rfeg
sfSdffs3
sghh-
Блокнот 2
и.т.д. любые значения и символы с новой строки
(Добавление)
Код с диалоговым окном (Отобразить)
CODE:
#define WS_VISIBLE 0x10000000
#define WS_CHILD 0x40000000
#define WS_BORDER 0x00800000
#define BS_MULTILINE 0x00002000
#define BS_AUTOCHECKBOX 0x00000003
#define BS_AUTORADIOBUTTON 0x00000009
#define BM_SETCHECK 0x00F1
#define BST_UNCHECKED 0x0000
#define BST_CHECKED 0x0001
#define CBS_DROPDOWNLIST 0x0003
#define CB_ADDSTRING 0x0143
#define CB_GETCURSEL 0x0147
#define CB_SETCURSEL 0x014E
#define TRUE 1
#define WM_SETFONT 0x0030
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll");
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll");
external(INT, "GetWindowRect", "GetWindowRect", "User32.dll");
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll");
external(INT, "DeleteFile", "DeleteFileA", "kernel32.dll");
external(INT, "GetPrivateProfileString", "GetPrivateProfileStringA", "kernel32.dll");
external(INT, "WritePrivateProfileString", "WritePrivateProfileStringA", "kernel32.dll");
int h_font;
string rn = formatic(13)+formatic(10);
int dialogPosX_0 = 651, dialogPosY_0 = 287;
string path_settings_0 = tempfolder() + "config_file_0.ini";
int button0[1];
int flag_button0[1] = { 0 };
int autocheck0[6], flag_autocheck0 = 0;
int combobox0[1];
int flag_combobox0[1] = { 0 };
string text_combobox0[1][1];
int count_rows_combobox0[1] = { 0 };
createdialog(0);
showdialog(0, "Диалог0", dialogPosX_0, dialogPosY_0, 311, 147, 4, 1);
loop()
{
// тут нужный код
sleep(10);
}
end_0:;
function getmessage(0, WM_CREATE)
{
int i;
int j;
char c_text_combobox[999];
load_config_0(); // функция для загрузки настроек
h_font = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Arial");
button0[0] = CreateWindow(0, "BUTTON", "Run", WS_VISIBLE | WS_CHILD, 8, 88, 288, 20, gethwnd(0), 0, 0, 0);
autocheck0[0] = CreateWindow(0, "BUTTON", "Блокнот 1", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 8, 40, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[1] = CreateWindow(0, "BUTTON", "Блокнот 2", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 8, 64, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[2] = CreateWindow(0, "BUTTON", "Блокнот 3", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 112, 40, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[3] = CreateWindow(0, "BUTTON", "Блокнот 4", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 112, 64, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[4] = CreateWindow(0, "BUTTON", "Блокнот 5", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 216, 40, 80, 20, gethwnd(0), 0, 0, 0);
autocheck0[5] = CreateWindow(0, "BUTTON", "Блокнот 6", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 216, 64, 80, 20, gethwnd(0), 0, 0, 0);
combobox0[0] = CreateWindow(0, "COMBOBOX", "", WS_VISIBLE | WS_CHILD | WS_BORDER | CBS_DROPDOWNLIST, 8, 8, 288, 23, gethwnd(0), 0, 0, 0);
if(flag_autocheck0 > -1)sendmessage(BM_SETCHECK, BST_CHECKED, 0, formatiw(autocheck0[flag_autocheck0]));
for(i=0; i<1; i++)
{
for(j=0; j<count_rows_combobox0[i]; j++)
{
strcpy(#c_text_combobox[0], text_combobox0[i][j]);
sendmessage(CB_ADDSTRING, 0, address(#c_text_combobox[0]), formatiw(combobox0[i]));
}
}
for(i=0; i<1; i++)sendmessage(CB_SETCURSEL, flag_combobox0[i], 0, formatiw(combobox0[i]));
for(i=0; i<1; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(button0[i]));
for(i=0; i<6; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(autocheck0[i]));
for(i=0; i<1; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(combobox0[i]));
}
function getmessage(0, WM_COMMAND)
{
int i;
for(i=0; i<1; i++) // обработка нажатий кнопок
{
if(message.lparam == button0[i])
{
if(flag_button0[i])flag_button0[i] = 0;
else flag_button0[i] = 1;
return;
}
}
for(i=0; i<6; i++) // обработка нажатий галок переключателей
{
if(message.lparam == autocheck0[i])
{
flag_autocheck0 = i;
return;
}
}
for(i=0; i<1; i++) // обработка нажатий на список combobox
{
if(message.lparam == combobox0[i])
{
flag_combobox0[i] = sendmessage(CB_GETCURSEL, 0, 0, formatiw(combobox0[i]));
return;
}
}
}
function getmessage(0, WM_CLOSE)
{
save_config_0(); // вызов функции, котороая сохранит настройки в ini файл
DeleteObject(h_font);
goto global end_0; // переход в метке
// close(); // закрыть кибор
}
function save_config_0() // функция для сохранения настроек
{
int i, rect_window[4];
DeleteFile(path_settings_0);
GetWindowRect(gethwnd(0), address(#rect_window[0]));
WritePrivateProfileString("DialogPosition", "dialogPosX", format(rect_window[0]), path_settings_0);
WritePrivateProfileString("DialogPosition", "dialogPosY", format(rect_window[1]), path_settings_0);
for (i=0; i<sizearray(combobox0); i++)WritePrivateProfileString("Combobox", "combobox0_" + format(i), format(flag_combobox0[i]), path_settings_0);
WritePrivateProfileString("AutoCheck", "autocheck0", format(flag_autocheck0), path_settings_0);
}
function load_config_0() // функция для загрузки настроек
{
int i;
char text[999];
if(fopen(path_settings_0, "r"))fclose();
else return;
if(GetPrivateProfileString("DialogPosition", "dialogPosX", 0, address (#text[0]), sizearray(text), path_settings_0))dialogPosX_0 = formatsn(format(#text[0]));
if(GetPrivateProfileString("DialogPosition", "dialogPosY", 0, address (#text[0]), sizearray(text), path_settings_0))dialogPosY_0 = formatsn(format(#text[0]));
for (i=0; i<sizearray(combobox0); i++)
{
if(GetPrivateProfileString("Combobox", "combobox0_" + format(i), 0, address (#text[0]), sizearray(text), path_settings_0))flag_combobox0[i] = formatsn(format(#text[0]));
}
if(GetPrivateProfileString("AutoCheck", "autocheck0" , 0, address (#text[0]), sizearray(text), path_settings_0))
flag_autocheck0 = formatsn(format(#text[0]));
}
#define WS_CHILD 0x40000000
#define WS_BORDER 0x00800000
#define BS_MULTILINE 0x00002000
#define BS_AUTOCHECKBOX 0x00000003
#define BS_AUTORADIOBUTTON 0x00000009
#define BM_SETCHECK 0x00F1
#define BST_UNCHECKED 0x0000
#define BST_CHECKED 0x0001
#define CBS_DROPDOWNLIST 0x0003
#define CB_ADDSTRING 0x0143
#define CB_GETCURSEL 0x0147
#define CB_SETCURSEL 0x014E
#define TRUE 1
#define WM_SETFONT 0x0030
#define RUSSIAN_CHARSET 204
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll");
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll");
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll");
external(INT, "GetWindowRect", "GetWindowRect", "User32.dll");
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll");
external(INT, "DeleteFile", "DeleteFileA", "kernel32.dll");
external(INT, "GetPrivateProfileString", "GetPrivateProfileStringA", "kernel32.dll");
external(INT, "WritePrivateProfileString", "WritePrivateProfileStringA", "kernel32.dll");
int h_font;
string rn = formatic(13)+formatic(10);
int dialogPosX_0 = 651, dialogPosY_0 = 287;
string path_settings_0 = tempfolder() + "config_file_0.ini";
int button0[1];
int flag_button0[1] = { 0 };
int autocheck0[6], flag_autocheck0 = 0;
int combobox0[1];
int flag_combobox0[1] = { 0 };
string text_combobox0[1][1];
int count_rows_combobox0[1] = { 0 };
createdialog(0);
showdialog(0, "Диалог0", dialogPosX_0, dialogPosY_0, 311, 147, 4, 1);
loop()
{
// тут нужный код
sleep(10);
}
end_0:;
function getmessage(0, WM_CREATE)
{
int i;
int j;
char c_text_combobox[999];
load_config_0(); // функция для загрузки настроек
h_font = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, RUSSIAN_CHARSET, 0, 0, 0, 0, "Arial");
button0[0] = CreateWindow(0, "BUTTON", "Run", WS_VISIBLE | WS_CHILD, 8, 88, 288, 20, gethwnd(0), 0, 0, 0);
autocheck0[0] = CreateWindow(0, "BUTTON", "Блокнот 1", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 8, 40, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[1] = CreateWindow(0, "BUTTON", "Блокнот 2", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 8, 64, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[2] = CreateWindow(0, "BUTTON", "Блокнот 3", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 112, 40, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[3] = CreateWindow(0, "BUTTON", "Блокнот 4", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 112, 64, 100, 20, gethwnd(0), 0, 0, 0);
autocheck0[4] = CreateWindow(0, "BUTTON", "Блокнот 5", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 216, 40, 80, 20, gethwnd(0), 0, 0, 0);
autocheck0[5] = CreateWindow(0, "BUTTON", "Блокнот 6", BS_AUTORADIOBUTTON | WS_VISIBLE | WS_CHILD, 216, 64, 80, 20, gethwnd(0), 0, 0, 0);
combobox0[0] = CreateWindow(0, "COMBOBOX", "", WS_VISIBLE | WS_CHILD | WS_BORDER | CBS_DROPDOWNLIST, 8, 8, 288, 23, gethwnd(0), 0, 0, 0);
if(flag_autocheck0 > -1)sendmessage(BM_SETCHECK, BST_CHECKED, 0, formatiw(autocheck0[flag_autocheck0]));
for(i=0; i<1; i++)
{
for(j=0; j<count_rows_combobox0[i]; j++)
{
strcpy(#c_text_combobox[0], text_combobox0[i][j]);
sendmessage(CB_ADDSTRING, 0, address(#c_text_combobox[0]), formatiw(combobox0[i]));
}
}
for(i=0; i<1; i++)sendmessage(CB_SETCURSEL, flag_combobox0[i], 0, formatiw(combobox0[i]));
for(i=0; i<1; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(button0[i]));
for(i=0; i<6; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(autocheck0[i]));
for(i=0; i<1; i++)sendmessage(WM_SETFONT, h_font, TRUE, formatiw(combobox0[i]));
}
function getmessage(0, WM_COMMAND)
{
int i;
for(i=0; i<1; i++) // обработка нажатий кнопок
{
if(message.lparam == button0[i])
{
if(flag_button0[i])flag_button0[i] = 0;
else flag_button0[i] = 1;
return;
}
}
for(i=0; i<6; i++) // обработка нажатий галок переключателей
{
if(message.lparam == autocheck0[i])
{
flag_autocheck0 = i;
return;
}
}
for(i=0; i<1; i++) // обработка нажатий на список combobox
{
if(message.lparam == combobox0[i])
{
flag_combobox0[i] = sendmessage(CB_GETCURSEL, 0, 0, formatiw(combobox0[i]));
return;
}
}
}
function getmessage(0, WM_CLOSE)
{
save_config_0(); // вызов функции, котороая сохранит настройки в ini файл
DeleteObject(h_font);
goto global end_0; // переход в метке
// close(); // закрыть кибор
}
function save_config_0() // функция для сохранения настроек
{
int i, rect_window[4];
DeleteFile(path_settings_0);
GetWindowRect(gethwnd(0), address(#rect_window[0]));
WritePrivateProfileString("DialogPosition", "dialogPosX", format(rect_window[0]), path_settings_0);
WritePrivateProfileString("DialogPosition", "dialogPosY", format(rect_window[1]), path_settings_0);
for (i=0; i<sizearray(combobox0); i++)WritePrivateProfileString("Combobox", "combobox0_" + format(i), format(flag_combobox0[i]), path_settings_0);
WritePrivateProfileString("AutoCheck", "autocheck0", format(flag_autocheck0), path_settings_0);
}
function load_config_0() // функция для загрузки настроек
{
int i;
char text[999];
if(fopen(path_settings_0, "r"))fclose();
else return;
if(GetPrivateProfileString("DialogPosition", "dialogPosX", 0, address (#text[0]), sizearray(text), path_settings_0))dialogPosX_0 = formatsn(format(#text[0]));
if(GetPrivateProfileString("DialogPosition", "dialogPosY", 0, address (#text[0]), sizearray(text), path_settings_0))dialogPosY_0 = formatsn(format(#text[0]));
for (i=0; i<sizearray(combobox0); i++)
{
if(GetPrivateProfileString("Combobox", "combobox0_" + format(i), 0, address (#text[0]), sizearray(text), path_settings_0))flag_combobox0[i] = formatsn(format(#text[0]));
}
if(GetPrivateProfileString("AutoCheck", "autocheck0" , 0, address (#text[0]), sizearray(text), path_settings_0))
flag_autocheck0 = formatsn(format(#text[0]));
}