拖動無標題的窗口可以重載
WM_LBUTTONDOWN,添加如下代碼:SendMessage(WM_SYSCOMMAND,0xF012,0);
或
PostMessage (WM_NCLBUTTONDOWN , HTCAPTION , MAKELPARAM(point.x , point. y ));
posted @
2013-05-30 08:35 王海光 閱讀(747) |
評論 (0) |
編輯 收藏
代碼示例:#define LWA_COLORKEY 0x00000001 //方式
#define WS_EX_LAYERED 0x00080000
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes SetLayeredWindowAttributes;
//設置成邊緣透明
COLORREF maskColor=#000000;
HMODULE hUser32 = GetModuleHandle("user32.dll"); //加載動態鏈接庫
SetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)GetProcAddress(hUser32,"SetLayeredWindowAttributes");
//取得SetLayeredWindowAttributes函數指針
//為窗口加入WS_EX_LAYERED擴展屬性
SetWindowLong(this->GetSafeHwnd(), GWL_EXSTYLE, GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE)^WS_EX_LAYERED);
//調用SetLayeredWinowAttributes函數
SetLayeredWindowAttributes(this->GetSafeHwnd(), maskColor, 192, LWA_COLORKEY);
FreeLibrary(hUser32); //釋放動態鏈接庫
以上代碼加入OnInitDialog()中,其中 SetLayeredWindowAttributes(this->GetSafeHwnd(), maskColor, 192, LWA_COLORKEY); 里,maskColor為將進行透明處理的顏色, 192為透明度, LWA_COLORKEY為透明方式。
若要透明整個對話框,則LWA_COLORKEY=2;
若要對選定顏色透明,則LWA_COLORKEY=1; 本文轉自:http://chenjiuliang.blog.163.com/blog/static/36572155201151735735374/
posted @
2013-05-29 11:18 王海光 閱讀(1769) |
評論 (0) |
編輯 收藏
1、導入Bitmap資源圖片,2、重載WM_PAINT ——>void CXXXDlg::OnPaint()
3、添加如下代碼:
CRect rect;
GetClientRect(&rect);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpBackground;
bmpBackground.LoadBitmap(IDB_BITMAP_TOOL); //IDB_BITMAP_TOOL是你自己的圖對應的ID
BITMAP bitmap;
bmpBackground.GetBitmap(&bitmap);
CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground);
dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,
bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);
其他方法:
重寫WM_ERASEBKGND消息
BOOL CxxDialog::OnEraseBkgnd(CDC* pDC)
{
// CDialog::OnEraseBkgnd(pDC);//忘記要不要執行父類的這個了.
CDC memdc;
memdc.CreateCompatibleDC(pDC);
CBitmap bmp;
CBitmap *pOldBmp;
BITMAP bm;//用來保存圖片的長寬等信息
bmp.LoadBitmap(IDB_BITMAP1);
bmp.GetBitmap(&bm);
//將圖片選進緩沖區
pOldBmp = (CBitmap *)memdc.SelectObject(&bmp);
//如果圖片跟對話框的客戶區一樣大,直接用BitBlt就可以
//pDC->BitBlt(0, 0, rcWnd.Width(), rcWnd.Height(), &memdc, 0, 0, SRCCOPY);
//如果圖片比對話框的背景小,就要用StrechBlt來拉伸圖片
pDC->StrechBlt(0, 0, rcWnd.Width, rcWnd.Height(), &memdc, 0, 0, bm.bmWidth,bm.bmHeight, SRCCOPY);
//釋放DC
memdc.SelectObject(pOldBmp);
memdc.DeleteDC();
return TRUE;
}
其他方法:http://blog.csdn.net/ply421600/article/details/6692967
posted @
2013-05-29 11:02 王海光 閱讀(3663) |
評論 (1) |
編輯 收藏
摘要: 1、NameNode啟動加載元數據情景分析
NameNode函數里調用FSNamesystemm讀取dfs.namenode.name.dir和dfs.namenode.edits.dir構建FSDirectory。
FSImage類recoverTransitionRead和saveNameSpace分別實現了元數據的檢查、加載、內存合并和元數據的持久化存儲。
saveNameSpace將元數據寫入到磁盤,具體操作步驟:首先將current目錄重命名為lastcheckpoint.tmp;然后在創建新的current目錄,并保存文件;最后將lastcheckpoint.tmp重命名為privios.checkpoint.
checkPoint的過程:Secondary NameNode會通知nameNode產生一個edit log文件edits.new,之后所有的日志操作寫入到edits.new文件中。接下來Secondary NameNode會從namenode下載fsimage和edits文件,進行合并產生新的fsimage.ckpt;然后Seco
閱讀全文
posted @
2013-05-24 15:29 王海光 閱讀(479) |
評論 (0) |
編輯 收藏
摘要: 1、元數據(Metadata):維護HDFS文件系統中文件和目錄的信息,分為內存元數據和元數據文件兩種。NameNode維護整個元數據。
閱讀全文
posted @
2013-05-24 15:18 王海光 閱讀(1026) |
評論 (0) |
編輯 收藏
1、今天調試一個demo,發現如下錯誤。1> 系統找不到指定的文件。
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "copy D:\WL_SDK_LAN_C++_20130521\demo\c++\Debug\Sample.exe D:\YuanTuo_1\wulianSDK\wulian_sdk_sample\SDK\Sample.exe
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.可以修改下面屬性:
fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
下面是徹底解決方法:在工程的stdafx.h中添加(如有類似語句,需注釋掉)#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0601 // Change this to the appropriate value to target IE 5.0 or later.
#endif
posted @
2013-05-22 17:57 王海光 閱讀(3313) |
評論 (0) |
編輯 收藏
默認情況下,Windows的Notepad把文件保存為ANSI格式,在這種情況,設定不同encoding有不同的結果: encoding="GB2312" ,正常顯示; encoding="UTF-8" ,出錯,提示文本內容中發現無效字符 ;把xml文件在notepad另包存為UTF-8格式, encoding="GB2312" ,出錯,提示不支持從當前編碼到指定編碼的切換; encoding="UTF-8" ,正常;例外:不設置encoding的值,默認就是UTF-8,所以把這種情況歸入UTF-8的情況.
posted @
2013-05-22 15:24 王海光 閱讀(418) |
評論 (0) |
編輯 收藏
摘要: 如何復制第5行到第10行并粘貼到第12行之后?方法1: 光標放到第五行, 輸入:y6y 光標放到第12行, 輸入:p 方法2: 命令行模式下輸入 :5,10 co 12 方法3: 我一般都是 先移到第五行 d6 p 再移到12行 p 延伸一下, 有時候不想費勁看多少行或復制大量行時,可以使用標簽來替代 光標移到起始行,輸入ma 光標移到結束行,輸入mb 光標移到粘貼行,輸入mc...
閱讀全文
posted @
2013-05-09 09:44 王海光 閱讀(3164) |
評論 (0) |
編輯 收藏
摘要: Ctrl+Alt+F7和startx 進入圖形界面 cat /etc/issue 查看ubuntu版本號 cat /etc/lsb-release 查看ubuntu版本號 uname –a 或uname -r查看內核版本 top 查看CPU和內存...
閱讀全文
posted @
2013-05-06 16:29 王海光 閱讀(521) |
評論 (0) |
編輯 收藏
摘要: 本人用的版本:ubuntu10.04 .4,hadoop 1.0.4最近一直在自學Hadoop,今天花點時間搭建一個開發環境,并整理成文。首先要了解一下Hadoop的運行模式:單機模式(standalone) 單機模式是Hadoop的默認模式。當首次解壓Hadoop的源碼包時,Hadoop無法了解硬件安裝環境,便保守地選擇了最小配置。在這種默認模...
閱讀全文
posted @
2013-05-06 15:14 王海光 閱讀(614) |
評論 (0) |
編輯 收藏