$IFNDEF TRUE
$DEFINE True 1
$ENDIF
$IFNDEF FALSE
$DEFINE False 0
$ENDIF
$IFNDEF boolean
$DEFINE boolean INTEGER
$ENDIF
CONST PG_CHILD=&H40000000
CONST PG_VISIBLE=&H10000000
CONST PG_USER=&H400
CONST PBM_SETRANGE=PG_USER + 1
CONST PBM_SETPOS=PG_USER + 2
CONST PBM_SETSTEP=PG_USER + 4
DECLARE FUNCTION CreateBar LIB "USER32" ALIAS "CreateWindowExA" (ExStyle&,ClassName$,WindowName$,Style&,X&,Y&,Width&,Height&,WndParent&,hMenu&,hInstance&,Param&) AS LONG
DECLARE FUNCTION MoveBar LIB "user32" ALIAS "MoveWindow" (hwnd AS LONG,x AS INTEGER,y AS INTEGER,nWidth AS INTEGER,nHeight AS INTEGER,bRepaint AS LONG) AS LONG
DECLARE FUNCTION ShowBar LIB "user32" ALIAS "ShowWindow" (hwnd AS LONG,nCmdShow AS LONG) AS LONG
TYPE QProgress EXTENDS QOBJECT
PRIVATE:
Range AS LONG
Increment AS LONG
resolution AS INTEGER
PUBLIC:
PARENT AS INTEGER PROPERTY SET SetParent
value AS LONG PROPERTY SET SetValue
left AS SHORT PROPERTY SET SetLeft
Top AS SHORT PROPERTY SET SetTop
Width AS SHORT PROPERTY SET SetWidth
Height AS SHORT PROPERTY SET SetHeight
Visible AS boolean PROPERTY SET SetVisible
Handle AS INTEGER
PROPERTY SET SetVisible(visible AS boolean)
QProgress.visible=visible
IF visible=0 THEN
ShowBar(QProgress.Handle,0)
ELSE
ShowBar(QProgress.Handle,5)
END IF
END PROPERTY
PROPERTY SET SetLeft(left AS SHORT)
QProgress.Left=left
MoveBar(QProgress.Handle,QProgress.Left,QProgress.Top,QProgress.Width,QProgress.Height,true)
END PROPERTY
PROPERTY SET SetTop(top AS SHORT)
QProgress.Top=top
MoveBar(QProgress.Handle,QProgress.Left,QProgress.Top,QProgress.Width,QProgress.Height,true)
END PROPERTY
PROPERTY SET SetWidth(width AS SHORT)
QProgress.Width=width
MoveBar(QProgress.Handle,QProgress.Left,QProgress.Top,QProgress.Width,QProgress.Height,true)
END PROPERTY
PROPERTY SET SetHeight(height AS SHORT)
QProgress.Height=height
MoveBar(QProgress.Handle,QProgress.Left,QProgress.Top,QProgress.Width,QProgress.Height,true)
END PROPERTY
PROPERTY SET SetParent(PARENT AS INTEGER)
QProgress.PARENT = PARENT
QProgress.Handle = CreateBar(0,"msctls_progress32","",PG_CHILD OR PG_VISIBLE,QProgress.left,QProgress.top,QProgress.width,QProgress.height,QProgress.PARENT,0,0,0)
QProgress.visible=1
QProgress.Range = &H5014
SendMessage(QProgress.Handle, PBM_SETRANGE, 0, QProgress.Range * &H10000)
QProgress.Increment = QProgress.Range/100
SendMessage(QProgress.Handle, PBM_SETSTEP, QProgress.Increment, 0)
QProgress.resolution=QProgress.Range/100
END PROPERTY
PROPERTY SET SetValue(value AS LONG)
QProgress.value =value*QProgress.resolution
SendMessage(QProgress.Handle,PBM_SETPOS,QProgress.value,0)
END PROPERTY
CONSTRUCTOR
Left=0
Top=0
Width=100
Height=20
END CONSTRUCTOR
END TYPE
|
|