Win32 only creates a dialog box Program (interesting)

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.