類似flashget的浮動視窗的實現
//得到位圖2、前端顯示。cbitmap m_bitmap;
hbitmap hbitmap = m_logo.getbitmap();
assert(hbitmap);
//得到點陣圖的資訊
m_bitmap.attach(hbitmap);
bitmap bmp;
m_bitmap.getbitmap(&bmp);
//得到點陣圖的大小
int nx = bmp.bmwidth;
int ny = bmp.bmheight;
//根據點陣圖的大小移動視窗
movewindow(0,0,nx,ny);
m_logo.movewindow(0,0,nx,ny);
centerwindow();
//通過setwindowspos函式將視窗前端顯示。3、在客戶區內按下滑鼠左鍵可以隨意拖動視窗的位置。響應wm_hittest函式,當滑鼠左鍵按下並在客戶區內,返回htcaption,欺騙windows,達到跟在標題欄拖動視窗一樣的效果。::setwindowpos(m_hwnd,hwnd_topmost,0,0,0,0,swp_nomove | swp_nosize);
uint cfloatwnd::onnchittest(cpoint pt)4、改變視窗的透明度。將視窗樣式設定為ws_ex_layered,並呼叫setlayeredwindowattributes函式來改變視窗的透明度。ws_ex_layered可能沒定義,我們可以直接取值0x80000。
//加入ws_ex_layered擴充套件屬性bool setlayeredwindowattributes(hwnd hwnd,colorref crkey,byte balpha,dword dwflags);setwindowlong(m_hwnd,gwl_exstyle,getwindowlong(this->getsafehwnd(),gwl_exstyle)^0x80000);
hwnd是要改變的視窗,當dwflags為lwa_alpha(0x2)時,crkey引數沒用,balpha為透明度,取值在0~255之間。該函式要從user.dll中載入。
//更新視窗透明度的**,其中itransparent為透明度。5、雙擊可以將主視窗啟用並顯示。由於wm_hittest訊息的影響,我們雙擊滑鼠的時候產生的是wm_nclbuttondblclk訊息,而不是wm_lbuttondblclk訊息。void cfloatwnd::onupdatetransparent(int itransparent)
freelibrary(hinst);
}}
void cmaindlg::onhscroll(uint nsbcode, uint npos, cscrollbar* pscrollbar)至於該視窗的右鍵選單,視窗的顯示與隱藏,程式的退出等簡單**我就不多介紹了。//設定slider位置
m_slider.setpos(icurpos);
//更新透明度
pfloatwnd->onupdatetransparent(icurpos);
cdialog::onhscroll(nsbcode, npos, pscrollbar);
}
三、該程式在windows xp sp2和visual c++6.0下編譯除錯成功。
類似flashget的浮動視窗的實現
得到位圖 cbitmap m bitmap hbitmap hbitmap m logo.getbitmap assert hbitmap 得到點陣圖的資訊 m bitmap.attach hbitmap bitmap bmp m bitmap.getbitmap bmp 得到點陣圖的大小 int ...
浮動的視窗製作
step1 建立乙個對話方塊資源 step2 設定對話方塊的屬性 style child border none step3 建立該資源對應的類,基類為cdialogbar step4 在主框架中宣告該對話方塊中的乙個例項 step5 if dockdlg1.create this,idd dial...
Android 實現頂層視窗 浮動視窗
做過window程式開發的朋友應該都知道,我們要把程式視窗置頂很簡單,只要設定一些視窗屬性即可。但是到了android,你無法簡單設定乙個屬性,就讓android的activity置頂。因為只要有新的activity啟動,你的activity介面就會被擋住。今天介紹一下如何把乙個視窗置頂。也許會有人...