#Include once "window9.bi"

Dim Shared cc As CHOOSECOLORA

Function ColorRequester Alias "ColorRequester" (ByVal rgbCurrentUSER As Integer=0,ByVal flagg As Integer=2,ByVal hwnd As HWND=0) As COLORREF Export
  Static acrCustClr(16) As COLORREF
  Static rgbCurrent As Integer
  If rgbCurrentUSER<>0 Then
    rgbCurrent=rgbCurrentUSER
  EndIf
  ZeroMemory(Cast(PVOID,@cc), Cast(DWORD,SizeOf(cc)))
  cc.lStructSize = sizeof(cc)
  cc.hwndOwner = hwnd
  cc.lpCustColors = @acrCustClr(0)
  cc.rgbResult = rgbCurrent
  cc.Flags = 1 Or flagg
  if ChooseColor(Cast(LPCHOOSECOLOR,@cc))=1 Then
    rgbCurrent=cc.rgbResult
    Return cc.rgbResult
  Else
  	Return rgbCurrentUSER
  EndIf
End Function
