код (Отобразить)#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" );
external (INT, "GetPrivateProfileString", "GetPrivateProfileStringA", "kernel32.dll");
external (INT, "WritePrivateProfileString", "WritePrivateProfileStringA", "kernel32.dll");
char str[255];
string path=pathfolder()+"setting.ini"; // ïóòü ê ôàéëó íàñòðîåê
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);
}
if(fopen(path, "r")!=0) // åñëè ôàéë ñ íàñòðîéêàìè îòêðûëñÿ, ò. å. ñóùåñòâóåò
{
fclose();
GetPrivateProfileString ("Default", "Edit0", 0, address (#str[0]), 255, path); //pos[0]
pos[0]=format (#str[0]);
GetPrivateProfileString ("Default", "Edit1", 0, address (#str[0]), 255, path); //pos[1]
pos[1]=format (#str[0]);
GetPrivateProfileString ("Default", "Edit2", 0, address (#str[0]), 255, path); //pos[2]
pos[2]=format (#str[0]);
}
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åêñò
}
function getmessage(0, WM_CLOSE)
{
WritePrivateProfileString ("Default", "Edit0", pos[0], path); // çàïèñûâàåì çíà÷åíèå
WritePrivateProfileString ("Default", "Edit1", pos[1], path);
WritePrivateProfileString ("Default", "Edit2", pos[2], path);
}