Board index » delphi » Commdlg.dll - ChooseColor HELP!

Commdlg.dll - ChooseColor HELP!

Hello everybody!

Im programming in BP 7.0 under W95 and tried to open the Color-Dialog from
the Commdlg.dll. I use then record TChooseColor from the commdlg-unit and
the function ChooseColor.
To my surprise I get a General Protection Fault in Module Commdlg.dll at
0006:0001e92.
Can anybody tell me how to use this dialog the right way?

Thanks

MeyerL...@poweronline.net

 

Re:Commdlg.dll - ChooseColor HELP!


Hi

First of all - check out the sample program that comes with BP (it's
in the directory examples\win31\commdlg). I simply copied that code
and modified it to fit my needs.

Before you call ChooseColor you must fill some fields of the
TChooseColor record. My code looks something like this:

var
  ChooseClr : TChooseColor;

with ChooseClr do
begin
  lstructSize := SizeOf(TChooseColor);
  hwndOwner := HWindow;
  rgbResult := MyColor;
  lpCustColors := @CustColors;
  Flags := cc_FullOpen or cc_RGBInit;
end;
if not ChooseColor(ChooseClr) then Exit;

CustColors is an array [0..15] of Longint, specifying the custom
colors. MyColor is a Longint (or TColorRef).

The code above works in both Win31 and Win95. Hope this is of some
help.

Sincerely, H?kan M?ller
--------------------------------
On 23 Sep 1997 08:19:00 GMT, "Marga2" <wfma...@xxx.xxx> wrote:

Quote
>Hello everybody!

>Im programming in BP 7.0 under W95 and tried to open the Color-Dialog from
>the Commdlg.dll. I use then record TChooseColor from the commdlg-unit and
>the function ChooseColor.
>To my surprise I get a General Protection Fault in Module Commdlg.dll at
>0006:0001e92.
>Can anybody tell me how to use this dialog the right way?

>Thanks

>MeyerL...@poweronline.net

Other Threads