vc++笔记十一
一、LNK1123: 轉換到 COFF 期間失敗: 文件無效或損壞
連接器LNK是通過調用cvtres.exe完畢文件向coff格式的轉換的,所以出現這樣的錯誤的原因就是cvtres.exe出現了問題。
在電腦里面搜索一下cvtres.exe,發現存在多個文件,使用最新的cvtres.exe替換老的文件就可以。替換之前記得備份一下,假設不正確,能夠替換回來。
比如:我的電腦里面安裝了vs2010,近期更新了系統。打了一些補丁。結果就出現這樣的錯誤了。在電腦里面搜索發現
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
C:\Windows\winsxs\x86_netfx-cvtres_for_vc_and_vb_b03f5f7f11d50a3a_6.1.7600.16385_none_ba476986f05abc65
C:\Windows\Microsoft.NET\Framework\v4.0.30319
這三個路徑里面都有cvtres.exe文件,于是我嘗試使用第二個路徑里面的文件替換第一個路徑的文件。問題解決。
//
VS2010編譯錯誤:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher
monkey monkey 2012-07-12 17:35:24
?VS2010編譯錯誤:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher
分類: VC 2010-08-13 16:09 3665人閱讀 評論(0) 收藏 舉報
以下是徹底解決方法:
在project的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
//
?BitBlt和StretchBlt的比較
他們的不同就是一個不能夠隨便改大小,一個大小隨便變。
///
在CMainFrame的OnCreate()中加入例如以下代碼:
long Style;
//去掉標題欄及其它樣式
SetWindowLong(this->m_hWnd,GWL_STYLE,0);
//去掉邊框及其它樣式
SetWindowLong(this->m_hWnd,GWL_EXSTYLE,0);
//取消菜單條
this->SetMenu(NULL);
在CView中的OnCreate()中也去掉邊框
//去掉邊框風格及其它樣式
long Style;
SetWindowLong(this->m_hWnd,GWL_EXSTYLE,0);
?
?
方法二:使用CWnd成員函數ModifyStyle實現 ?
// ?隱藏TitleBar ?
ModifyStyle(WS_CAPTION, ?0, ?SWP_FRAMECHANGED); ?
// ?顯示TitleBar ?
ModifyStyle(0, ?WS_CAPTION, ?SWP_FRAMECHANGED); ?
以上代碼,放置在CMainFrame的OnCreate函數的尾部就可以~~
///
SendDlgItemMessage 函數功能:該函數把一個消息發送給指定的對話框中的控制。
連接器LNK是通過調用cvtres.exe完畢文件向coff格式的轉換的,所以出現這樣的錯誤的原因就是cvtres.exe出現了問題。
在電腦里面搜索一下cvtres.exe,發現存在多個文件,使用最新的cvtres.exe替換老的文件就可以。替換之前記得備份一下,假設不正確,能夠替換回來。
比如:我的電腦里面安裝了vs2010,近期更新了系統。打了一些補丁。結果就出現這樣的錯誤了。在電腦里面搜索發現
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
C:\Windows\winsxs\x86_netfx-cvtres_for_vc_and_vb_b03f5f7f11d50a3a_6.1.7600.16385_none_ba476986f05abc65
C:\Windows\Microsoft.NET\Framework\v4.0.30319
這三個路徑里面都有cvtres.exe文件,于是我嘗試使用第二個路徑里面的文件替換第一個路徑的文件。問題解決。
//
VS2010編譯錯誤:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher
monkey monkey 2012-07-12 17:35:24
?VS2010編譯錯誤:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher
分類: VC 2010-08-13 16:09 3665人閱讀 評論(0) 收藏 舉報
以下是徹底解決方法:
在project的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
//
?BitBlt和StretchBlt的比較
他們的不同就是一個不能夠隨便改大小,一個大小隨便變。
///
在CMainFrame的OnCreate()中加入例如以下代碼:
long Style;
//去掉標題欄及其它樣式
SetWindowLong(this->m_hWnd,GWL_STYLE,0);
//去掉邊框及其它樣式
SetWindowLong(this->m_hWnd,GWL_EXSTYLE,0);
//取消菜單條
this->SetMenu(NULL);
在CView中的OnCreate()中也去掉邊框
//去掉邊框風格及其它樣式
long Style;
SetWindowLong(this->m_hWnd,GWL_EXSTYLE,0);
?
?
方法二:使用CWnd成員函數ModifyStyle實現 ?
// ?隱藏TitleBar ?
ModifyStyle(WS_CAPTION, ?0, ?SWP_FRAMECHANGED); ?
// ?顯示TitleBar ?
ModifyStyle(0, ?WS_CAPTION, ?SWP_FRAMECHANGED); ?
以上代碼,放置在CMainFrame的OnCreate函數的尾部就可以~~
///
SendDlgItemMessage 函數功能:該函數把一個消息發送給指定的對話框中的控制。
函數原型:LONG SendDlgItemMessage(
HWND hDlg, // handle of dialog box
int nIDDlgItem, // identifier of control
UINT Msg, // message to send
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
參數:
hDlg:指定含有控制的對話框。
nIDDigItem:指定接收消息的控制的標識符。
Msg:指定將被發送的消息。
wParam:指定消息特定的其它信息。
lParam:指定消息特定的其它信息。
返回值:返回值指定消息處理的結果,且依賴于發送的消息。
備注:SendDlgItemMessage函數直到消息已經被處理時才返回。
使用SendDlgItemMessage函數同從一個指定的控制中檢索句柄和調用SendMessagge函數一樣。
///
RegisterWindowMessage函數定義一個新的窗體消息,保證該消息在系統范圍內是唯一的。通常調用SendMessage或者PostMessage函數時,能夠使用該函數返回的消息值。
總結
- 上一篇: Curator操作ZooKeeper
- 下一篇: 几维安全Javascript代码混淆(j