Since the original poster didn't respond to your message, I'll take a shot at it. I just imported the code in a VC6 project so I'll give directions for that compiler.
Download and unzip the source code using the link at top of this page.
Open your project. From the menu select Project >> Add to Project... >> Files, and select the files SelColorDlg.cpp and SelColorDlg.h that you just unzipped.
Open the file ColorSel.rc and copy the following 'dialog'-code from that file --unless you're using a newer version than I have, you can also copy it from below.
IDD_COLSEL DIALOG DISCARDABLE 0, 0, 277, 183
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select Colour"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "&OK",IDOK,168,166,50,14
PUSHBUTTON "&Cancel",IDCANCEL,224,166,50,14
LTEXT "Current Colour:",IDC_STATIC,166,7,48,8
LTEXT "New Colour:",IDC_STATIC,224,7,40,8
LTEXT "Hu&e:",IDC_STATIC,171,72,16,8
EDITTEXT IDC_HUE,189,70,24,12,ES_AUTOHSCROLL
LTEXT "&Sat:",IDC_STATIC,171,90,16,8
EDITTEXT IDC_SAT,189,88,24,12,ES_AUTOHSCROLL
LTEXT "&Lum:",IDC_STATIC,171,107,16,8
EDITTEXT IDC_LUM,189,106,24,12,ES_AUTOHSCROLL
LTEXT "&Red:",IDC_STATIC,223,72,16,8
EDITTEXT IDC_RED,241,70,24,12,ES_AUTOHSCROLL
LTEXT "&Green:",IDC_STATIC,216,90,23,8
EDITTEXT IDC_GREEN,241,88,24,12,ES_AUTOHSCROLL
LTEXT "&Blue:",IDC_STATIC,222,107,17,8
EDITTEXT IDC_BLUE,241,106,24,12,ES_AUTOHSCROLL
LTEXT "Ref:",IDC_STATIC,167,46,15,8
EDITTEXT IDC_REF,184,44,86,12,ES_AUTOHSCROLL
PUSHBUTTON "<< &Add Custom Colour",ID_ADDCOLOUR,174,136,89,14
END
Next, open the .rc-file from your own project. Look up the section that begins with the following remark:
Paste the 'dialog'-code right below this remark. Next, open the file Resource.h from the zip-file and copy the following code from it --again, you can also copy the code below.
#define ID_ADDCOLOUR 3
#define IDD_COLSEL 129
#define IDC_DRAGITEM 130
#define IDC_HUE 1001
#define IDC_SAT 1002
#define IDC_LUM 1003
#define IDC_RED 1004
#define IDC_GREEN 1005
#define IDC_BLUE 1006
#define IDC_REF 1007
Now open the resource.h file from your own project and copy the above #defines into it. Change the values from these defines so that they are unique; in other words, no value should be the same as any of the values that you already had in your own resource.h file.
And finally, at the bottom of your resource.h file you may find the following lines:
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32773
#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Important: Change the values to reflect the changes you've made in the previous step, so that your IDE knows which constant values it can use for any new resources, commands or controls.
HTH,
StrayJay.
|