$OPTIMIZE ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
CONST WM_COPY = &H301
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.dll" ALIAS "ChooseColorA" (pChoosecolor AS TCHOOSECOLOR) AS LONG
DECLARE SUB Select_Click
DECLARE SUB Copy_Click
DIM CC AS TCHOOSECOLOR
CREATE ClrChs AS QFORM
BorderStyle = bsSizeable
CAPTION = "Color Chooser"
DelBorderIcons biMaximize,biMinimize
Width = 200
Height = 128
Center
CREATE ColorBox AS QEDIT
Left = 5
Top = 12
Width = 180
END CREATE
CREATE cdmSelect AS QBUTTON
CAPTION = "&Select"
Left = 5
OnClick = Select_Click
Top = 47
Width = 50
ShowHint = 1
Hint = "Select Color"
TabOrder = 1
END CREATE
CREATE cmdCopy AS QBUTTON
CAPTION = "&Copy"
Hint = "Copy Color"
Left = 65
OnClick = Copy_Click
ShowHint = 1
Top = 47
Width = 50
TabOrder = 2
END CREATE
CREATE cmdExit AS QBUTTON
CAPTION = "&Exit"
Hint = "Exit"
Left = 126
ModalResult = mrCancel
ShowHint = True
Top = 47
Width = 50
TabOrder = 4
END CREATE
END CREATE
ClrChs.SHOWMODAL
SUB Select_Click
DIM ReturnVal AS LONG
CC.lStructSize = SIZEOF(CC)
CC.hWndOwner = ColorBox.Handle
ReturnVal = ChooseColorDlg(CC)
IF ReturnVal <> 0 THEN ColorBox.Text = STR$(CC.rgbResult)
ColorBox.SelStart = 0
ColorBox.SelLength = LEN(ColorBox.Text)
END SUB
SUB Copy_Click
SendMessage ColorBox.Handle, WM_COPY, 0,0
END SUB
SUB Exit_Click
ClrChs.CLOSE
END SUB
|