Rapid-Q by William Yu (c)1999-2000 .

Upload il tuo script su Rapidq.it

Seleziona il colore

'Tool to get the color number by choosing a color.



$TYPECHECK ON

CONST CC_RGBINIT = &H1

CONST CC_FULLOPEN = &H2

CONST CC_PREVENTFULLOPEN = &H4

CONST CC_SHOWHELP = &H8

CONST CC_ENABLEHOOK = &H10

CONST CC_ENABLETEMPLATE = &H20

CONST CC_ENABLETEMPLATEHANDLE = &H40

CONST CC_SOLIDCOLOR = &H80

CONST CC_ANYCOLOR = &H100



TYPE TCHOOSECOLOR

                lStructSize AS LONG

                hWndOwner AS LONG

                hInstance AS LONG

                rgbResult AS LONG

                CustColors(1 TO 16) AS LONG

                Flags AS DWORD

                lCustData AS LONG

                lpfnHook AS LONG

                lpTemplateName AS LONG

END TYPE



DECLARE FUNCTION ChooseColorDlg LIB "COMDLG32" ALIAS "ChooseColorA" _

                 (CC AS TCHOOSECOLOR) AS LONG

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"_

                (hwnd As Long, nIndex As Long, dwNewLong As Long) As Long



Const GWL_HWNDPARENT = -8

Const HWND_DESKTOP = 0



DECLARE SUB ButtonClick (Sender AS QBUTTON)

DIM CC AS TCHOOSECOLOR

    CC.CustColors(1) = &HFF0000

    CC.CustColors(2) = &H00FF00

    CC.CustColors(3) = &H0000FF

    CC.CustColors(4) = &HFF00FF

    CC.CustColors(5) = &H00FFFF

    CC.CustColors(6) = &HFFFFFF

    CC.CustColors(7) = &H559911

    CC.CustColors(8) = &HEE44BB

    CC.CustColors(9) = &HBB44EE

    CC.CustColors(10) = &H115599

    CC.CustColors(11) = &H333333

    CC.CustColors(12) = &H666666

    CC.CustColors(13) = &H999999

    CC.CustColors(14) = &HABABAB

    CC.CustColors(15) = &HDDDDDD

    CC.CustColors(16) = &H550000



CREATE Form AS QFORM

                caption="Choose color"

                create ed as qrichedit

                               height=20

                end create

                CREATE Button AS QBUTTON

                               Width = 80

                               Caption = "Choose color"

                               OnClick = ButtonClick

                               left=ed.width

                               height=20

                END CREATE

                Center

                width=button.width+ed.width+10

                height=50

END CREATE

setwindowlong(form.handle, GWL_HWNDPARENT, HWND_DESKTOP)

setwindowlong(application.handle, GWL_HWNDPARENT, form.handle)



form.showmodal



SUB ButtonClick (Sender AS BUTTON)

                DIM ReturnVal AS LONG

                CC.lStructSize = SIZEOF(CC)

                CC.hWndOwner = Form.Handle

                CC.Flags = CC_RGBINIT +CC_FULLOPEN

                CC.rgbResult = Form.Color

                ReturnVal = ChooseColorDlg(CC)

                IF ReturnVal <> 0 THEN ed.text="Color=&h"+right$(hex$(cc.rgbresult),6)

                ed.selstart=0

                ed.sellength=len(ed.text)

                ed.copytoclipboard

END SUB




2003 Holyguard.net - 2007 Abruzzoweb