計算機專業程式設計師實習日記

下面是xx小編為你精心收集整理的在計算機專業程式設計師實習日記,希望對你有所幫助,更多精彩內容,請點擊相關欄目查看!謝謝!

XX-05-14 星期一

listctrl中lvitem lpara有很廣泛的用處,我們可以通過這個參數實現list控制項的排序功能,這裡需要注意的是使用lvitem中的lparam,但是setitemdata 函式似乎又是對lvitem 的lpara進行設定的,這裡的關係似乎很微妙,但是我們一定要注意 不能混淆。類中的成員函式可以單獨的聲明為模板函式,但是模板函式的實現要放在頭檔案中。gdi+中沒有提供繪製圓角方的函式,我們需要通過graphicpath類進行模擬來實現。

滑鼠跟蹤訊息的要點:回響訊息wm_mousemove wm_mouseleave wm_mousehover 在wm_mousemove訊息中處理__trackmouseevent()函式。

XX-05-15 星期二

我們在使用tooltip的時候,有以下幾個關鍵點:

1,創建ctooltipctrl對象,create()函式實現。

2,使用addtool()函式向這個tooltip中加入tools,這也是綁定tool到某個控制項的過程,從中我們可以知道在這個ctooltipctrl對象中應該存在著不止一個tool,而是一系列的tool,通過函式deltool實現刪除,addtool實現添加,updatetiptext實現更新tool的文本。

3,最關鍵的是我們需要一個觸發tooltip的關鍵點,這個關鍵點控制著何時顯示這個tooltip,一般情況下我們在pretranslatemessage()函式中進行處理,這也是我們攔截wm_mousemove的地方,攔截之後,我們調用tooltip的relayevent向tooltip對象傳遞這個訊息用以表示tooltip可以被顯示或者更新。

靜態連結mfc dll模組的時候,由於mfc總是使用它所練級額的dll模組狀態,所以不存在模組管理的問題。

調試dll的時候,我們需要exe檔案的配合,所以先要生成exe測試檔案,然後將dll工程設定成active ,這時候會出現exe路徑提示對話框,我們將測試用的exe路徑填入就可以了。

XX-05-16 星期三

ctooltipctrl 函類中的relayevent()函式的存在理由,試想當我們的滑鼠在一個窗體上滑動的時候,會發生什麼情況,如果滑鼠下方的窗體是一個子窗體,那么這個子窗體將會收到滑鼠的訊息,而主窗體的滑鼠訊息因此被禁止,windows是通過這種方式來處理訊息的,這裡ctooltipctrl對象也需要受到訊息來進行處理,但是這些滑鼠訊息卻不能流向ctooltipctr對象,這就是問題的關鍵之所在,如何將訊息導向ctooltipctrl就成了關鍵,一般我們會在pretranslatemessage()函式中攔截訊息之後使之導向ctooltipctrl,這個導向所用的函式就是relayevent函式。

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.

有關tooltip控制項的討論目前還存在疑惑,1當我們使用lpstr_textcallback的時候,為什麼on_notify()可以得倒回響訊息,卻會在某個時間點出現stack run over的錯誤。