亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

win32備忘

發布時間:2020-06-28 16:47:35 來源:網絡 閱讀:372 作者:hello_world007 欄目:編程語言

#include <Windows.h>

#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();//創建菜單

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"我的應用程序",//窗口標題文字

WS_OVERLAPPEDWINDOW,//窗口外觀樣式

38,//窗口相對于父級的x坐標

20,//窗口相對于父級的y坐標

800,//窗口的寬度

600,//窗口的高度

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

hRoot,//沒有菜單,為NULL

hInstance,//當前應用程序的實例句柄

NULL//沒有附加數據,為NULL

);

if (hwnd == NULL){

return 0;

}


//ShowWindow的第一個參數就是剛才創建的窗口的句柄,第二個參數控制窗口如何顯示

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

);


//默認帶邊框

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

);

//擴展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));//設置文本顏色

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


//用于設置每個字符間隔的數組

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);

//填充圖形

//創建畫刷

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

//畫刷選擇到當前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"飛機");


MENUITEMINFO mif;

mif.cbSize = sizeof(MENUITEMINFO);

mif.cch = 100;

mif.dwItemData = NULL;

mif.dwTypeData = L"機關槍";

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);

}


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

分宜县| 柳江县| 杨浦区| 安福县| 桑植县| 栾川县| 肇源县| 沙田区| 三台县| 健康| 临高县| 察雅县| 滨海县| 新和县| 长岛县| 乌苏市| 望奎县| 永新县| 孝感市| 城口县| 特克斯县| 临汾市| 抚宁县| 普陀区| 抚顺市| 通州市| 平定县| 饶阳县| 渭南市| 唐河县| 浮梁县| 彩票| 林周县| 封丘县| 佳木斯市| 手机| 连城县| 和田县| 绥棱县| 垫江县| 体育|