How can i display the color dialog of windows API? ive tryed this:
but i dont really know how to do it...what should i change to that code to display it?Code:#include <windows.h> #include "resource.h" #include "commdlg.h" #include <string> using namespace std; HWND ghDlg = 0; RGB custColors[16]; CHOOSECOLOR color; color.lStructSize = sizeof(CHOOSECOLOR); color.hwndOwner = ghDlg; color.lpCustColors = custColors; BOOL CALLBACK ColorDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_INITDIALOG: return true; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_BUTTON: ChooseColor(color); return true; case WM_CLOSE: DestroyWindow(hDlg); return true; case WM_DESTROY: PostQuitMessage(0); return true; } return true; } return false; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR cmdLine, int showCmd) { ghDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG), 0, ColorDlgProc); ShowWindow(ghDlg, showCmd); MSG msg; ZeroMemory(&msg, sizeof(MSG)); while(GetMessage(&msg, 0, 0, 0)) { if(ghDlg == 0 || !IsDialogMessage(&msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int)msg.wParam; }
that program has a dialog with just a button that when u press it, it should display the color dialog. i dont want it to be functional, just to display it.
Thank you very much
Cherry.



LinkBack URL
About LinkBacks


