I am very interested in creating only one dialog box program.
#include <windows.h>#include <commdlg.h>int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){static CHOOSECOLOR cc;static COLORREF crCustColors[16];cc.lStructSize = sizeof(CHOOSECOLOR);cc.hwndOwner = NULL;cc.hInstance = NULL;cc.rgbResult = RGB(0x80,0x80,0x80);cc.lpCustColors = crCustColors;cc.Flags = CC_RGBINIT|CC_FULLOPEN;cc.lCustData = 0;cc.lpTemplateName = NULL;cc.lpfnHook = NULL;return ::ChooseColor(&cc);}
Description of the choosecolor structure:
Typedef struct {DWORD lstructsize; // size
Hwnd hwndowner; // Main Window (parent window)
Hwnd hinstance; // instance handle
Colorref rgbresult; // If set, it is the color when it is created.
Colorref * lpcustcolors; // pointer to an array of 16 values that contain red, green, blue (RGB) values // For the custom color boxes in the dialog box. Copy madn
DWORD flags; // see msdn.
Lparam lcustdata; // no more
Lpcchookproc lpfnhook; // hook not learned yet
Lpctstr lptemplatename; // not used yet}
Choosecolor, * lpchoosecolor;