成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

win32備忘-創(chuàng)新互聯(lián)

#include <Windows.h>

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了王益免費(fèi)建站歡迎大家使用!

#include <stdlib.h>

#define IDM_OPT1 301

#define IDM_OPT2 302

#define IDM_BTN1 303

#define IDM_EDT1 304

#define IDM_EDT2 305

#define IDM_EDT3 306

LRESULT CALLBACK WindowProc(

_In_ HWND hwnd,

_In_ UINT uMsg,

_In_ WPARAM wParam,

_In_ LPARAM lParam

);

HMENU hRoot;

HWND hwndButton;

HWND hwnText;

HWND hwnText1;

HWND hwnText2;

void CreateMyMenu();//創(chuàng)建菜單

int CALLBACK WinMain(

_In_ HINSTANCE hInstance,

_In_ HINSTANCE hPrevInstance,

_In_ LPSTR lpCmdLine,

_In_ int nCmdShow

){

CreateMyMenu();

WCHAR* cls_Name = L"My Class";

WNDCLASS wc = {sizeof(WNDCLASS)};

wc.hbrBackground = (HBRUSH)(COLOR_WINDOW +1);

wc.lpfnWndProc = WindowProc;

wc.lpszClassName = cls_Name;

wc.hInstance = hInstance;

wc.style = CS_HREDRAW | CS_VREDRAW;

RegisterClass(&wc);

HWND hwnd = CreateWindow(

cls_Name,//類名

L"我的應(yīng)用程序",//窗口標(biāo)題文字

WS_OVERLAPPEDWINDOW,//窗口外觀樣式

38,//窗口相對(duì)于父級(jí)的x坐標(biāo)

20,//窗口相對(duì)于父級(jí)的y坐標(biāo)

800,//窗口的寬度

600,//窗口的高度

NULL,//沒有父窗口,為NULL

hRoot,//沒有菜單,為NULL

hInstance,//當(dāng)前應(yīng)用程序的實(shí)例句柄

NULL//沒有附加數(shù)據(jù),為NULL

);

if (hwnd == NULL){

return 0;

}

//ShowWindow的第一個(gè)參數(shù)就是剛才創(chuàng)建的窗口的句柄,第二個(gè)參數(shù)控制窗口如何顯示

ShowWindow(hwnd, SW_SHOW);

UpdateWindow(hwnd);

MSG msg;

while (GetMessage(&msg, NULL, 0, 0)){

TranslateMessage(&msg);

DispatchMessage(&msg);

}

return 0;

}

LRESULT CALLBACK WindowProc(

_In_ HWND hwnd,

_In_ UINT uMsg,

_In_ WPARAM wParam,

_In_ LPARAM lParam

){

switch (uMsg)

{

case WM_CREATE:{

hwndButton = CreateWindow(

TEXT("button"),

TEXT("anniu"),

WS_CHILD | WS_VISIBLE,

100,80,80,40,

hwnd, (HMENU)IDM_BTN1,

((LPCREATESTRUCT)lParam)->hInstance,NULL

);

//默認(rèn)帶邊框

hwnText = CreateWindow(

TEXT("EDIT"),

TEXT("hello"),

WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL,

250,50,120,40,hwnd,

(HMENU)IDM_EDT1,

((LPCREATESTRUCT)lParam)->hInstance, NULL

);

//擴(kuò)展3D樣式

hwnText1 = CreateWindowEx(WS_EX_CLIENTEDGE,

TEXT("EDIT"),

TEXT("hello"),

WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ES_PASSWORD,

250,100,120,40,hwnd,

(HMENU)IDM_EDT2, ((LPCREATESTRUCT)lParam)->hInstance, NULL);

hwnText2 = CreateWindowEx(

WS_EX_CLIENTEDGE, TEXT("EDIT"), TEXT("hello"),

WS_VSCROLL|WS_VISIBLE|WS_CHILD|ES_AUTOVSCROLL|ES_MULTILINE

, 250, 150, 120, 100, hwnd, (HMENU)IDM_EDT3, ((LPCREATESTRUCT)lParam)->hInstance, NULL);

MoveWindow(hwnText2,250,200,120,200,TRUE);

}

return 0;

case WM_DESTROY:{

PostQuitMessage(0);

return 0;

}

case WM_COMMAND:{

switch (LOWORD(wParam))

{

case IDM_OPT1:

MessageBox(hwnd, L"feiji", L"tips", MB_OK);

break;

case IDM_OPT2:

MessageBox(hwnd, L"paodan", L"tips", MB_OK);

break;

case IDM_BTN1:

wchar_t *szName;

int iLength;

iLength = GetWindowTextLength(hwnText);

szName = (wchar_t*)malloc(iLength + 6);

wcscat_s(szName,iLength+ 6, L"--New");

SetWindowText(hwnText, szName);

MessageBox(hwnd, L"this is a btn", L"tips", MB_OK);

break;

default:

break;

}

}

return 0;

case WM_PAINT:{

PAINTSTRUCT ps;

BeginPaint(hwnd, &ps);

SetTextColor(ps.hdc, RGB(10, 0, 255));//設(shè)置文本顏色

DrawText(ps.hdc, L"朋友,你好", -1, &(ps.rcPaint), DT_CENTER);

//用于設(shè)置每個(gè)字符間隔的數(shù)組

int arr1[2] = { 45, 0 };

int arr2[3] = { 35, 40, 0 };

int arr3[2] = { 32, 0 };

POLYTEXT polys[] = {

{ 2, 2, 3, L"大家", ETO_CLIPPED, ps.rcPaint, &arr1[0] },

{ 2, 25, 3, L"新年好", ETO_CLIPPED, ps.rcPaint, &arr2[0] },

{ 30, 60, 3, L"快樂\0", ETO_CLIPPED, ps.rcPaint, &arr3[0] }

};

PolyTextOut(ps.hdc, &polys[0], 3);

//填充圖形

//創(chuàng)建畫刷

HBRUSH hb = CreateSolidBrush(RGB(0,255,0));

//畫刷選擇到當(dāng)前DC中

HBRUSH orgBrs = (HBRUSH)SelectObject(ps.hdc, hb);

//填充圖形

Ellipse(ps.hdc, 135, 35, 202, 170);

//選回原先的畫刷

SelectObject(ps.hdc, orgBrs);

DeleteObject(hb);

EndPaint(hwnd, &ps);

}

break;

default:

break;

}

return DefWindowProc(hwnd, uMsg, wParam, lParam);

}

void CreateMyMenu(){

hRoot = CreateMenu();

if (!hRoot)

return;

HMENU pop1 = CreatePopupMenu();

AppendMenu(hRoot,

MF_POPUP,

(UINT_PTR)pop1,

L"操作");

AppendMenu(pop1,

MF_STRING,

IDM_OPT1,

L"飛機(jī)");

MENUITEMINFO mif;

mif.cbSize = sizeof(MENUITEMINFO);

mif.cch = 100;

mif.dwItemData = NULL;

mif.dwTypeData = L"機(jī)關(guān)槍";

mif.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE;

mif.fState = MFS_ENABLED;

mif.fType = MIIM_STRING;

mif.wID = IDM_OPT2;

InsertMenuItem(pop1, IDM_OPT2, FALSE, &mif);

}

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前標(biāo)題:win32備忘-創(chuàng)新互聯(lián)
網(wǎng)頁URL:http://jinyejixie.com/article10/depido.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、手機(jī)網(wǎng)站建設(shè)網(wǎng)站導(dǎo)航、App開發(fā)、網(wǎng)站營銷、標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
安泽县| 武威市| 辽宁省| 莱阳市| 富民县| 柘城县| 扬州市| 临泽县| 始兴县| 洪泽县| 巴林左旗| 内丘县| 达州市| 东乡县| 安泽县| 广南县| 丰原市| 伊川县| 得荣县| 富阳市| 潜江市| 镇康县| 元朗区| 莆田市| 焦作市| 光山县| 邵阳县| 永泰县| 芜湖市| 营口市| 龙井市| 寿宁县| 常州市| 南康市| 惠安县| 马边| 都安| 望谟县| 从江县| 祁门县| 广宗县|