在win32 視窗 繪製紅色直線

2021-08-15 12:13:46 字數 1346 閱讀 7058

在win32 視窗 繪製紅色直線

測試環境: win7 64 位 vs2013

建立乙個 win32 應用程式 ,空專案,名稱是 hellopaintredline,

在專案中新增原始檔 hellopaintredline.cpp :

內容如下:

#include 

#include

#include

#include

lresult callback wndproc(hwnd, uint, wparam, lparam);

int winapi winmain(hinstance hinstance, hinstance hprevinstance,

pstr szcmdline, int icmdshow)

text("the hello program"), // window caption

cw_usedefault, // initial x position

cw_usedefault, // initial y position

cw_usedefault, // initial x size

cw_usedefault, // initial y size

null, // parent window handle

null, // window menu handle

hinstance, // program instance handle

null); // creation parameters

showwindow(hwnd, icmdshow);

updatewindow(hwnd);

while (getmessage(&msg, null, 0, 0))

return msg.wparam;

}lresult callback wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam)

//11

default:

return defwindowproc(hwnd, message, wparam, lparam);

}return

0;}

執行效果 如下 :

win32 視窗繪製直線

在win32 視窗 繪製直線 測試環境 win7 64 位 vs2013 建立乙個 win32 應用程式 空專案,名稱是 hellopaintline,在專案中新增原始檔 hellopaintline.cpp 內容如下 include include include include lresult ...

win32 視窗 繪製紅色填充矩形

win32 視窗 繪製紅色填充矩形 測試環境 win7 64 位 vs2013 建立乙個 win32 應用程式 空專案,名稱是 hellopaintfillrect,在專案中新增原始檔 hellopaintfillrect.cpp 內容如下 include include include inclu...

win32繪製視窗

static int cxclient,cyclient 宣告兩個變數存放滑鼠 x,y 座標.在下面,我們為這兩項賦值時,loword lparam 代表取 lparam 的低 16 位,hiword lparam 代表取lparam 的高 16 位,在 lparam 中存放的實際就是滑鼠的位置,低...