8,窗口類注冊(cè):
atom registerclass(
const wndclass *lpwndclass // address of structure with class
// data
);
9,創(chuàng)建窗口:
hwnd createwindow(
lpctstr lpclassname, // pointer to registered class name
lpctstr lpwindowname, // pointer to window name
dword dwstyle, // window style
int x, // horizontal position of window
int y, // vertical position of window
int nwidth, // window width
int nheight, // window height
hwnd hwndparent, // handle to parent or owner window
hmenu hmenu, // handle to menu or child-window identifier
handle hinstance, // handle to application instance
lpvoid lpparam // pointer to window-creation data
);
10,顯示和更新窗口窗口:
bool showwindow(
hwnd hwnd, // handle to window
int ncmdshow // show state of window
);
bool updatewindow(
hwnd hwnd // handle of window
);
11,消息循環(huán):
msg msg;
while(getmessage(&msg,...)) //從消息隊(duì)列中取出一條消息
{
translatemessage(&msg); //進(jìn)行消息(如鍵盤消息)轉(zhuǎn)換
dispatchmessage(&msg); //分派消息到窗口的回調(diào)函數(shù)處理,(os調(diào)用窗口回調(diào)函數(shù)進(jìn)行處理)。
}
其中:
//**the getmessage function retrieves a message from the calling thread's message queue and places it in the specified structure.
//**if the function retrieves a message other than wm_quit, the return value is nonzero.if the function retrieves the wm_quit message, the return value is zero. if there is an error, the return value is -1.
bool getmessage(
lpmsg lpmsg, // address of structure with message
hwnd hwnd, // handle of window
uint wmsgfiltermin, // first message
uint wmsgfiltermax // last message
);
//the translatemessage function translates virtual-key messages into character messages. the character messages are posted to the calling thread's message queue, to be read the next time the thread calls the getmessage or peekmessage function.
bool translatemessage(
const msg *lpmsg // address of structure with message
);
//the dispatchmessage function dispatches a message to a window procedure.
long dispatchmessage(
const msg *lpmsg // pointer to structure with message
);
希望與更多計(jì)算機(jī)等級(jí)考試的網(wǎng)友交流,請(qǐng)進(jìn)入計(jì)算機(jī)等級(jí)考試論壇
更多信息請(qǐng)?jiān)L問(wèn):考試吧計(jì)算機(jī)等級(jí)考試欄目
北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |