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.

Dark GDK / Color Dialog

Author
Message
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 7th Sep 2008 23:51 Edited at: 7th Sep 2008 23:53
Hi,
Can anyone please help me to get a colour dialogue to open and return the RGB back into integers.

So far I worked out you need to include windows.h and call the
ChooseColor function. Here it says information about the command:
http://msdn.microsoft.com/en-us/library/ms646912(VS.85).aspx

But I haven't had any luck in opening it yet. Any help would be appreciated,
Thanks,
Alex

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 8th Sep 2008 04:12
Is it not compiling? Just not showing up when you call the function? Can you post the relevant section of code?

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 8th Sep 2008 11:28
It does compile and it just doesn't show



Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 8th Sep 2008 12:01
You haven't allocated a CHOOSECOLOR structure and set its data. You've just given it an uninitialized pointer (LP signifies that the type is a pointer).

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 8th Sep 2008 16:49
How would I use this? I just need to open the colour dialogue and get the RGB back as integers

I tried some stuff nothing worked.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 8th Sep 2008 17:11
This is what i tried:



But i get an error whilst compiling:


AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 8th Sep 2008 17:27
Ok i figured it out


Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 8th Sep 2008 17:28
Try changing this

ChooseColor(CHOOSECOLORDLG);

to this

ChooseColor(&CHOOSECOLORDLG);

You have to pass the address of the structure to the function. When the function exits you need to look in the CHOOSECOLORDLG structure to find the returned results. This is a means of returning more than one value. You create structure with (potentially) lots of different parameters in it and pass it to the function by providing the function with the address. The function then has indirect access to the parameters it needs to read and the variables it needs to provide you when the function returns.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-09-30 05:24:28
Your offset time is: 2024-09-30 05:24:28