CODE:#define WS_VISIBLE 0x10000000
#define WS_CHILD 0x40000000
#define TBS_AUTOTICKS 0x0001
#define TBM_GETPOS 0x0400
#define TBM_SETPOS 0x0405
#define TBM_SETRANGE 0x0406
#define TBM_SETSEL 0x0410
#define TBM_SETPAGESIZE 0x0421
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
int trackbar;
createdialog(0);
showdialog(0, "Dialog", 300, 300, 400, 200, 1, 1);
loop()sleep(10);
function getmessage(0, WM_CREATE)
{
trackbar = CreateWindow(0, "msctls_trackbar32", "", TBS_AUTOTICKS | WS_VISIBLE | WS_CHILD, 10, 20, 310, 20, gethwnd(0), 0, 0, 0);
int Min = 0; // минимальное значение
int Max = 9; // максимальое значение
int StartPos = 3; // начальная позиция
sendmessage(TBM_SETRANGE, 1, Min+Max*65536, formatiw(trackbar));
sendmessage(TBM_SETPAGESIZE, 0, 1, formatiw(trackbar));
sendmessage(TBM_SETSEL, 0, StartPos*65536, formatiw(trackbar));
sendmessage(TBM_SETPOS, 1, StartPos, formatiw(trackbar));
}
function getmessage(0, WM_HSCROLL)
{
if(message.lparam==trackbar)
{
int Pos = sendmessage(TBM_GETPOS, 0, 0, formatiw(trackbar));
textout(0, 200, 100, format(Pos), 0);
}
} |