Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Jul 20, 1998



Application Security Testing: An Integral Part of DevOps

Color Dialog (Common Dialog)

How can I use the CHOOSECOLOR WIN32 API with Powerbuilder?

Create a custom user object and declare the following local structure:

long		lstructsize
ulong		hwndowner
ulong		hinstance
long		rgbresult
blob		lpcustcolors
long		flags
long		lcustdata
long		lpfnhook
long		lptemplatename
then declare the following instance variables:
os_ChooseColor istr_ChooseColor
long il_CustomInitColors[16]
blob{64} ibl_CustomColors
Declare the following local external function:
function boolean ChooseColorA( REF os_ChooseColor  lpcc ) library "comdlg32.dll"
In the constructor event of your object add the following code:
// initialize choosecolor information

// convert the default custom color array to a blob variable

// let the structure element point to the blob array
istr_choosecolor.lpcustcolors = ibl_customcolors 

// set the size
istr_choosecolor.lStructSize = 36

// no owner 

// set flag
istr_choosecolor.flags = 1
Then finally add a function boolean of_choosecolor(ref long al_rgbresult) with the following code:
boolean lb_ok

istr_ChooseColor.rgbresult = al_rgbresult

lb_ok = ChooseColorA ( istr_choosecolor )

al_rgbresult = istr_ChooseColor.rgbresult 

return lb_ok
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date