計(jì)算機(jī)專業(yè)程序員實(shí)習(xí)日記
下面是小編為你精心收集整理的在計(jì)算機(jī)專業(yè)程序員實(shí)習(xí)日記,希望對(duì)你有所幫助,更多精彩內(nèi)容,請(qǐng)點(diǎn)擊相關(guān)欄目查看!謝謝!
-05-14 星期一
listctrl中l(wèi)vitem lpara有很廣泛的用處,我們可以通過這個(gè)參數(shù)實(shí)現(xiàn)list控件的排序功能,這里需要注意的是使用lvitem中的lparam,但是setitemdata 函數(shù)似乎又是對(duì)lvitem 的lpara進(jìn)行設(shè)置的,這里的關(guān)系似乎很微妙,但是我們一定要注意 不能混淆。類中的成員函數(shù)可以單獨(dú)的聲明為模板函數(shù),但是模板函數(shù)的實(shí)現(xiàn)要放在頭文件中。gdi+中沒有提供繪制圓角方的函數(shù),我們需要通過graphicpath類進(jìn)行模擬來實(shí)現(xiàn)。
鼠標(biāo)跟蹤消息的要點(diǎn):響應(yīng)消息wm_mousemove wm_mouseleave wm_mousehover 在wm_mousemove消息中處理__trackmouseevent()函數(shù)。
-05-15 星期二
我們?cè)谑褂胻ooltip的時(shí)候,有以下幾個(gè)關(guān)鍵點(diǎn):
1,創(chuàng)建ctooltipctrl對(duì)象,create()函數(shù)實(shí)現(xiàn)。
2,使用addtool()函數(shù)向這個(gè)tooltip中加入tools,這也是綁定tool到某個(gè)控件的過程,從中我們可以知道在這個(gè)ctooltipctrl對(duì)象中應(yīng)該存在著不止一個(gè)tool,而是一系列的tool,通過函數(shù)deltool實(shí)現(xiàn)刪除,addtool實(shí)現(xiàn)添加,updatetiptext實(shí)現(xiàn)更新tool的文本。
3,最關(guān)鍵的是我們需要一個(gè)觸發(fā)tooltip的關(guān)鍵點(diǎn),這個(gè)關(guān)鍵點(diǎn)控制著何時(shí)顯示這個(gè)tooltip,一般情況下我們?cè)趐retranslatemessage()函數(shù)中進(jìn)行處理,這也是我們攔截wm_mousemove的地方,攔截之后,我們調(diào)用tooltip的relayevent向tooltip對(duì)象傳遞這個(gè)消息用以表示tooltip可以被顯示或者更新。
靜態(tài)鏈接mfc dll模塊的時(shí)候,由于mfc總是使用它所練級(jí)額的dll模塊狀態(tài),所以不存在模塊管理的問題。
調(diào)試dll的時(shí)候,我們需要exe文件的配合,所以先要生成exe測試文件,然后將dll工程設(shè)置成active ,這時(shí)候會(huì)出現(xiàn)exe路徑提示對(duì)話框,我們將測試用的exe路徑填入就可以了。
-05-16 星期三
ctooltipctrl 函類中的relayevent()函數(shù)的存在理由,試想當(dāng)我們的鼠標(biāo)在一個(gè)窗體上滑動(dòng)的時(shí)候,會(huì)發(fā)生什么情況,如果鼠標(biāo)下方的窗體是一個(gè)子窗體,那么這個(gè)子窗體將會(huì)收到鼠標(biāo)的消息,而主窗體的鼠標(biāo)消息因此被屏蔽,windows是通過這種方式來處理消息的,這里ctooltipctrl對(duì)象也需要受到消息來進(jìn)行處理,但是這些鼠標(biāo)消息卻不能流向ctooltipctr對(duì)象,這就是問題的關(guān)鍵之所在,如何將消息導(dǎo)向ctooltipctrl就成了關(guān)鍵,一般我們會(huì)在pretranslatemessage()函數(shù)中攔截消息之后使之導(dǎo)向ctooltipctrl,這個(gè)導(dǎo)向所用的函數(shù)就是relayevent函數(shù)。
you can have messages relayed automatically if:
?the tool is a control or is defined as a rectangle in the tool"s toolinfo structure.
?the window associated with the tool is in the same thread as the tooltip control.
if these two conditions are met, set the ttf_subclass flag in the uflags member of the tool"s toolinfo structure when you add
the tool to the tooltip control with ttm_addtool. the necessary mouse messages then will be relayed automatically to the
tooltip control.
有關(guān)tooltip控件的討論目前還存在疑惑,1當(dāng)我們使用lpstr_textcallback的時(shí)候,為什么on_notify()可以得倒響應(yīng)消息,卻會(huì)在某個(gè)時(shí)間點(diǎn)出現(xiàn)stack run over的錯(cuò)誤。