Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Why can't I set the custom color palette for chooseColor with an Array..

Author
Message
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 24th Feb 2010 20:41 Edited at: 24th Feb 2010 20:42
I'm trying to call the chooseColor function from the comdlg32.dll; and altho I have succeeded in being able to define the initial color, I haven't been able to set up the lpCustColors array to work properly.


MSDN describes lpCustColors as..
Quote: "
Pointer to an array of 16 values that contain red, green, blue (RGB) values for the custom color boxes in the dialog box. If the user modifies these colors, the system updates the array with the new RGB values. To preserve new custom colors between calls to the ChooseColor function, you should allocate static memory for the array. To create a COLORREF color value, use the RGB macro.
"


I'm using IanM's arrayPtr commands to get the pointer for the array.

I create an array(15), set all the values to 0x00ffffff (So all 16 squares of the custom colors bit should be white. But they end up with 2 pink ones and a load of murky colors)

Here is my code, can someone plz tell me where I'm going wrong with this.



Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 24th Feb 2010 20:46
Instead of using 'get arrayptr(array())', you should use 'get array item ptr(array(),0)'

=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 24th Feb 2010 21:03
@Diggsey:

Thank you sooooo much, lol; I've been agonising over this for hours.

Works like a charm now

Login to post a reply

Server time is: 2026-07-28 02:31:06
Your offset time is: 2026-07-28 02:31:06