Код (Отобразить)
CODE:
#define WS_CHILD 1073741824
#define WS_VISIBLE 268435456
#define BS_AUTOCHECKBOX 3
#define WS_BORDER 8388608
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
external(INT, "GetDC", "GetDC", "User32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll" );
external(INT, "GetFocus", "GetFocus", "User32.dll" );
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll" );
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
int b;
int Checkboxes[4];
int k[4];
int h[4];
int m[4];
int ssilka;
int hdc1, hdc2, font1;
char c1[99], c2[99], temp[99];
strcpy(#c1[0], "Логин");
createdialog(0);
showdialog(0, "Диалог", 100, 100, 180, 200, 1, 1);
loop()sleep(100);
function getmessage(0, WM_CREATE)
{
int Step = 0;
for (int i=0; i<sizearray(Checkboxes); i++)
{
Checkboxes[i] = CreateWindow(0, "BUTTON", "", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, 130, 32+Step, 80, 20, gethwnd(0), 0, 0, 0);
Step = Step+21;
k[i] = CreateWindow(0, "EDIT", "3", 8192+8388608+1342177280, 70, 10+Step, 30, 20, gethwnd(0), 0, 0, 0);
h[i] = CreateWindow(0, "EDIT", format(i), 8192+8388608+1342177280, 10, 10+Step, 25, 20, gethwnd(0), 0, 0, 0);
m[i] = CreateWindow(0, "EDIT", "2", 8192+8388608+1342177280, 40, 10+Step, 25, 20, gethwnd(0), 0, 0, 0);
}
ssilka=CreateWindow(0, "EDIT", "", WS_BORDER | WS_CHILD | WS_VISIBLE, 10, 5,150, 20, gethwnd(0), 0, 0, 0);
font1=CreateFont(18, 0, 0, 0, 300, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
hdc1=GetDC(ssilka);
b=CreateWindow(0, "BUTTON", "Считать данные", 1342177280,10, 120, 150, 40, gethwnd(0), 0, 0, 0);
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam == ssilka){update(formatiw(ssilka)); return; }
if (message.lparam==b)
{
messagebox (format(ssilka)); messagebox (format(k[0])); messagebox (format(h[0])); messagebox (format(k[0]));
}
for (int i1=0; i1<sizearray(Checkboxes); i1++)
{
if (message.lparam==Checkboxes[i1])messagebox (format(Checkboxes[i1]));
}
}
function getmessage(0, WM_CTLCOLOREDIT)
{
if(GetFocus() != ssilka)
{
if(GetWindowText(ssilka, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc1, font1);
SetBkMode(hdc1, 0);
SetTextColor(hdc1, rgb(200, 200, 200)); // цвет подсказки
TextOut(hdc1, 5, 1, address(#c1[0]), size(format(#c1[0])));
}
}
}
#define WS_CHILD 1073741824
#define WS_VISIBLE 268435456
#define BS_AUTOCHECKBOX 3
#define WS_BORDER 8388608
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
external(INT, "GetDC", "GetDC", "User32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll" );
external(INT, "GetFocus", "GetFocus", "User32.dll" );
external(INT, "GetWindowText", "GetWindowTextA", "User32.dll" );
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
int b;
int Checkboxes[4];
int k[4];
int h[4];
int m[4];
int ssilka;
int hdc1, hdc2, font1;
char c1[99], c2[99], temp[99];
strcpy(#c1[0], "Логин");
createdialog(0);
showdialog(0, "Диалог", 100, 100, 180, 200, 1, 1);
loop()sleep(100);
function getmessage(0, WM_CREATE)
{
int Step = 0;
for (int i=0; i<sizearray(Checkboxes); i++)
{
Checkboxes[i] = CreateWindow(0, "BUTTON", "", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, 130, 32+Step, 80, 20, gethwnd(0), 0, 0, 0);
Step = Step+21;
k[i] = CreateWindow(0, "EDIT", "3", 8192+8388608+1342177280, 70, 10+Step, 30, 20, gethwnd(0), 0, 0, 0);
h[i] = CreateWindow(0, "EDIT", format(i), 8192+8388608+1342177280, 10, 10+Step, 25, 20, gethwnd(0), 0, 0, 0);
m[i] = CreateWindow(0, "EDIT", "2", 8192+8388608+1342177280, 40, 10+Step, 25, 20, gethwnd(0), 0, 0, 0);
}
ssilka=CreateWindow(0, "EDIT", "", WS_BORDER | WS_CHILD | WS_VISIBLE, 10, 5,150, 20, gethwnd(0), 0, 0, 0);
font1=CreateFont(18, 0, 0, 0, 300, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
hdc1=GetDC(ssilka);
b=CreateWindow(0, "BUTTON", "Считать данные", 1342177280,10, 120, 150, 40, gethwnd(0), 0, 0, 0);
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam == ssilka){update(formatiw(ssilka)); return; }
if (message.lparam==b)
{
messagebox (format(ssilka)); messagebox (format(k[0])); messagebox (format(h[0])); messagebox (format(k[0]));
}
for (int i1=0; i1<sizearray(Checkboxes); i1++)
{
if (message.lparam==Checkboxes[i1])messagebox (format(Checkboxes[i1]));
}
}
function getmessage(0, WM_CTLCOLOREDIT)
{
if(GetFocus() != ssilka)
{
if(GetWindowText(ssilka, address(#temp[0]), sizearray(temp))==0)
{
SelectObject (hdc1, font1);
SetBkMode(hdc1, 0);
SetTextColor(hdc1, rgb(200, 200, 200)); // цвет подсказки
TextOut(hdc1, 5, 1, address(#c1[0]), size(format(#c1[0])));
}
}
}
(Добавление)
Ещё интересует как сделать чек боксы изначально активированные? И как считывать поставлен чекбокс или нет?