Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access General > Kreft/Lebans Co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 92548 of 97661
Post > Topic >>

Kreft/Lebans Color Picker problem

by Peter Hibbs <peter.hibbs@[EMAIL PROTECTED] > Aug 8, 2008 at 02:05 PM

I am trying to use the Color Picker code at :-
http://www.mvps.org/access/api/api0060.htm
to select a color (see code below).

The code works fine except that I would like the current color (which
is passed to the function in a variable called ColorValue) to be
displayed on the color picker dialog Color box. Does anyone know how
to do this.

Here is the (slightly modified) code I am using.


Option Compare Database
Option Explicit

' Original Code by Terry Kreft
' Modified by Stephen Lebans
' Contact Stephen@[EMAIL PROTECTED]
'***********  Code Start  ***********
Private Type COLORSTRUC
  lStructSize As Long
  hwnd As Long
  hInstance As Long
  rgbResult As Long
  lpCustColors As String
  Flags As Long
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type

Private Const CC_SOLIDCOLOR = &H80
Private Const CC_OPENALL = &H2

Private Declare Function ChooseColor Lib "comdlg32.dll" Alias
"ChooseColorA" _
  (pChoosecolor As COLORSTRUC) As Long

Public Function DialogColor(ColorValue As Long) As Long
  
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long

    CS.lStructSize = Len(CS)
    CS.hwnd = hWndAccessApp
    CS.Flags = CC_SOLIDCOLOR Or CC_OPENALL
    CS.lpCustColors = String$(16 * 4, 0)
    x = ChooseColor(CS)
    If x = 0 Then Exit Function
    DialogColor = CS.rgbResult
    
End Function
'***********  Code End   ***********


TIA

Peter Hibbs.
 




 3 Posts in Topic:
Kreft/Lebans Color Picker problem
Peter Hibbs <peter.hib  2008-08-08 14:05:40 
Re: Kreft/Lebans Color Picker problem
"Stephen Lebans"  2008-08-09 03:16:24 
Re: Kreft/Lebans Color Picker problem
Peter Hibbs <peter.hib  2008-08-09 09:29:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Dec 4 22:21:58 CST 2008.