锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91久久精品视频,久久国产亚洲精品麻豆,久久综合久久美利坚合众国http://www.shnenglu.com/sunshinealike/category/9770.html鍗婂畬緹庝富涔?/description>zh-cnSat, 30 May 2009 20:18:27 GMTSat, 30 May 2009 20:18:27 GMT60MultiThreadhttp://www.shnenglu.com/sunshinealike/archive/2009/05/11/82542.htmlSunshine AlikeSunshine AlikeMon, 11 May 2009 03:19:00 GMThttp://www.shnenglu.com/sunshinealike/archive/2009/05/11/82542.htmlhttp://www.shnenglu.com/sunshinealike/comments/82542.htmlhttp://www.shnenglu.com/sunshinealike/archive/2009/05/11/82542.html#Feedback0http://www.shnenglu.com/sunshinealike/comments/commentRss/82542.htmlhttp://www.shnenglu.com/sunshinealike/services/trackbacks/82542.html
#include聽<windows.h>
#include聽
<iostream>

usingnamespace聽std;

//綰跨▼澶勭悊鍑芥暟
DWORD聽WINAPI聽Fun1(LPVOID聽lpParam);
DWORD聽WINAPI聽Fun2(LPVOID聽lpParam);

int聽tickets聽=20;

void聽main()
{

聽聽聽聽HANDLE聽hThread1,聽hThread2;
聽聽聽聽hThread1聽
=聽CreateThread(NULL,聽0,聽Fun1,聽NULL,聽0,聽NULL);
聽聽聽聽hThread2聽
=聽CreateThread(NULL,聽0,聽Fun2,聽NULL,聽0,聽NULL);
聽聽聽聽CloseHandle(hThread1);
聽聽聽聽CloseHandle(hThread2);

聽聽聽聽cin.
get();
}


DWORD聽WINAPI聽Fun1(LPVOID聽lpParam)
{
聽聽聽聽
while(true)
聽聽聽聽{
聽聽聽聽聽聽聽聽
if(tickets聽>0)
聽聽聽聽聽聽聽聽聽聽聽聽cout
<<"Thread1聽sell聽ticket聽:聽"<<tickets--<<endl;
聽聽聽聽聽聽聽聽
elsebreak;
聽聽聽聽}
聽聽聽聽
return0;
}

DWORD聽WINAPI聽Fun2(LPVOID聽lpParam)
{
聽聽聽聽
while(true)
聽聽聽聽{
聽聽聽聽聽聽聽聽
if(tickets聽>0)
聽聽聽聽聽聽聽聽聽聽聽聽cout
<<"Thread2聽sell聽ticket聽:聽"<<tickets--<<endl;
聽聽聽聽聽聽聽聽
elsebreak;
聽聽聽聽}
聽聽聽聽
return0;
}
榪欓噷鍦╩ain閲岀敤涓や釜鍑芥暟Fun1鍜孎un2寤轟簡涓や釜綰跨▼錛屾湁涓涓叏灞鍙橀噺ticket錛?0琛ㄧず20寮犵エ錛屽垎鐢變袱涓嚎紼嬭繘琛屽嚭鍞?br />浣嗘槸榪欎釜紼嬪簭榪愯璧鋒潵緇撴灉浼?xì)鍑虹幇尕滀贡鍜屼笉纭畾锛?xì)

緇撴灉1.jpg
鍘熷洜寰堢畝鍗曪紝鍦ㄦ搷浣滅郴緇熼噷閮藉榪囧叧浜庡悓姝ョ殑闂錛岃繖閲岀殑涓や釜綰跨▼涔嬮棿灝辨病鏈夊涓寸晫璧勬簮ticket榪涜鍚屾銆傜被浼間簬鎿嶄綔緋葷粺閲岀殑PV鎿嶄綔錛屽彲浠ュ皢紼嬪簭鏀逛負(fù)錛?br />
#include聽<windows.h>
#include聽
<iostream>

usingnamespace聽std;

//綰跨▼澶勭悊鍑芥暟
DWORD聽WINAPI聽Fun1(LPVOID聽lpParam);
DWORD聽WINAPI聽Fun2(LPVOID聽lpParam);

int聽tickets聽=20;
HANDLE聽hMutex;

void聽main()
{
聽聽聽聽hMutex聽
=聽CreateMutex(NULL,聽false,聽NULL);

聽聽聽聽HANDLE聽hThread1,聽hThread2;
聽聽聽聽hThread1聽
=聽CreateThread(NULL,聽0,聽Fun1,聽NULL,聽0,聽NULL);
聽聽聽聽hThread2聽
=聽CreateThread(NULL,聽0,聽Fun2,聽NULL,聽0,聽NULL);
聽聽聽聽CloseHandle(hThread1);
聽聽聽聽CloseHandle(hThread2);

聽聽聽聽cin.
get();
}


DWORD聽WINAPI聽Fun1(LPVOID聽lpParam)
{
聽聽聽聽
while(true)
聽聽聽聽{
聽聽聽聽聽聽聽聽WaitForSingleObject(hMutex,聽INFINITE);
聽聽聽聽聽聽聽聽
if(tickets聽>0)
聽聽聽聽聽聽聽聽聽聽聽聽cout
<<"Thread1聽sell聽ticket聽:聽"<<tickets--<<endl;
聽聽聽聽聽聽聽聽
elsebreak;
聽聽聽聽聽聽聽聽ReleaseMutex(hMutex);
聽聽聽聽}
聽聽聽聽
return0;
}

DWORD聽WINAPI聽Fun2(LPVOID聽lpParam)
{
聽聽聽聽
while(true)
聽聽聽聽{
聽聽聽聽聽聽聽聽WaitForSingleObject(hMutex,聽INFINITE);
聽聽聽聽聽聽聽聽
if(tickets聽>0)
聽聽聽聽聽聽聽聽聽聽聽聽cout
<<"Thread2聽sell聽ticket聽:聽"<<tickets--<<endl;
聽聽聽聽聽聽聽聽
elsebreak;
聽聽聽聽聽聽聽聽ReleaseMutex(hMutex);
聽聽聽聽}
聽聽聽聽
return0;
}
榪欓噷鐢ㄤ簡涓涓俊鎭噺Mutex鏉ュticket榪涜鍚屾鎿嶄綔錛岃繘紼嬭鎿嶄綔ticket涔嬪墠蹇呴』鍏堣幏寰椾俊鍙烽噺錛屼嬌鐢ㄥ畬涔嬪悗閲婃斁浠ヤ嬌鏁翠釜榪囩▼鑳界戶緇笅鍘匯?br />鏈鍚庡緱鍒版甯哥殑緇撴灉涓猴細(xì)
緇撴灉2.jpg


]]>
WinSocketTest 2.0http://www.shnenglu.com/sunshinealike/archive/2009/05/06/82069.htmlSunshine AlikeSunshine AlikeWed, 06 May 2009 09:08:00 GMThttp://www.shnenglu.com/sunshinealike/archive/2009/05/06/82069.htmlhttp://www.shnenglu.com/sunshinealike/comments/82069.htmlhttp://www.shnenglu.com/sunshinealike/archive/2009/05/06/82069.html#Feedback0http://www.shnenglu.com/sunshinealike/comments/commentRss/82069.htmlhttp://www.shnenglu.com/sunshinealike/services/trackbacks/82069.html鎸夐挳涓涓犅?IDC_BTN_SEND
緙栫▼妗嗕笁涓?IDC_EDIT_PORT(绔彛鍙?錛孖DC_EDIT_REC(鏄劇ず鎺ユ敹鍒扮殑娑堟伅)錛孖DC_EDIT_SEND(杈撳叆鍙戦佸唴瀹?
IP鎺т歡涓涓?IDC_IPADDRESS1

UDPChatDlg.h涓姞鍏?br />#define聽聽聽 WM_RECDATA WM_USER+1
鏉ュ畾涔変竴涓秷鎭彿錛岀敤鏉ュ鐞嗘帴鏀跺埌娑堟伅鐨勪簨浠?br />
鐒跺悗鏄互涓嬫柟娉曞0鏄庯細(xì)
private:
聽聽聽聽
bool聽InitSocket(void);
聽聽聽聽
static聽DWORD聽WINAPI聽RecProc(LPVOID聽lpParam);
聽聽聽聽afx_msg聽LRESULT聽OnRecData(WPARAM聽wParam,LPARAM聽lParam);
聽聽聽聽afx_msg聽
void聽OnBnClickedBtnSend();

娑堟伅鏄犲皠閲屽姞鍏ヤ袱鏉★細(xì)
ON_MESSAGE(WM_RECDATA, OnRecData)//澶勭悊鏀跺埌娑堟伅浜嬩歡
ON_BN_CLICKED(IDC_BTN_SEND, &CTcpChatDlg::OnBnClickedBtnSend)//澶勭悊鎸夐挳鐐瑰嚮浜嬩歡

鑷蟲錛屼竾浜嬪叿澶囷紝鍙瑺涓滈銆?br />
棣栧厛紿楀彛鍒濆鍖栧嚱鏁癘nInitDialog閲屽姞鍏?br />
聽聽聽聽//鏋勯犱竴涓柊綰跨▼鐢ㄤ簬鐩戝惉鎺ユ敹
聽聽聽聽HANDLE聽hThread聽=
聽聽聽聽聽聽聽聽CreateThread(NULL,聽
0,聽RecProc,聽(LPVOID)m_hWnd,聽0,聽NULL);
聽聽聽聽CloseHandle(hThread);

聽聽聽聽((CIPAddressCtrl
*)GetDlgItem(IDC_IPADDRESS1))->SetAddress(127,聽0,聽0,聽1);
聽聽聽聽SetDlgItemText(IDC_EDIT_PORT,聽_T(
"6000"));
鍚庨潰灝辨槸鍥涗釜鐩稿叧鐨勬垚鍛樺嚱鏁幫紝闇瑕佹敞鎰忕殑鏄湪綰跨▼蹇呴』浣跨敤闈欐佸嚱鏁版垨鑰呭叏灞鍑芥暟錛屽洜涓鴻繖紼嬪簭涓寮濮嬶紝綰跨▼灝辮繍琛岃搗鏉ヤ簡錛岃屾垚鍛樻柟娉曞湪閭d釜鏃跺欏彲鑳借繕娌℃湁鐢熸垚鍑烘潵銆?br />
bool聽CTcpChatDlg::InitSocket()
{

聽聽聽聽WORD聽wVersionRequested;
聽聽聽聽WSADATA聽wsaData;
聽聽聽聽wVersionRequested聽
=聽MAKEWORD(聽2,聽2聽);

聽聽聽聽
int聽err聽=聽WSAStartup(聽wVersionRequested,聽&wsaData聽);
聽聽聽聽
if聽(聽err聽!=0聽)聽{
聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽
returnfalse;
聽聽聽聽}

聽聽聽聽
if聽(聽LOBYTE(聽wsaData.wVersion聽)聽!=2||
聽聽聽聽聽聽聽聽HIBYTE(聽wsaData.wVersion聽)聽
!=2聽)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽聽聽聽聽WSACleanup(聽);
聽聽聽聽聽聽聽聽聽聽聽聽
returnfalse;聽
聽聽聽聽}
聽聽聽聽
returntrue;
}


DWORD聽WINAPI聽CTcpChatDlg::RecProc(LPVOID聽lpParam)
{

聽聽聽聽HWND聽hWnd聽=聽(HWND)lpParam;

聽聽聽聽
//-----------------------------------------------
聽聽聽聽
//聽Create聽a聽receiver聽socket聽to聽receive聽datagrams
聽聽聽聽SOCKET聽RecvSocket聽=聽socket(AF_INET,聽SOCK_DGRAM,聽0);
聽聽聽聽
if(INVALID_SOCKET聽==聽RecvSocket)
聽聽聽聽{聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽::AfxMessageBox(_T(
"socket鍒涘緩澶辮觸"));
聽聽聽聽聽聽聽聽
return1;
聽聽聽聽}

聽聽聽聽
//-----------------------------------------------
聽聽聽聽
//聽Bind聽the聽socket聽to聽any聽address聽and聽the聽specified聽port.
聽聽聽聽SOCKADDR_IN聽RecvAddr;
聽聽聽聽RecvAddr.sin_family聽
=聽AF_INET;
聽聽聽聽RecvAddr.sin_port聽
=聽htons(6000);
聽聽聽聽RecvAddr.sin_addr.S_un.S_addr聽
=聽htonl(INADDR_ANY);

聽聽聽聽
if(SOCKET_ERROR聽==聽bind(RecvSocket,聽(SOCKADDR聽*)聽&RecvAddr,聽sizeof(RecvAddr)))
聽聽聽聽{
聽聽聽聽聽聽聽聽closesocket(RecvSocket);
聽聽聽聽聽聽聽聽::AfxMessageBox(_T(
"bind澶辮觸"));
聽聽聽聽聽聽聽聽
return1;
聽聽聽聽}

聽聽聽聽
//-----------------------------------------------
聽聽聽聽
//聽Call聽the聽recvfrom聽function聽to聽receive聽datagrams
聽聽聽聽
//聽on聽the聽bound聽socket.
聽聽聽聽int聽retval;

聽聽聽聽
char聽RecvBuf[1024];
聽聽聽聽
char聽tmpBuf[1024];

聽聽聽聽sockaddr_in聽SenderAddr;
聽聽聽聽
int聽SenderAddrSize聽=sizeof(SenderAddr);

聽聽聽聽
while(true)
聽聽聽聽{
聽聽聽聽聽聽聽聽retval聽
=聽recvfrom(RecvSocket,聽
聽聽聽聽聽聽聽聽聽聽聽聽RecvBuf,聽
聽聽聽聽聽聽聽聽聽聽聽聽
1024,聽
聽聽聽聽聽聽聽聽聽聽聽聽
0,聽
聽聽聽聽聽聽聽聽聽聽聽聽(SOCKADDR聽
*)&SenderAddr,聽
聽聽聽聽聽聽聽聽聽聽聽聽
&SenderAddrSize);
聽聽聽聽聽聽聽聽
if(SOCKET_ERROR聽==聽retval)
聽聽聽聽聽聽聽聽{
聽聽聽聽聽聽聽聽聽聽聽聽CString聽strError;
聽聽聽聽聽聽聽聽聽聽聽聽strError.Format(
"error聽code聽:聽%d",聽WSAGetLastError());
聽聽聽聽聽聽聽聽聽聽聽聽::AfxMessageBox(strError);
聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽sprintf_s(tmpBuf,聽
1024,聽"鏀跺埌%s娑堟伅:聽%s",聽inet_ntoa(SenderAddr.sin_addr),聽RecvBuf);
聽聽聽聽聽聽聽聽
//鍙戦佹秷鎭?/span>
聽聽聽聽聽聽聽聽::PostMessage(hWnd,聽WM_RECDATA,聽0,聽(LPARAM)tmpBuf);
聽聽聽聽}

聽聽聽聽
//娓呯悊宸ヤ綔
聽聽聽聽closesocket(RecvSocket);
聽聽聽聽WSACleanup();
聽聽聽聽
return0;//鎴愬姛
}


LRESULT聽CTcpChatDlg::OnRecData(WPARAM聽wParam,LPARAM聽lParam)
{
聽聽聽聽CString聽str((
char*)lParam);
聽聽聽聽CString聽origin;
聽聽聽聽GetDlgItemText(IDC_EDIT_REC,origin);
聽聽聽聽str聽
+="\r\n";
聽聽聽聽str聽
+=聽origin;
聽聽聽聽SetDlgItemText(IDC_EDIT_REC,str);
聽聽聽聽SetDlgItemText(IDC_EDIT_SEND,聽_T(
""));
聽聽聽聽
return0;
}

void聽CTcpChatDlg::OnBnClickedBtnSend()
{
聽聽聽聽DWORD聽dwIP;
聽聽聽聽((CIPAddressCtrl
*)GetDlgItem(IDC_IPADDRESS1))->GetAddress(dwIP);
聽聽聽聽CString聽strPort;
聽聽聽聽GetDlgItemText(IDC_EDIT_PORT,聽strPort);
聽聽聽聽
//鍒涘緩鍙戦佸湴鍧淇℃伅
聽聽聽聽SOCKADDR_IN聽addrTo;
聽聽聽聽addrTo.sin_family聽
=聽AF_INET;
聽聽聽聽addrTo.sin_port聽
=聽htons(atoi(strPort));
聽聽聽聽addrTo.sin_addr.S_un.S_addr聽
=聽htonl(dwIP);

聽聽聽聽CString聽strMsg;
聽聽聽聽GetDlgItemText(IDC_EDIT_SEND,聽strMsg);

聽聽聽聽SOCKET聽sock聽
=聽socket(AF_INET,聽SOCK_DGRAM,聽0);

聽聽聽聽
if(SOCKET_ERROR聽==
聽聽聽聽聽聽聽聽sendto(
聽聽聽聽聽聽聽聽sock,聽strMsg,聽
聽聽聽聽聽聽聽聽strMsg.GetLength()
+1,聽0,聽
聽聽聽聽聽聽聽聽(SOCKADDR聽
*)&addrTo,聽sizeof(addrTo)
聽聽聽聽聽聽聽聽))
聽聽聽聽{
聽聽聽聽聽聽聽聽CString聽strError;
聽聽聽聽聽聽聽聽strError.FormatMessage(
"Send聽Failed,聽Error聽Code:聽%d",聽WSAGetLastError());
聽聽聽聽聽聽聽聽MessageBox(strError);
聽聽聽聽}
聽聽聽聽
聽聽聽聽closesocket(sock);
}



]]>
WinSocketTest 1.0http://www.shnenglu.com/sunshinealike/archive/2009/04/17/80165.htmlSunshine AlikeSunshine AlikeFri, 17 Apr 2009 01:44:00 GMThttp://www.shnenglu.com/sunshinealike/archive/2009/04/17/80165.htmlhttp://www.shnenglu.com/sunshinealike/comments/80165.htmlhttp://www.shnenglu.com/sunshinealike/archive/2009/04/17/80165.html#Feedback2http://www.shnenglu.com/sunshinealike/comments/commentRss/80165.htmlhttp://www.shnenglu.com/sunshinealike/services/trackbacks/80165.html鏈榪戞潵浜嗙偣鍔插ご,鍏堝啓涓婄粌鐨勫嚑涓緥瀛?br />
浣跨敤windows濂楁帴瀛楃殑緗戠粶灝忕▼搴?------------------

1.Socket鍩烘湰鎿嶄綔
銆(1)鍚姩/緇堟
聽聽聽聽 winsock鍦ㄨ璋冪敤鏃朵互鍔ㄦ侀摼鎺ュ簱鐨勫艦寮忓疄鐜幫紝鎵浠ュ湪瀹冨垵濮嬪寲鏃跺簲棣栧厛璋冪敤WSAStartup鍑芥暟榪涜鍒濆鍖栵紝鍚屾椂紜畾琚皟鐢ㄧ殑winsock鐗堟湰鍙風(fēng)瓑銆?br />
聽聽聽聽//聽聽鍔犺澆濂楁帴瀛楀簱
聽聽聽聽WORD聽wVersionRequested;
聽聽聽聽WSADATA聽wsaData;
聽聽聽聽wVersionRequested聽
=聽MAKEWORD(聽1,聽1聽);

聽聽聽聽
int聽err聽=聽WSAStartup(聽wVersionRequested,聽&wsaData聽);
聽聽聽聽
if聽(聽err聽!=0聽)聽{
聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽
returnfalse;
聽聽聽聽}

聽聽聽聽
if聽(聽LOBYTE(聽wsaData.wVersion聽)聽!=1||
聽聽聽聽聽聽聽聽HIBYTE(聽wsaData.wVersion聽)聽
!=1聽)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽聽聽聽聽WSACleanup(聽);
聽聽聽聽聽聽聽聽聽聽聽聽
returnfalse;聽
榪欓噷鍔犺澆浜?.1鐗堟湰鐨剆ocket銆傚湪緗戠粶閫氫俊瀹屾垚鍚庯紝闇瑕佷嬌鐢ㄥ嚱鏁癢SACleanup閲婃斁璧勬簮銆?br />銆(2)鍒涘緩涓庣粦瀹?br />銆銆濂楁帴瀛楃殑鍒涘緩闈炲父綆鍗曪紝鍙渶瑕佽皟鐢╯ocket鍗沖彲銆傚涓嬶細(xì)
聽聽聽 SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);//嫻佸紡錛孴CP
銆銆SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);//鏁版嵁鎶ワ紝UDP

銆銆浣跨敤bind鍑芥暟鍙互灝嗕竴涓鎺ュ瓧緇戝畾鍒頒竴涓湴鍧涓?br />銆銆int bind(SOCKET sock, const struct sockaddr* name, int len);//sockaddr鏄竴涓敤鏉ヨ〃紺哄湴
銆銆鍧淇℃伅鐨勭粨鏋?br />銆(3)渚﹀惉錛屾帴鍙楄繛鎺ヤ笌榪炴帴
銆銆listen, accept, connect榪欎笁涓嚱鏁扮敤浜庡緩绔嬮氫俊鐨勮繛鎺ャ?br />銆銆int listen(SOCKET sock, int backlog);//scok蹇呴』鏄竴涓凡緇忕粦瀹氫絾鏄病鏈夎繛鎺ョ殑濂楁帴瀛楋紝
銆銆backlog鐢ㄤ簬璁懼畾鏈澶у彲浠ョ瓑寰呯殑榪炴帴闀垮害
銆銆鎴愬姛璋冪敤listen鍑芥暟鍚庯紝灝卞彲浠ユ帴鍙楀鎴鋒満鐨勮繛鎺ヤ簡銆?br />銆銆SOCKET accept(SOCKET sock, struct sockaddr* addr, int* addrlen);
銆銆鍒版涓鍒囧氨緇紝褰撳鎴鋒満鎯沖埌榪炴帴鏃跺彲浠ヤ嬌鐢╟onnect榪涜榪炴帴銆?br />銆(4)鍙戦侊紝榪炴帴
銆銆鐢ㄤ簬TCP鐨勶細(xì)
銆銆int send(SOCKET sock, const char* buf, int len, int flags);
聽聽聽 int recv(SOCKET sock, char* buf, int len, int flags);
銆銆鐢ㄤ簬UDP鐨勶細(xì)
銆銆int sendto(SOCKET sock, const char* buf, int len, int flags,
銆銆銆銆銆銆銆銆銆銆銆銆銆銆const struct sockaddr* to, int tolen);
聽聽聽 int recvfrom(SOCKET sock, char* buf, int len, int flags,
銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆struct sockaddr* from, int formlen);

2.紺轟緥
銆涓や釜win32鐨勬帶鍒跺彴紼嬪簭錛屼竴涓猅cpSer錛屼竴涓猅cpClient銆?br />銆涓轟簡浣跨敤socket闇瑕佸寘鍚ご鏂囦歡<Winsock2.h>

銆TcpSer錛?br />銆
#include聽<Winsock2.h>
#include聽
<iostream>
#include聽
<string>
usingnamespace聽std;

void聽main()
{
聽聽聽聽
//鍔犺澆濂楁帴瀛楀簱錛岀増鏈?.1
聽聽聽聽WORD聽wVersionRequested;
聽聽聽聽WSADATA聽wsaData;
聽聽聽聽
int聽err;

聽聽聽聽wVersionRequested聽
=聽MAKEWORD(聽1,聽1聽);

聽聽聽聽err聽
=聽WSAStartup(聽wVersionRequested,聽&wsaData聽);
聽聽聽聽
if聽(聽err聽!=0聽)聽{
聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽
return;
聽聽聽聽}

聽聽聽聽
if聽(聽LOBYTE(聽wsaData.wVersion聽)聽!=1||
聽聽聽聽聽聽聽聽HIBYTE(聽wsaData.wVersion聽)聽
!=1聽)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽聽聽聽聽WSACleanup(聽);
聽聽聽聽聽聽聽聽聽聽聽聽
return;聽
聽聽聽聽}
聽聽聽聽
聽聽聽聽
//鍒涘緩濂楁帴瀛?/span>
聽聽聽聽SOCKET聽sockSer聽=聽socket(AF_INET,聽SOCK_STREAM,聽0);
聽聽聽
//鍦板潃緇撴瀯浣?/span>
聽聽聽聽SOCKADDR_IN聽addrSer;
聽聽聽聽addrSer.sin_addr.S_un.S_addr聽聽
=聽htonl(INADDR_ANY);
聽聽聽聽addrSer.sin_family聽
=聽AF_INET;
聽聽聽聽addrSer.sin_port聽
=聽htons(6000);
聽聽聽
//緇戝畾涓庣洃鍚?/span>
聽聽聽聽bind(sockSer,聽(SOCKADDR*)&addrSer,聽sizeof(SOCKADDR));
聽聽聽聽listen(sockSer,聽
5);
聽聽聽聽cout
<<"Tcp聽Server聽Run!"<<endl;

聽聽聽聽SOCKADDR_IN聽addrClient;
聽聽聽聽
int聽len聽=sizeof(SOCKADDR);
銆銆//鏀跺埌榪炴帴璇鋒眰錛屽垱寤轟竴涓柊socket鐢ㄤ簬淇濇寔榪炴帴
聽聽聽聽SOCKET聽sockCon聽=聽accept(sockSer,聽(SOCKADDR*)&addrClient,聽&len);
聽聽聽聽
while(true)
聽聽聽聽{
聽聽聽聽聽聽聽聽
char聽recBuf[100];
聽聽聽聽聽聽聽聽recv(sockCon,聽recBuf,聽
100,聽0);
聽聽聽聽聽聽聽聽cout
<<"message聽form聽clinet聽:聽"<<recBuf<<endl;
聽聽聽聽}
聽聽聽 //娓呯悊宸ヤ綔
聽聽聽聽closesocket(sockSer);
聽聽聽聽WSACleanup();

}

銆TcpClient錛?br />
#include聽<Winsock2.h>
#include聽
<iostream>
#include聽
<string>
usingnamespace聽std;

void聽main()
{
聽聽聽聽
//鍔犺澆濂楁帴瀛楀簱
聽聽聽聽WORD聽wVersionRequested;
聽聽聽聽WSADATA聽wsaData;
聽聽聽聽
int聽err;

聽聽聽聽wVersionRequested聽
=聽MAKEWORD(聽1,聽1聽);

聽聽聽聽err聽
=聽WSAStartup(聽wVersionRequested,聽&wsaData聽);
聽聽聽聽
if聽(聽err聽!=0聽)聽{
聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽
return;
聽聽聽聽}

聽聽聽聽
if聽(聽LOBYTE(聽wsaData.wVersion聽)聽!=1||
聽聽聽聽聽聽聽聽HIBYTE(聽wsaData.wVersion聽)聽
!=1聽)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽Tell聽the聽user聽that聽we聽could聽not聽find聽a聽usable聽*/
聽聽聽聽聽聽聽聽聽聽聽聽
/*聽WinSock聽DLL.聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽*/
聽聽聽聽聽聽聽聽聽聽聽聽WSACleanup(聽);
聽聽聽聽聽聽聽聽聽聽聽聽
return;聽
聽聽聽聽}
聽聽聽聽
聽聽聽聽
//鍒涘緩濂楁帴瀛?/span>
聽聽聽聽SOCKET聽sockClient聽=聽socket(AF_INET,聽SOCK_STREAM,聽0);
聽聽聽聽
聽聽聽聽SOCKADDR_IN聽addrSer;
聽聽聽聽addrSer.sin_addr.S_un.S_addr聽聽
=聽inet_addr("127.0.0.1");
聽聽聽聽addrSer.sin_family聽
=聽AF_INET;
聽聽聽聽addrSer.sin_port聽
=聽htons(6000);

聽聽聽聽cout
<<"enter聽your聽message:聽";
聽聽聽聽
string聽sendBuf;
聽聽聽聽
while(cin>>sendBuf)
聽聽聽聽{
聽聽聽聽聽聽聽聽
if(sendBuf聽=="q"銆锝滐綔銆sendBuf == "Q")
聽聽聽聽聽聽聽聽聽聽聽聽
break;
聽聽聽聽聽聽聽聽
//榪炴帴鏈嶅姟鍣?/span>
聽聽聽聽聽聽聽聽connect(sockClient,聽(SOCKADDR*)&addrSer,聽sizeof(SOCKADDR));
聽聽聽聽聽聽聽聽send(sockClient,聽sendBuf.c_str(),聽sendBuf.length()
+1,聽0);
聽聽聽聽聽聽聽聽cout
<<"enter聽your聽message:聽";
聽聽聽聽}

聽聽聽聽
//娓呯悊宸ヤ綔
聽聽聽聽closesocket(sockClient);
聽聽聽聽WSACleanup();
}

鏈鍚庤繕瑕佹敞鎰忕殑灝辨槸錛?/b>鍦╒S涓嬬紪璇戞椂榪樿鍦ㄩ」鐩睘鎬?gt;閰嶇疆灞炴?gt;閾炬帴鍣?gt;鍛戒護(hù)琛岄噷鍔犲叆闄勫姞閫夐」ws2_32.lib
鍚﹀垯閾炬帴鐨勬椂鍊欐壘涓嶅埌涓巗ocket鐩稿叧鐨勫嚱鏁?/font>


]]>
WindowsAPI瀛︿範(fàn)絎旇浜?- 璧勬簮鍦╓indows緙栫▼涓殑搴旂敤http://www.shnenglu.com/sunshinealike/archive/2009/03/14/76539.htmlSunshine AlikeSunshine AlikeFri, 13 Mar 2009 16:24:00 GMThttp://www.shnenglu.com/sunshinealike/archive/2009/03/14/76539.htmlhttp://www.shnenglu.com/sunshinealike/comments/76539.htmlhttp://www.shnenglu.com/sunshinealike/archive/2009/03/14/76539.html#Feedback1http://www.shnenglu.com/sunshinealike/comments/commentRss/76539.htmlhttp://www.shnenglu.com/sunshinealike/services/trackbacks/76539.html闃呰鍏ㄦ枃

]]>
WindowsAPI瀛︿範(fàn)絎旇鍥?- 瀵歸敭鐩樺拰榧犳爣鐨勫搷搴?/title><link>http://www.shnenglu.com/sunshinealike/archive/2009/03/12/76346.html</link><dc:creator>Sunshine Alike</dc:creator><author>Sunshine Alike</author><pubDate>Thu, 12 Mar 2009 08:17:00 GMT</pubDate><guid>http://www.shnenglu.com/sunshinealike/archive/2009/03/12/76346.html</guid><wfw:comment>http://www.shnenglu.com/sunshinealike/comments/76346.html</wfw:comment><comments>http://www.shnenglu.com/sunshinealike/archive/2009/03/12/76346.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunshinealike/comments/commentRss/76346.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunshinealike/services/trackbacks/76346.html</trackback:ping><description><![CDATA[ <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 瀹嬩綋;">閿洏鍜岄紶鏍囧湪</span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">涓殑閲嶈鎬т笉蹇呭璇達(dá)紝鍦扮悆浜洪兘鐭ラ亾錛侀敭鐩樹笂姣忎竴涓湁鎰忎箟鐨勯敭閮藉搴旂潃涓涓敮涓鐨勬爣璇嗗鹼紝縐頒箣涓?b style="">鎵弿鐮?/b>銆備絾鏄繖縐嶆壂鎻忕爜鏄‖浠剁浉鍏崇殑錛屼負(fù)浜嗗疄鐜拌澶囨棤鍏蟲х殑瑕佹眰錛屽湪</span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">搴旂敤紼嬪簭涓紝浣跨敤鐨勫線寰鏄笌璁懼鏃犲叧鐨?b style="">铏氭嫙鐮?/b>銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 瀹嬩綋;">瀵歸敭鐩樻搷浣滅殑鍝嶅簲榪囩▼鍩烘湰濡備笅錛?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 瀹嬩綋;">鐢ㄦ埛鎸変笅涓涓敭鏃訛紝涓庨敭鐩橀┍鍔ㄧ▼搴忥紙</span> <span lang="EN-US">KEYBOARD.DRV</span> <span style="font-family: 瀹嬩綋;">錛夎繘琛屼腑鏂鐞嗗茍璋冪敤</span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">鐢ㄦ埛妯″潡錛?/span> <span lang="EN-US">USER.EXE</span> <span style="font-family: 瀹嬩綋;">錛変腑鐨勬湁鍏崇▼搴忔潵鐢熸垚閿洏娑堟伅錛岀劧鍚庢秷鎭鍙戦佸埌緋葷粺鐨勬秷鎭槦鍒椾腑鐢辯浉搴旂殑搴旂敤搴旂敤紼嬪簭榪涜澶勭悊銆傞紶鏍囩殑澶勭悊榪囩▼涓庨敭鐩樼被浼箋備絾鏄敞鎰忔棤璁烘槸榧犳爣榪樻槸閿洏鐨勬墍浜х敓鐨勬秷鎭粡榪囨搷浣滅郴緇熷鐞嗗悗閮藉彧浼?xì)琚彂閫佺粰鐗瑰畾鐨勭獥鍙o紝鍗沖叿鏈夆滆緭鍏ョ劍鐐光濈殑紿楀彛鏉ヨ繘琛屽鐞嗐?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p>聽</o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt;"> <span style="font-family: Wingdings;" lang="EN-US"> <span style="">聼<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽聽聽 </span></span> </span> <b style=""> <span style="font-family: 瀹嬩綋;">閿洏娑堟伅</span> <span lang="EN-US"> <br /> </span> </b> <span style="font-family: 瀹嬩綋;">閿洏娑堟伅閫氬父鍙垎涓烘寜閿秷鎭拰瀛楃娑堟伅涓ょ被錛岀敤鎴鋒寜涓嬫垨鏉懼紑涓涓敭鏃訛紝灝變駭鐢熶竴涓寜閿秷鎭紝褰撲竴涓寜閿粍鍚堜駭鐢熶簡涓涓彲浠ユ樉紺虹殑瀛楁潯鏃訛紝灝變駭鐢熶簡涓涓瓧絎︽秷鎭?/span> <b style=""> <span lang="EN-US"> <o:p> </o:p> </span> </b> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span style="font-family: 瀹嬩綋;">鎸夐敭娑堟伅涓鑸張鍙互鍒嗕負(fù)緋葷粺鎸夐敭鍜岄潪緋葷粺鎸夐敭銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span style="font-family: 瀹嬩綋;">緋葷粺鎸夐敭錛氭槸鎸囦嬌鐢ㄤ簡</span> <span lang="EN-US">Alt</span> <span style="font-family: 瀹嬩綋;">絳変笌鐩稿叧杈撳叆閿粍鎴愪駭鐢熺殑娑堟伅錛屼竴鑸繖浜涙秷鎭兘鐢辨搷浣滅郴緇熷唴閮ㄧ洿鎺ュ鐞嗐傚鏋滃簲鐢ㄧ▼搴忓鐞嗕簡榪欎簺緋葷粺閿秷鎭紝灝辮璋冪敤</span> <span lang="EN-US">DefWindowProc</span> <span style="font-family: 瀹嬩綋;">鍑芥暟錛屼互渚夸笉褰卞搷</span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">瀵瑰畠浠殑澶勭悊銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span style="font-family: 瀹嬩綋;">闈炵郴緇熸寜閿細(xì)瀵瑰簲浜庨偅浜涗笉浣跨敤緇勫悎閿殑鎸夐敭娑堟伅銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span lang="EN-US"> <o:p>聽</o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span style="font-family: 瀹嬩綋;">鍐嶅鎸夐敭娑堟伅鐨勪袱涓彉閲?/span> <span lang="EN-US">wParam</span> <span style="font-family: 瀹嬩綋;">鍜?/span> <span lang="EN-US">lParam</span> <span style="font-family: 瀹嬩綋;">鍋氫竴浜涜В閲婏細(xì)錛堝悕鍫傝繕鐪熶笉灝?/span> <span lang="EN-US">T_T</span> <span style="font-family: 瀹嬩綋;">錛?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽 </span></span> </span> <span lang="EN-US">wParam<br /></span> <span style="font-family: 瀹嬩綋;">鍖呭惈浜嗚瘑鍒寜涓嬮敭鐨勮櫄閿爜錛岃繖浜涚爜鏄敱緋葷粺瀹氫箟鐨勮澶囨棤鍏崇殑銆傚彲浠ュ湪</span> <span lang="EN-US">windows.h</span> <span style="font-family: 瀹嬩綋;">涓壘鍒版壘鍒扮浉鍏沖畾涔夈?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽 </span></span> </span> <span lang="EN-US">lParam<br />32</span> <span style="font-family: 瀹嬩綋;">浣嶇殑鍙橀噺</span> <span lang="EN-US">lParam</span> <span style="font-family: 瀹嬩綋;">鎵琛ㄧず鐨勫惈涔夊彲浠ュ垎涓轟互涓?/span> <span lang="EN-US">7</span> <span style="font-family: 瀹嬩綋;">涓儴鍒?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(1)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">閲嶅璁℃暟浣嶏紙</span> <span lang="EN-US">0~15</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> <span lang="EN-US"> <span style="">聽聽聽聽聽 </span> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: 21pt;"> <span style="font-family: 瀹嬩綋;">琛ㄧず褰撳墠娑堟伅鐨勯噸澶嶆鏁般?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(2)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span lang="EN-US">OEM</span> <span style="font-family: 瀹嬩綋;">鎵弿鐮侊紙</span> <span lang="EN-US">16~23</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: 21pt;"> <span lang="EN-US">OEM</span> <span style="font-family: 瀹嬩綋;">鎵弿鐮佹槸閿洏鍙戦佺殑鐮佸鹼紝鍥犱負(fù)鏄澶囩浉鍏崇殑甯竴鑸蹇界暐鎺夈?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(3)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鎵╁睍閿爣蹇楋紙</span> <span lang="EN-US">24</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: 21pt;"> <span style="font-family: 瀹嬩綋;">鍦ㄦ湁</span> <span lang="EN-US">Alt</span> <span style="font-family: 瀹嬩綋;">鎴?/span> <span lang="EN-US">Ctrl</span> <span style="font-family: 瀹嬩綋;">閿寜涓嬫椂涓?/span> <span lang="EN-US">1,</span> <span style="font-family: 瀹嬩綋;">鍚﹀垯涓?/span> <span lang="EN-US">0</span> <span style="font-family: 瀹嬩綋;">銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(4)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">淇濈暀浣嶏紙</span> <span lang="EN-US">25~28</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> <span lang="EN-US"> <span style="">聽聽聽聽聽聽聽聽聽聽 </span> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: 21pt;"> <span style="font-family: 瀹嬩綋;">緋葷粺淇濈暀錛屼竴鑸笉鐢ㄣ?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(5)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鍏寵仈鐮侊紙</span> <span lang="EN-US">29</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">涓昏鐢ㄦ潵璁板綍鏌愰敭涓?/span> <span lang="EN-US">Alt</span> <span style="font-family: 瀹嬩綋;">絳夐敭鐨勭粍鍚堢姸鎬侊紝鑻ユ寜涓?/span> <span lang="EN-US">Alt</span> <span style="font-family: 瀹嬩綋;">閿紝褰?/span> <span lang="EN-US">WM_SYSKEYDOWN</span> <span style="font-family: 瀹嬩綋;">娑堟伅鍙戦佸埌鏌愪釜嬋媧葷獥鍙f椂錛屽叾鍊間負(fù)</span> <span lang="EN-US">1,</span> <span style="font-family: 瀹嬩綋;">鍚﹀垯涓?/span> <span lang="EN-US">0</span> <span style="font-family: 瀹嬩綋;">銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(6)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">閿殑鍏堝墠鐘舵侊紙</span> <span lang="EN-US">30</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: 21pt;"> <span style="font-family: 瀹嬩綋;">鐢ㄤ簬璁板綍鍏堝墠鏌愰敭鐨勭姸鎬併?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(7)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">杞崲鐘舵侊紙</span> <span lang="EN-US">31</span> <span style="font-family: 瀹嬩綋;">浣嶏級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">鐢ㄤ簬璁板綍琚緇堟寜涓嬬殑鏌愰敭鎵浜х敓鐨勬秷鎭?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p>聽</o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span> </span> <span style="font-family: 瀹嬩綋;">鍦?/span> <span lang="EN-US">WinMain</span> <span style="font-family: 瀹嬩綋;">鍑芥暟閲岀殑娑堟伅寰幆涓寘鍚簡</span> <b style=""> <span lang="EN-US">TranslateMessage</span> </b> <span style="font-family: 瀹嬩綋;">鍑芥暟錛屽畠鐨勪富瑕佸姛鑳芥槸鎶婃寜閿秷鎭漿鍖栦負(fù)瀛楃娑堟伅錛屽嵆鎶婃寜閿墍浜х敓鐨勫師濮嬬殑KEYDOWN/KEYUP娑堟伅杞寲鎴怶M_CHAR娑堟伅銆?/span> <span lang="EN-US"> </span> <span style="font-family: 瀹嬩綋;"> </span> <span lang="EN-US"> <span style=""> </span> </span> <span style="font-family: 瀹嬩綋;"> </span> <span lang="EN-US"> </span> <span style="font-family: 瀹嬩綋;">鍚屾牱錛屽瓧絎︽秷鎭篃鍙互鍒嗕負(fù)緋葷粺鍜岄潪緋葷粺娑堟伅涓ょ被銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p>聽</o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span lang="EN-US">Windows</span> <span style="font-family: 瀹嬩綋;">緋葷粺鏀寔涓ょ被瀛楃闆嗭細(xì)</span> <span lang="EN-US">OEM</span> <span style="font-family: 瀹嬩綋;">鍜?/span> <span lang="EN-US">ANSI</span> <span style="font-family: 瀹嬩綋;">銆?/span> <span lang="EN-US">OEM</span> <span style="font-family: 瀹嬩綋;">鏄?/span> <span lang="EN-US">IBM</span> <span style="font-family: 瀹嬩綋;">鐨勫瓧絎﹂泦錛屽湪</span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">涓嬌鐢ㄤ笉澶氾紝鐩墠澶у浣跨敤鐨勬槸</span> <span lang="EN-US">ANSI</span> <span style="font-family: 瀹嬩綋;">瀛楃闆嗐?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span lang="EN-US"> <o:p>聽</o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt;"> <span style="font-family: Wingdings;" lang="EN-US"> <span style="">聼<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽聽聽 </span></span> </span> <b style=""> <span style="font-family: 瀹嬩綋;">榧犳爣娑堟伅</span> <span lang="EN-US"> <o:p> </o:p> </span> </b> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">榧犳爣鎿嶄綔</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">綆鍗曠殑鍗曞嚮鎿嶄綔鍖呭惈浜嗘寜涓嬪拰鏉懼紑榪欎竴鍏ㄨ繃紼嬶紱鑰屽弻鍑?yán)L搷浣滃疄闄呬笂鏄寚鐢ㄦ埛鍦ㄧ煡鏃墮棿鍐咃紙榛樿涓?/span> <span lang="EN-US">0.5</span> <span style="font-family: 瀹嬩綋;">縐掞級鐨勫啀嬈″崟鍑?yán)L搷浣溿?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">鍦ㄩ紶鏍囨秷鎭腑錛屽弬鏁?/span> <span lang="EN-US">lParam</span> <span style="font-family: 瀹嬩綋;">鍖呭惈浜嗛紶鏍囩殑浣嶇疆錛屼綆瀛楄妭鏄?/span> <span lang="EN-US">X</span> <span style="font-family: 瀹嬩綋;">鍧愭爣錛岄珮瀛楄妭鏄?/span> <span lang="EN-US">Y</span> <span style="font-family: 瀹嬩綋;">鍧愭爣銆傚弬鏁?/span> <span lang="EN-US">wParam</span> <span style="font-family: 瀹嬩綋;">鍒欏寘鍚簡涓涓寚紺哄悇縐嶈櫄閿姸鎬佺殑鍊箋?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">閫氳繃鐢ㄦ埛鍖烘秷鎭殑</span> <span lang="EN-US">wParam</span> <span style="font-family: 瀹嬩綋;">鍜?/span> <span lang="EN-US">lParam</span> <span style="font-family: 瀹嬩綋;">鍙傛暟錛岀▼搴忓憳灝卞彲浠ョ‘瀹氶紶鏍囩殑浣嶇疆鍜岀姸鎬併?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">瀵逛簬榧犳爣鐨勬秷鎭鐞嗭紝涓鑸垎涓轟袱縐嶏紝涓縐嶈瀵?/span> <span lang="EN-US">Ctrl</span> <span style="font-family: 瀹嬩綋;">絳夐敭榪涜鐩戣錛屽彟涓縐嶅垯涓嶉渶瑕併備笅闈㈡槸涓涓ず渚?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US">case WM_LbUTTONDWON:<span style="">聽聽聽聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">榧犳爣鎸変笅鏃?/span> <span lang="EN-US">ctrl</span> <span style="font-family: 瀹嬩綋;">鍜?/span> <span lang="EN-US">shift</span> <span style="font-family: 瀹嬩綋;">閮借鎸変笅</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>If(( wParam&MK_CONTROL) && ( wParam&MK_SHIFT) )</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>鈥?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>break;</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US">case WM_LBUTTONDOWN:<span style="">聽聽聽聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">涓嶇洃瑙嗙粍鍚堟寜閿?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>鈥?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>break;</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">姝ゅ錛岃浣跨獥鍙h兘鐩戣鍙屽嚮娑堟伅錛屽繀欏誨湪娉ㄥ唽紿楀彛綾葷殑鏃跺欎嬌璇ョ被鍏鋒湁</span> <span lang="EN-US">CS_DBLCLKS</span> <span style="font-family: 瀹嬩綋;">灞炴ф墠琛岋紝鍚﹀垯鍙兘鏀跺埌涓ゆ潯鍗曞嚮娑堟伅銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鍏夋爣</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">鍙互浣跨敤緋葷粺鍏夋爣鎴栬呰皟鐢?/span> <span lang="EN-US">LoadCursor</span> <span style="font-family: 瀹嬩綋;">鍔犺澆鑷畾涔夊厜鏍囪祫婧?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt;"> <span style="font-family: Wingdings;" lang="EN-US"> <span style="">聼<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">聽聽聽聽聽聽聽聽聽聽 </span></span> </span> <b style=""> <span style="font-family: 瀹嬩綋;">紺轟緥紼嬪簭</span> <span lang="EN-US"> <o:p> </o:p> </span> </b> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span style="font-family: 瀹嬩綋;">鍦ㄤ笅闈㈢殑涓涓緥瀛愪腑錛屾樉紺洪紶鏍囧拰閿洏鐨勬秷鎭搷搴斻傜▼搴忕殑鐢ㄦ埛鍖鴻鍒嗕負(fù)鍥涗釜鍖哄煙錛屾瘡涓尯鍩熼噷鍏夋爣璁劇疆鎴愪笉鍚岀殑鏍峰紡銆傞氳繃鐩戣閿洏鎸夐敭錛屽彲瀵逛竴涓?/span> <span lang="EN-US">10</span> <span style="font-family: 瀹嬩綋;">涓瓧絎﹂暱鐨勭紦鍐插尯閲岃緭鍏ュ瓧絎︼紝騫舵渶鍚庢樉紺哄湪榧犳爣涓婃柟錛岄紶鏍囩Щ鍔ㄦ椂鍚屾椂淇敼瀛楃杈撳嚭鐨勪綅緗傚彲浠ユ寜涓?/span> <span lang="EN-US">BACK</span> <span style="font-family: 瀹嬩綋;">閿垹鎺夊凡緇忚緭鍏ョ殑瀛楃錛岀紦鍐插尯婊℃椂鍐嶈緭鍏ュ拰絀虹殑鏃跺欏垹瀛楃鐨勬搷浣滈兘琚嫆緇濓紝騫剁敤娑堟伅妗嗚繘琛屾彁紺恒備唬鐮佸涓嬶細(xì)<br /></span> </p> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">瀹氫箟鐨勯潤鎬佸彉閲?/span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="color: rgb(0, 0, 255);">#define</span> <span style="color: rgb(0, 0, 0);">聽BufSize聽10</span> <span style="color: rgb(0, 0, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 255);">char</span> <span style="color: rgb(0, 0, 0);">聽lpszBuffer[BufSize];<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 255);">int</span> <span style="color: rgb(0, 0, 0);">聽nNumChar聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">0</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 255);">int</span> <span style="color: rgb(0, 0, 0);">聽i聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">0</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 0);">聽POINT聽pt;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽鈥︹?br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />LRESULT聽CALLBACK聽WndProc(HWND聽hWnd,聽UINT聽iMsg,聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽UINT聽wParam,聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽LONG聽lParam)<br /><img id="Codehighlighter1_215_1500_Open_Image" onclick="this.style.display='none'; Codehighlighter1_215_1500_Open_Text.style.display='none'; Codehighlighter1_215_1500_Closed_Image.style.display='inline'; Codehighlighter1_215_1500_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_215_1500_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_215_1500_Closed_Text.style.display='none'; Codehighlighter1_215_1500_Open_Image.style.display='inline'; Codehighlighter1_215_1500_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span id="Codehighlighter1_215_1500_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_215_1500_Open_Text"> <span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽HDC聽hdc;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽PAINTSTRUCT聽ps;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽HCURSOR聽hCur;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">switch</span> <span style="color: rgb(0, 0, 0);">(iMsg)<br /><img id="Codehighlighter1_274_1487_Open_Image" onclick="this.style.display='none'; Codehighlighter1_274_1487_Open_Text.style.display='none'; Codehighlighter1_274_1487_Closed_Image.style.display='inline'; Codehighlighter1_274_1487_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_274_1487_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_274_1487_Closed_Text.style.display='none'; Codehighlighter1_274_1487_Open_Image.style.display='inline'; Codehighlighter1_274_1487_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽</span> <span id="Codehighlighter1_274_1487_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_274_1487_Open_Text"> <span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">case</span> <span style="color: rgb(0, 0, 0);">聽WM_CHAR:</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">澶勭悊闈炵郴緇熼敭鐨勬秷鎭?/span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(wParam聽</span> <span style="color: rgb(0, 0, 0);">==</span> <span style="color: rgb(0, 0, 0);">聽VK_BACK)</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">鎸変笅閫鏍奸敭</span> <span style="color: rgb(0, 128, 0);"> <br /> <img id="Codehighlighter1_335_526_Open_Image" onclick="this.style.display='none'; Codehighlighter1_335_526_Open_Text.style.display='none'; Codehighlighter1_335_526_Closed_Image.style.display='inline'; Codehighlighter1_335_526_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_335_526_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_335_526_Closed_Text.style.display='none'; Codehighlighter1_335_526_Open_Image.style.display='inline'; Codehighlighter1_335_526_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽</span> <span id="Codehighlighter1_335_526_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_335_526_Open_Text"> <span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(nNumChar聽</span> <span style="color: rgb(0, 0, 0);">==</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">0</span> <span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_361_414_Open_Image" onclick="this.style.display='none'; Codehighlighter1_361_414_Open_Text.style.display='none'; Codehighlighter1_361_414_Closed_Image.style.display='inline'; Codehighlighter1_361_414_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_361_414_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_361_414_Closed_Text.style.display='none'; Codehighlighter1_361_414_Open_Image.style.display='inline'; Codehighlighter1_361_414_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span id="Codehighlighter1_361_414_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_361_414_Open_Text"> <span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽MessageBox(hWnd,聽</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);">娌℃湁瀛楃鍙互鍒犻櫎錛?/span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);">,聽NULL,聽MB_OK);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽}</span> </span> <span style="color: rgb(0, 0, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 0);"> <br /> <img id="Codehighlighter1_427_512_Open_Image" onclick="this.style.display='none'; Codehighlighter1_427_512_Open_Text.style.display='none'; Codehighlighter1_427_512_Closed_Image.style.display='inline'; Codehighlighter1_427_512_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_427_512_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_427_512_Closed_Text.style.display='none'; Codehighlighter1_427_512_Open_Image.style.display='inline'; Codehighlighter1_427_512_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span id="Codehighlighter1_427_512_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_427_512_Open_Text"> <span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 0);">--</span> <span style="color: rgb(0, 0, 0);">nNumChar;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">姝ゅ嚱鏁板埛鏂扮敤鎴峰尯錛屼細(xì)浜х敓PAINT娑堟伅</span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽InvalidateRect(hWnd,聽NULL,聽TRUE);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽}</span> </span> <span style="color: rgb(0, 0, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">break</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽聽聽聽}</span> </span> <span style="color: rgb(0, 0, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(nNumChar聽</span> <span style="color: rgb(0, 0, 0);">>=</span> <span style="color: rgb(0, 0, 0);">聽BufSize)</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">瀛楃瓚呰繃緙撳啿鍖哄ぇ灝?/span> <span style="color: rgb(0, 128, 0);"> <br /> <img id="Codehighlighter1_567_634_Open_Image" onclick="this.style.display='none'; Codehighlighter1_567_634_Open_Text.style.display='none'; Codehighlighter1_567_634_Closed_Image.style.display='inline'; Codehighlighter1_567_634_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_567_634_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_567_634_Closed_Text.style.display='none'; Codehighlighter1_567_634_Open_Image.style.display='inline'; Codehighlighter1_567_634_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽</span> <span id="Codehighlighter1_567_634_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_567_634_Open_Text"> <span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽MessageBox(hWnd,聽</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);">緙撳啿鍖哄凡婊★紒鍒犻櫎瀛楃璇風(fēng)敤閫鏍奸敭</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);">,聽NULL,聽MB_OK);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">break</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽聽聽聽}</span> </span> <span style="color: rgb(0, 0, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽lpszBuffer[nNumChar</span> <span style="color: rgb(0, 0, 0);">++</span> <span style="color: rgb(0, 0, 0);">]聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽(unsigned聽</span> <span style="color: rgb(0, 0, 255);">char</span> <span style="color: rgb(0, 0, 0);">)wParam;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽InvalidateRect(hWnd,聽NULL,聽TRUE);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">break</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">case</span> <span style="color: rgb(0, 0, 0);">聽WM_PAINT:</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">灝嗗鐞嗚繃鐨勫瓧絎﹁緭鍑?/span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽hdc聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽BeginPaint(hWnd,聽</span> <span style="color: rgb(0, 0, 0);">&</span> <span style="color: rgb(0, 0, 0);">ps);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">璋冩暣鍧愭爣浣垮瓧鍑虹幇鍦ㄩ紶鏍囦笂鏂?/span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽TextOut(hdc,聽pt.x</span> <span style="color: rgb(0, 0, 0);">-</span> <span style="color: rgb(0, 0, 0);">15</span> <span style="color: rgb(0, 0, 0);">,聽pt.y</span> <span style="color: rgb(0, 0, 0);">-</span> <span style="color: rgb(0, 0, 0);">15</span> <span style="color: rgb(0, 0, 0);">,聽lpszBuffer,聽nNumChar);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽EndPaint(hWnd,聽</span> <span style="color: rgb(0, 0, 0);">&</span> <span style="color: rgb(0, 0, 0);">ps);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">break</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">case</span> <span style="color: rgb(0, 0, 0);">聽WM_MOUSEMOVE:</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">縐誨姩榧犳爣鍚庢敼鍙樻枃鏈緭鍑哄潗鏍囧茍鍒鋒柊</span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽pt.x聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽LOWORD(lParam);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽pt.y聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽HIWORD(lParam);</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">榧犳爣鐨勫潗鏍?br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">鍦ㄤ笉鍚岀殑鍖哄煙鏄劇ず涓嶅悓鐨勫厜鏍?/span> <span style="color: rgb(0, 128, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(pt.x聽</span> <span style="color: rgb(0, 0, 0);"><</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">&&</span> <span style="color: rgb(0, 0, 0);">聽pt.y聽</span> <span style="color: rgb(0, 0, 0);"><</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽hCur聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽LoadCursor(NULL,聽IDC_NO);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(pt.x聽</span> <span style="color: rgb(0, 0, 0);">></span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">&&</span> <span style="color: rgb(0, 0, 0);">聽pt.y聽</span> <span style="color: rgb(0, 0, 0);"><</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽hCur聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽LoadCursor(NULL,聽IDC_HELP);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(pt.x聽</span> <span style="color: rgb(0, 0, 0);"><</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">&</span> <span style="color: rgb(0, 0, 0);">聽pt.y聽</span> <span style="color: rgb(0, 0, 0);">></span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽hCur聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽LoadCursor(NULL,聽IDC_SIZEALL);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">(pt.x聽</span> <span style="color: rgb(0, 0, 0);">></span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">&&</span> <span style="color: rgb(0, 0, 0);">聽pt.y聽</span> <span style="color: rgb(0, 0, 0);">></span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">400</span> <span style="color: rgb(0, 0, 0);">)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽hCur聽</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">聽LoadCursor(NULL,聽IDC_CROSS);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽SetCursor(hCur);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽InvalidateRect(hWnd,聽NULL,聽TRUE);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">break</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">case</span> <span style="color: rgb(0, 0, 0);">聽WM_DESTROY:<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽PostQuitMessage(</span> <span style="color: rgb(0, 0, 0);">0</span> <span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">0</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">default</span> <span style="color: rgb(0, 0, 0);">:<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">聽(DefWindowProc(hWnd,聽iMsg,聽wParam,聽lParam));<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽}</span> </span> <span style="color: rgb(0, 0, 0);"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">聽</span> <span style="color: rgb(0, 0, 0);">0</span> <span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> </div> <img src ="http://www.shnenglu.com/sunshinealike/aggbug/76346.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunshinealike/" target="_blank">Sunshine Alike</a> 2009-03-12 16:17 <a href="http://www.shnenglu.com/sunshinealike/archive/2009/03/12/76346.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>WindowsAPI瀛︿範(fàn)絎旇涓?- 瀛椾綋璁劇疆涓庤緭鍑?/title><link>http://www.shnenglu.com/sunshinealike/archive/2009/03/11/76242.html</link><dc:creator>Sunshine Alike</dc:creator><author>Sunshine Alike</author><pubDate>Wed, 11 Mar 2009 08:41:00 GMT</pubDate><guid>http://www.shnenglu.com/sunshinealike/archive/2009/03/11/76242.html</guid><description><![CDATA[ <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US">Windows</span> <span style="font-family: 瀹嬩綋;">緋葷粺涓粡甯鎬嬌鐢?/span> <span lang="EN-US">GDI</span> <span style="font-family: 瀹嬩綋;">榪涜鏂囨湰杈撳嚭錛屼粠鏌愮鎰忎箟涓婃潵璇達(dá)紝鍥懼艦鍜屾枃鏈茍娌℃湁鏈川涓婄殑鐣岄檺錛屽緢澶氭椂鍊?/span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">鎶婃枃鏈篃褰撲綔鍥懼艦瀵瑰緟銆傚湪</span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">緙栫▼涓紝鏂囨湰鎿嶄綔棣栧厛瑕佽幏寰楁枃鏈彞鏌勶紝姝ゅ錛岃繕瑕佽緗瓧浣擄紝瀛楃澶у皬錛屽瓧絎﹂鑹茬瓑鏈夊叧灞炴э紝騫跺皢瀹冧滑閫夊叆璁懼鐜銆?/span> <span lang="EN-US"> <br style="" /> <br style="" /> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt;"> <span style="font-family: Wingdings;" lang="EN-US"> <span style="">聼<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽 </span></span> </span> <b style=""> <span style="font-family: 瀹嬩綋;">璁劇疆鏂囨湰鐨勮澶囩幆澧?/span> <span lang="EN-US"> <o:p> </o:p> </span> </b> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鑷畾涔夊瓧浣?/span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">鍙互浣跨敤鍑芥暟</span> <span lang="EN-US">CreateFont</span> <span style="font-family: 瀹嬩綋;">鑷畾涔夊瓧浣?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US">HFONT hFont = HFONT CreateFont(</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>int nHeight,<span style="">聽 </span>int nWidth,<span style="">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">瀛椾綋楂橈紝瀹?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>int nEscapement,<span style="">聽聽聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">鏂囧瓧鐩稿浜庨〉搴曠殑瑙掑害</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>int nOrientation,<span style="">聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">姣忎釜鏂囧瓧鐩稿浜庨〉搴曠殑瑙掑害</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>int fnWeight,<span style="">聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">瀛椾綋綺楃粏錛岃寖鍥?/span> <span lang="EN-US">0~1000</span> <span style="font-family: 瀹嬩綋;">錛?/span> <span lang="EN-US">400</span> <span style="font-family: 瀹嬩綋;">涓烘甯稿瓧浣擄紝</span> <span lang="EN-US">700</span> <span style="font-family: 瀹嬩綋;">涓洪粦浣?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwItalic,<span style="">聽聽聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">鍙栭潪闆跺煎垯涓烘枩浣?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwUnderline,<span style="">聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">鍙栭潪闆跺煎垯涓嬪垝綰?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwStrikeOut,<span style="">聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">鍙栭潪闆跺煎垯涓垝綰?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwCharSet,<span style="">聽聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">瀛椾綋鎵灞炲瓧絎﹂泦</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwOutputPrecision,<span style="">聽 </span>// </span> <span style="font-family: 瀹嬩綋;">杈撳嚭綺懼害錛堜竴鑸彇榛樿鍊鹼級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwClipPrecision,<span style="">聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">鍓綺懼害錛堜竴鑸彇榛樿鍊鹼級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwQuality,<span style="">聽聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">杈撳嚭璐ㄩ噺錛堜竴鑸彇榛樿鍊鹼級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>DWORD fdwPitchAndFamily,<span style="">聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">瀛椾綋闂磋窛鍙?qiáng)瀛椾綋绯诲垪锛堜竴鑸彇榛樿鍊鹼級</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LPCTSTR lpszFace<span style="">聽聽聽聽聽聽聽聽聽聽 </span>// </span> <span style="font-family: 瀹嬩綋;">瀛椾綋鍚?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US">);<br /></span> <span style="font-family: 瀹嬩綋;">榪欎釜榪欎釜......浠ュ悗榪欐牱寤哄瓧浣撹繕涓嶇瘡姝繪墠鎬挧錛佽屼笖璨屼技</span> <span lang="EN-US">API</span> <span style="font-family: 瀹嬩綋;">閲屽甫榪欎箞澶氭伓蹇冨弬鏁扮殑鏂規(guī)硶榪樹笉灝戯紝浜嗚В涓涓嬪氨琛屼簡銆備竴鑸儏鍐典笅浣跨敤緋葷粺榛樿鎻愪緵鐨勫瓧浣撳氨鍙互浜嗐?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">瀛椾綋鍙ユ焺</span> <span lang="EN-US"> <br />windows</span> <span style="font-family: 瀹嬩綋;">緋葷粺鎻愪緵浜嗕竷縐嶅熀鏈瓧浣擄細(xì)</span> <span lang="EN-US"> <br />ANSI_FIXED_FONT</span> <span style="font-family: 瀹嬩綋;">錛?/span> <span lang="EN-US">DEFAULT_GUI_FONT</span> <span style="font-family: 瀹嬩綋;">錛?/span> <span lang="EN-US">ANSI_VAR_FONT<br />DEVICE_DEFAULT_FONT</span> <span style="font-family: 瀹嬩綋;">錛?/span> <span lang="EN-US">SYSTEM_FIXED_FONT</span> <span style="font-family: 瀹嬩綋;">錛?/span> <span lang="EN-US"> <br />SYSTEM_FONT</span> <span style="font-family: 瀹嬩綋;">錛堢郴緇熼粯璁ゅ瓧浣擄級</span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">璋冪敤鍑芥暟</span> <span lang="EN-US">GetStockObject</span> <span style="font-family: 瀹嬩綋;">錛堬級鍗沖彲鑾峰緱緋葷粺榛樿瀛椾綋</span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">鑾峰緱瀛椾綋涔嬪悗錛屾湁鏃跺欒繕闇瑕佽緗瓧浣撻鑹插拰鑳屾櫙鑹詫紝鍙互浣跨敤涓嬮潰涓や釜鍑芥暟錛?/span> <span lang="EN-US"> <br />SetTextColor<span style="">聽聽聽聽聽聽聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">璁劇疆瀛椾綋棰滆壊</span> <span lang="EN-US"> <br />SetBkColor<span style="">聽聽聽聽聽聽聽聽聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">璁劇疆鑳屾櫙棰滆壊</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span lang="EN-US"> <o:p>聽</o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt;"> <span style="font-family: Wingdings;" lang="EN-US"> <span style="">聼<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽 </span></span> </span> <b style=""> <span style="font-family: 瀹嬩綋;">鏂囨湰杈撳嚭榪囩▼</span> <span lang="EN-US"> <br /> </span> </b> <span style="font-family: 瀹嬩綋;">璁劇疆浜嗗瓧浣撳彞鏌勶紝瀛椾綋鍙?qiáng)瀛椾綋棰滆壊涔嬪悗灏卞彲浠ユ妸璁揪|瓧浣撹緭鍏ュ埌鐩稿簲鐨勮澶囦笂銆?/span> <span lang="EN-US">Windows</span> <span style="font-family: 瀹嬩綋;">緋葷粺鍦ㄦ枃鏈緭鍑轟笂鏈夌偣灝忓皬鐨勫伔鎳掞紝鎶婂緢澶氫簨鎯呴兘涓㈢粰浜嗙▼搴忓憳鏉ュ仛錛屽簲鐢ㄧ▼搴忓繀欏昏嚜宸辯鐞嗘崲琛岋紝鍚庣畫瀛楃鐨勪綅緗瓑杈撳嚭鏍煎紡銆傝櫧鎻愪緵浜嗙紪紼嬬殑鑷敱錛屼絾鏄▼搴忓憳鐨勫伐浣滈噺涔熷彉鐨勯潪甯稿ぇ銆?/span> <b style=""> <span lang="EN-US"> <o:p> </o:p> </span> </b> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt;"> <span style="font-family: 瀹嬩綋;">鏂囨湰杈撳嚭榪囩▼鍖呮嫭鑾峰彇瀛椾綋淇℃伅錛屾牸寮忓寲鏂囨湰錛岃皟鐢ㄥ嚱鏁拌緭鍑烘枃鏈瓑榪囩▼銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鑾峰彇瀛椾綋淇℃伅</span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">搴旂敤紼嬪簭鍦ㄨ緭鍑哄瓧浣撲箣鍓嶅繀欏誨厛鑾峰彇褰撳墠瀛椾綋鐨勬湁鍏充俊鎭紝鍦?/span> <span lang="EN-US">windows</span> <span style="font-family: 瀹嬩綋;">紼嬪簭涓氳繃璋冪敤</span> <span lang="EN-US">GetTextMetrics</span> <span style="font-family: 瀹嬩綋;">鍑芥暟鏉ヨ幏鍙栧綋鍓嶅瓧浣撶殑淇℃伅銆傚叾褰㈠紡涓猴細(xì)</span> <span lang="EN-US"> <br />GetTextMetrics(hdc, &tm);<span style="">聽聽聽聽聽聽聽聽聽 </span>//tm</span> <span style="font-family: 瀹嬩綋;">涓?/span> <span lang="EN-US">TEXTMETRIC</span> <span style="font-family: 瀹嬩綋;">緇撴瀯</span> <span lang="EN-US"> <br />TEXTMETRIC</span> <span style="font-family: 瀹嬩綋;">緇撴瀯涔熼潪甯稿鏉傦紝鍏剁粨鏋勫畾涔夊涓嬶細(xì)</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US">typedef struct tagTEXTMETRIC { </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmHeight; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmAscent; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmDescent; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmInternalLeading; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmExternalLeading; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmAveCharWidth; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmMaxCharWidth; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmWeight; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmOverhang; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmDigitizedAspectX; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>LONG tmDigitizedAspectY; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>TCHAR tmFirstChar; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>TCHAR tmLastChar; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>TCHAR tmDefaultChar; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>TCHAR tmBreakChar; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>BYTE tmItalic; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>BYTE tmUnderlined; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>BYTE tmStruckOut; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>BYTE tmPitchAndFamily; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽 </span>BYTE tmCharSet; </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US">} TEXTMETRIC, *PTEXTMETRIC;</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span style="font-family: 瀹嬩綋;">鍏蜂綋鍚勫睘鎬т笉瑙i噴錛岄渶瑕佹椂鍙互鏌ヨ</span> <span lang="EN-US">MSDN</span> <span style="font-family: 瀹嬩綋;">銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鏍煎紡鍖栨枃鏈?/span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">鏍煎紡鍖栧鐞嗕竴鑸拡瀵逛袱縐嶆儏鍐碉紝涓鏄枃鏈涓‘瀹氬悗緇枃鏈殑鍧愭爣錛屼簩鏄湪鎹㈣鏃剁‘瀹氫笅涓琛岀殑鍧愭爣銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(1)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">紜畾鍚庣畫鏂囨湰鍧愭爣</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span style="font-family: 瀹嬩綋;">搴斿厛鑾峰彇褰撳墠瀛楃鐨勫搴︼紝閫氳繃璁$畻瀛楃涓茶搗濮嬪潗鏍囦笌瀛楃涓插搴︿箣鍜屽嵆鍙緱鍒板悗緇枃鏈殑璧峰鍧愭爣銆?/span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">榪欓噷瑕佷嬌鐢ㄥ埌鍑芥暟錛?/span> <span lang="EN-US"> <br />BOOL GetTextExtentPoint32</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US">(</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>HDC hdc,</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>LPCTSTR lpsxString,<span style="">聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">鎸囧畾鐨勫瓧絎︿覆</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>int nLength,<span style="">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">瀛楃涓蹭腑瀛楃鏁?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>LPSIZE lpSize<span style="">聽聽聽聽聽聽聽 </span>//</span> <span style="font-family: 瀹嬩綋;">瀛楃涓插搴﹀強(qiáng)楂樺害鐨?/span> <span lang="EN-US">SIZE</span> <span style="font-family: 瀹嬩綋;">鏁版嵁緇撴瀯</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt;"> <span lang="EN-US">)</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 63pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">(2)<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">紜畾鎹㈣鏃舵枃鏈潗鏍?/span> <span lang="EN-US"> <br /> </span> <span style="font-family: 瀹嬩綋;">閫氳繃璁$畻褰撳墠鏂囨湰琛屽瓧絎︾殑楂樺害涓庤闂撮殧涔嬪拰錛屽嵆鍙緱鍒版崲琛屾椂鏂囨湰鐨勮搗濮嬪潗鏍囷紝鑰屼笂榪頒袱涓暟鍊煎潎鍙氳繃鑾峰彇褰撳墠瀛椾綋淇℃伅寰楀埌銆?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt;"> <span style="" lang="EN-US"> <span style="">3.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽 </span></span> </span> <span style="font-family: 瀹嬩綋;">鏂囨湰杈撳嚭</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span style="font-family: 瀹嬩綋;">鏈甯哥敤鐨勬枃鏈緭鍑哄嚱鏁板氨鏄?/span> <span lang="EN-US">TextOut</span> <span style="font-family: 瀹嬩綋;">錛屽叾鍘熷瀷濡備笅錛?/span> <span lang="EN-US"> <br />BOOL TextOut</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US">(</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>HDC hdc,</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>int x, int y,</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>LPCTSTR lpString,</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt;"> <span lang="EN-US"> <span style="">聽聽聽聽聽聽 </span>int nCount</span> </p>聽聽聽聽聽聽 )<br /><br /><br /><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CAtlas%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C03%5Cclip_filelist.xml" /><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGridVerticalSpacing>7.8 紓?/w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><style><!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:瀹嬩綋; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\@瀹嬩綋"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:瀹嬩綋; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:370768441; mso-list-type:hybrid; mso-list-template-ids:-520222266 1657045614 67698703 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:飩? mso-level-tab-stop:21.0pt; mso-level-number-position:left; margin-left:21.0pt; text-indent:-21.0pt; font-family:Wingdings;} @list l0:level2 {mso-level-tab-stop:21.0pt; mso-level-number-position:left; margin-left:21.0pt; text-indent:-21.0pt;} @list l0:level3 {mso-level-number-format:bullet; mso-level-text:飦? mso-level-tab-stop:42.0pt; mso-level-number-position:left; margin-left:42.0pt; text-indent:-21.0pt; font-family:Wingdings;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} --></style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:鏅氳〃鏍? mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><p class="MsoNormal" style="margin-left: 21pt; text-indent: -21pt;"><!--[if !supportLists]--><span style="font-family: Wingdings;" lang="EN-US"><span style="">聼<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">聽聽聽聽聽聽聽聽聽聽 </span></span></span><!--[endif]--><b style=""><span style="font-family: 瀹嬩綋;">鏂囨湰鎿嶄綔瀹炰緥</span><span lang="EN-US"><o:p></o:p></span></b></p><p class="MsoNormal" style="margin-left: 21pt;"><span style="font-family: 瀹嬩綋;">鍥犱負(fù)浠g爜澶暱錛屽叏閮ㄨ創(chuàng)鍑烘潵欏甸潰涓嶅ソ鐪嬨傛晠鍙粰鍑?/span><b style=""><span lang="EN-US">WndProc</span></b><span style="font-family: 瀹嬩綋;">鍑芥暟鐨勫疄鐜幫紝紼嬪簭鍏跺畠閮ㄥ垎鍙互鍙傝冧互鍓嶇殑絎旇銆?/span></p><p class="MsoNormal" style="margin-left: 21pt;"><span style="font-family: 瀹嬩綋;"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">LRESULT聽CALLBACK聽WndProc(HWND聽hWnd,聽UINT聽iMsg,聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽UINT聽wParam,聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽LONG聽lParam)<br />{<br />聽聽聽聽HDC聽hdc;<br />聽聽聽聽HFONT聽hFont;聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛椾綋鍙ユ焺</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽PAINTSTRUCT聽ps;<br />聽聽聽聽TEXTMETRIC聽tm;<br /><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽lpszTx1[]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">綰㈣壊鐨凷YSTEM瀛椾綋錛氬ソ濂藉涔?fàn)锛屽ぉ澶╁悜涓婂Q?/span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽lpszTx2[]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">緇胯壊鑷畾涔夊瓧浣擄細(xì)淇濇姢鐪肩潧錛屾敞鎰忎紤鎭紒</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽lpszTx3[]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">钃濊壊澶у彿鏂滀綋騫跺甫鏈変笅鍒掔嚎錛?/span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽lpszTx4[]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">涓よ鏂囨湰杈撳嚭鍒板悓涓琛岄噷錛?/span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽lpszTx5[]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">浠婂ぉ鐨勫涔?fàn)灏卞埌杩欓噷锛尲湞浣犳垚鍔熷Q?/span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽x聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽SIZE聽size;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">switch</span><span style="color: rgb(0, 0, 0);">(iMsg)<br />聽聽聽聽{<br /><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);">聽WM_PAINT:<br />聽聽聽聽聽聽聽聽聽聽聽聽hdc聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽BeginPaint(hWnd,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">ps);<br /><br />聽聽聽聽聽聽聽聽聽聽聽聽SetTextColor(hdc,聽RGB(</span><span style="color: rgb(0, 0, 0);">255</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏂囨湰涓虹孩鑹?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽TextOut(hdc,聽x,聽y,聽lpszTx1,聽strlen(lpszTx1));</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛椾綋杈撳嚭</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽GetTextMetrics(hdc,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">tm);聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鑾峰彇緋葷粺褰撳墠瀛椾綋</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽y聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽tm.tmHeight聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽tm.tmExternalLeading;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璁$畻涓嬩竴琛屽潗鏍?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽hFont聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽CreateFont<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽(<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">20</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">楂樺害20,聽瀹藉彇0琛ㄧず鐢辯郴緇熼夋嫨鏈浣?jīng)_?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏂囨湰鍊炬枩錛屼笌瀛椾綋鍊炬枩閮戒負(fù)0</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽FW_HEAVY,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">綺椾綋</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">闈炴枩浣擄紝鏃犱笅鍒掔嚎錛屾棤涓垝綰?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽GB2312_CHARSET,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛楃闆?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽OUT_DEFAULT_PRECIS,聽聽聽聽聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽CLIP_DEFAULT_PRECIS,聽聽聽聽聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽DEFAULT_QUALITY,聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">涓緋誨垪鐨勯粯璁ゅ?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽DEFAULT_PITCH聽</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">聽FF_DONTCARE,聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">鑷畾涔夊瓧浣?/span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛椾綋鍚嶇О</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽);<br />聽聽聽聽聽聽聽聽聽聽聽聽SetTextColor(hdc,聽RGB(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">255</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽SelectObject(hdc,聽hFont);<br />聽聽聽聽聽聽聽聽聽聽聽聽TextOut(hdc,聽x,聽y,聽lpszTx2,聽strlen(lpszTx2));<br /><br />聽聽聽聽聽聽聽聽聽聽聽聽GetTextMetrics(hdc,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">tm);聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">灝嗗綋鍓嶅瓧浣撲俊鎭夊叆tm緇撴瀯涓?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽y聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽tm.tmHeight聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">15</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽tm.tmExternalLeading;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">5鍊嶈闂磋窛</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽hFont聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽CreateFont<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽(<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">40</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">楂樺害40,聽瀹藉彇0琛ㄧず鐢辯郴緇熼夋嫨鏈浣?jīng)_?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏂囨湰鍊炬枩錛屼笌瀛椾綋鍊炬枩閮戒負(fù)0</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽FW_NORMAL,聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏂滀綋錛屼笅鍒掔嚎錛屾棤涓垝綰?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽GB2312_CHARSET,聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛楃闆?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽OUT_DEFAULT_PRECIS,聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽CLIP_DEFAULT_PRECIS,聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽DEFAULT_QUALITY,聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">涓緋誨垪鐨勯粯璁ゅ?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽DEFAULT_PITCH聽</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">聽FF_DONTCARE,聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">澶у彿瀛椾綋</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛椾綋鍚嶇О</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽);<br />聽聽聽聽聽聽聽聽聽聽聽聽SetTextColor(hdc,聽RGB(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">255</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽SetBkColor(hdc,聽RGB(</span><span style="color: rgb(0, 0, 0);">160</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">160</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">160</span><span style="color: rgb(0, 0, 0);">));</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璁劇疆鑳屾櫙棰滆壊</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽SelectObject(hdc,聽hFont);<br />聽聽聽聽聽聽聽聽聽聽聽聽TextOut(hdc,聽x,聽y,聽lpszTx3,聽strlen(lpszTx3));<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鑾峰彇緋葷粺鎻愪緵鐨勫瓧浣?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽hFont聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(HFONT)GetStockObject(SYSTEM_FIXED_FONT);<br />聽聽聽聽聽聽聽聽聽聽聽聽y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽y聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽tm.tmHeight聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">25</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽tm.tmExternalLeading;<br />聽聽聽聽聽聽聽聽聽聽聽聽SetTextColor(hdc,聽RGB(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽SetBkColor(hdc,聽RGB(</span><span style="color: rgb(0, 0, 0);">255</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">255</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">255</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽SelectObject(hdc,聽hFont);<br />聽聽聽聽聽聽聽聽聽聽聽聽TextOut(hdc,聽x,聽y,聽lpszTx4,聽strlen(lpszTx4));<br />聽聽聽聽聽聽聽聽聽聽聽聽GetTextExtentPoint32(hdc,聽lpszTx4,聽strlen(lpszTx4),聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">size);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璁$畻楂樺</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽x聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽x聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽size.cx;<br />聽聽聽聽聽聽聽聽聽聽聽聽TextOut(hdc,聽x聽,聽y聽,lpszTx5,聽strlen(lpszTx5));<br /><br />聽聽聽聽聽聽聽聽聽聽聽聽EndPaint(hWnd,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">ps);<br />聽聽聽聽聽聽聽聽聽聽聽聽DeleteObject(hFont);<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);">聽WM_DESTROY:<br />聽聽聽聽聽聽聽聽PostQuitMessage(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">default</span><span style="color: rgb(0, 0, 0);">:<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽DefWindowProc(hWnd,聽iMsg,聽wParam,聽lParam);<br />聽聽聽聽}<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br />}</span></div><br /></span></p><br /><img src ="http://www.shnenglu.com/sunshinealike/aggbug/76242.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunshinealike/" target="_blank">Sunshine Alike</a> 2009-03-11 16:41 <a href="http://www.shnenglu.com/sunshinealike/archive/2009/03/11/76242.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>WindowsAPI瀛︿範(fàn)絎旇浜?- 鍥懼艦璁懼鎺ュ彛鍙?qiáng)windows緇樺浘http://www.shnenglu.com/sunshinealike/archive/2009/03/10/76148.htmlSunshine AlikeSunshine AlikeTue, 10 Mar 2009 13:09:00 GMThttp://www.shnenglu.com/sunshinealike/archive/2009/03/10/76148.htmlhttp://www.shnenglu.com/sunshinealike/comments/76148.htmlhttp://www.shnenglu.com/sunshinealike/archive/2009/03/10/76148.html#Feedback0http://www.shnenglu.com/sunshinealike/comments/commentRss/76148.htmlhttp://www.shnenglu.com/sunshinealike/services/trackbacks/76148.html闃呰鍏ㄦ枃

]]>
WindowsAPI瀛︿範(fàn)絎旇涓 - Windows搴旂敤紼嬪簭鍩烘湰緇撴瀯http://www.shnenglu.com/sunshinealike/archive/2009/03/10/76050.htmlSunshine AlikeSunshine AlikeTue, 10 Mar 2009 04:42:00 GMThttp://www.shnenglu.com/sunshinealike/archive/2009/03/10/76050.htmlhttp://www.shnenglu.com/sunshinealike/comments/76050.htmlhttp://www.shnenglu.com/sunshinealike/archive/2009/03/10/76050.html#Feedback6http://www.shnenglu.com/sunshinealike/comments/commentRss/76050.htmlhttp://www.shnenglu.com/sunshinealike/services/trackbacks/76050.html闃呰鍏ㄦ枃

]]>
久久中文字幕精品| 久久精品国产WWW456C0M| 麻豆一区二区99久久久久| 97久久香蕉国产线看观看| 久久99精品久久久久久不卡| 狠狠色丁香久久婷婷综合蜜芽五月 | 精品久久久久久亚洲精品 | 国产精品久久久久久久| 久久久噜噜噜久久中文字幕色伊伊| 久久精品国产亚洲AV久| 久久国产精品无码网站| 久久久久亚洲AV无码麻豆| 亚洲国产综合久久天堂| 99久久精品国产一区二区| 久久精品人人做人人爽97| 久久大香萑太香蕉av| 久久久国产精品| 狠狠色丁香婷综合久久| 亚洲国产精品成人久久| 伊人久久无码精品中文字幕| 94久久国产乱子伦精品免费| 99久久精品午夜一区二区| 亚洲精品无码久久久久| 久久久午夜精品| 伊人精品久久久久7777| 欧美日韩成人精品久久久免费看| 亚洲天堂久久精品| 91精品免费久久久久久久久| 久久不射电影网| 亚洲精品高清久久| 99热成人精品免费久久| 久久电影网一区| 国产69精品久久久久99| 国产99久久久久久免费看| 精品久久久久久久久久久久久久久| 国产91色综合久久免费| 热久久国产精品| 国内精品伊人久久久久影院对白| 国产精品青草久久久久福利99| 久久精品亚洲福利| 亚洲精品午夜国产va久久|