漏了寫總是心裡不舒服
///////
cmainframe message handlers
獲得主選單
cmenu* pmenu = getmenu();
//獲得子選單
cmenu* psubmenu = pmenu->getsubmenu(4);
if (psubmenu->getmenuitemcount() == 4)
}void cmainframe::oninsertmenu()
}void cmainframe::onremovemenu()
}void cmainframe::ondeletemenu()
}
getsystemmenu方法
//獲得系統選單
cmenu* pmenu = getsystemmenu(false);
//刪除系統選單項
pmenu->removemenu(sc_move, mf_string);
//新增選單項
pmenu->insertmenu(0, mf_byposition, id_test_menu, _t("
測試選單項
"));
enablemenuitem方法
//獲得系統選單
cmenu* pmenu = getsystemmenu(false);
//禁用關閉按鈕
pmenu->enablemenuitem(sc_close, mf_bycommand | mf_grayed);
使用ccmdui物件
void cmainframe::ontestmenu1()void cmainframe::onupdatetestmenu1(ccmdui* pcmdui)
void cmainframe::ontestmenu2()
void cmainframe::onupdatetestmenu2(ccmdui* pcmdui)
checkmenuitem方法
checkmenuradioitem則是單選
void cmainframe::onupdatetestmenu(ccmdui* pcmdui)
trackpopupmenu方法
void cdemoview::oncontextmenu(cwnd* pwnd, cpoint point)//獲得子選單
cmenu* ppopupmenu = menu.getsubmenu(0);
//彈出選單
ppopupmenu->trackpopupmenu(tpm_leftalign | tpm_rightbutton,
point.x, point.y, pwnd);
}
m_point為mousemove時的座標
void cdemoview::ondraw(cdc* pdc)
clipcursor方法
void cdemoview::onlbuttondown(uint nflags, cpoint point)void cdemoview::onlbuttonup(uint nflags, cpoint point)
loadstandardcursor方法和setcursor方法
bool cdemoview::onsetcursor(cwnd* pwnd, uint nhittest, uint message)void cdemoview::onlbuttondown(uint nflags, cpoint point)
void cdemoview::onlbuttonup(uint nflags, cpoint point)
loadcursor方法載入
bool cdemoview::onsetcursor(cwnd* pwnd, uint nhittest, uint message)void cdemoview::onlbuttondown(uint nflags, cpoint point)
void cdemoview::onlbuttonup(uint nflags, cpoint point)
beginwaitcursor和endwaitcursor
void cdemoview::onlbuttondown(uint nflags, cpoint point)
win32動態生成窗體選單
include windows.h define id file exit 9001 定義選單的id號 define id stuff go 9002 const char g szclassname mywindowsclass 定義視窗類的名稱陣列 lresult callback wndpro...
win32中建立右鍵彈出選單
在win32 中利用選單操作的幾個函式,能夠建立出右鍵彈出選單,步驟如下 1 現在resource.h中先定義三個idm資源,define idm aaa 200 define idm bbb 201 define idm ccc 202 2.定義乙個全域性變數 hmenu hmenu 3.在ini...
Win32程式設計
win32 malloc函式的底層實現是win32api utf 16編碼以16位無符號整數為單位,注意是16位為乙個單位,不是乙個字元就只有16位,這個要看字元的unicode編碼處於什麼範圍而定,有可能是2個位元組,也可能是4個位元組現在機器上的unicode編碼一般就是指utf 16 以兩個位...