CODE:#define WS_CHILD 1073741824
#define WS_VISIBLE 268435456
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll" );
external(INT, "SetScrollRange", "SetScrollRange", "User32.dll" );
external(INT, "SetScrollPos", "SetScrollPos", "User32.dll" );
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll" );
int i;
int b1, b2, s1[3], hText[3], hwnd;
createdialog(0);
showdialog(0, "Диалог",100, 100, 240, 290, 1, 1);
int count_scroll=3; // количество скроллов
int min[3]={0, 0, 0}
int max[3]={200, 200, 200}
int pos[3]={95, 50, 133}
for(i=0; i<count_scroll; i++)
{
SetScrollRange(s1[i],2,min[i],max[i],1);
SetScrollPos(s1[i],2,pos[i],1);
}
dalnost();
loop()sleep(1);
function dalnost()
{
SetWindowText(hText[0], format(pos[0])); // Отображает текст на экране
SetWindowText(hText[1], format(pos[1])); // Отображает текст на экране
SetWindowText(hText[2], format(pos[2])); // Отображает текст на экране
}
function getmessage(0, WM_HSCROLL)
{
for(i=0; i<count_scroll; i++)
{
if (message.lparam==s1[i])
{
if (message.wparam==1 || message.wparam==3)//SB_LINERIGHT
{
pos[i]=pos[i]+10;
if (pos[i]>max[i])pos[i]=max[i];
SetScrollPos(s1[i],2,pos[i],1);
dalnost();
return;
}
if (message.wparam==0 || message.wparam==2)//SB_LINELEFT
{
pos[i]=pos[i]-10;
if (pos[i]<min[i])pos[i]=min[i];
SetScrollPos(s1[i],2,pos[i],1);
dalnost();
return;
}
///////////
if (loword(message.wparam)==5)//Зажали и двигаем
{
pos[i]=pos[i]-(pos[i]-hiword(message.wparam));
if (pos[i]>max[i])pos[i]=max[i];
if (pos[i]<min[i])pos[i]=min[i];
SetScrollPos(s1[i],2,pos[i],1);
dalnost();
}
}
}
}
function getmessage(0, WM_CREATE)//Создание кнопок
{
hwnd = gethwnd(0);
s1[0]=CreateWindow(0, "scrollbar", 0, WS_CHILD | WS_VISIBLE, 10, 50, 200, 20, hwnd, 0, 0, 0);// сам скролл
hText[0] = CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 80, 100, 15, hwnd, 0, 0, 0);//Tекст
s1[1]=CreateWindow(0, "scrollbar", 0, WS_CHILD | WS_VISIBLE, 10, 120, 200, 20, hwnd, 0, 0, 0);// сам скролл
hText[1] = CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 30, 150, 100, 15, hwnd, 0, 0, 0);//Tекст
s1[2]=CreateWindow(0, "scrollbar", 0, WS_CHILD | WS_VISIBLE, 10, 200, 200, 20, hwnd, 0, 0, 0);// сам скролл
hText[2] = CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 30, 220, 100, 15, hwnd, 0, 0, 0);//Tекст
}