資源簡介
使用C++寫的五子棋代碼,可以實現人機對弈和人人對弈,實現了禁手

代碼片段和文件信息
//?About.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“ms5.h“
#include?“About.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CAbout?dialog
CAbout::CAbout(CWnd*?pParent?/*=NULL*/)
:?CDialog(CAbout::IDD?pParent)
{
//{{AFX_DATA_INIT(CAbout)
//?NOTE:?the?ClassWizard?will?add?member?initialization?here
//}}AFX_DATA_INIT
isIn?=?false;
}
void?CAbout::DoDataExchange(CDataExchange*?pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAbout)
//?NOTE:?the?ClassWizard?will?add?DDX?and?DDV?calls?here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAbout?CDialog)
//{{AFX_MSG_MAP(CAbout)
ON_WM_LBUTTONDOWN()
ON_WM_CTLCOLOR()
ON_WM_SETCURSOR()
ON_WM_MOUSEMOVE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CAbout?message?handlers
BOOL?CAbout::OnInitDialog()?
{
CDialog::OnInitDialog();
int?ij;
CClientDC?dc(this);
CBitmap?bmp;CDC?dcmem;BITMAP?bm;
bmp.LoadBitmap(“bk“);
m_brush?=?CreatePatternBrush((HBITMAP)bmp);
Getobject(bmpsizeof(BITMAP)(LPVOID)&bm);
dcmem.CreateCompatibleDC(&dc);
dcmem.Selectobject(&bmp);
dc.BitBlt(00bm.bmWidthbm.bmHeight&dcmem00SRCCOPY);
CRgn?myrgntemprgn;
myrgn.CreateRectRgn(00bm.bmWidthbm.bmHeight);
COLORREF?color=dcmem.GetPixel(00);
for(i=0;i for(j=0;j {
if?(dcmem.GetPixel(ij)==color)
{
temprgn.CreateRectRgn(iji+1j+1);
myrgn.CombineRgn(&myrgn&temprgnRGN_XOR);
temprgn.Deleteobject();
}
}
SetWindowRgn(myrgnTRUE);
bmp.Deleteobject();
return?TRUE;??//?return?TRUE?unless?you?set?the?focus?to?a?control
//?EXCEPTION:?OCX?Property?Pages?should?return?FALSE
}
void?CAbout::OnLButtonDown(UINT?nFlags?CPoint?point)?
{
SendMessage(WM_SYSCOMMAND0xf0120);
CRect?mailrect;
CWnd?*pStatic=GetDlgItem(IDC_MAILSTATIC);
pStatic->GetWindowRect?(mailrect);
ScreenToClient(mailrect);
if?(mailrect.PtInRect(point))
{
ShellExecute(m_hWndNULL“mailto:zhangpo03@mails.tsinghua.edu.cn“NULLNULLSW_SHOWMAXIMIZED);
}
CDialog::OnLButtonDown(nFlags?point);
}
HBRUSH?CAbout::OnCtlColor(CDC*?pDC?CWnd*?pWnd?UINT?nCtlColor)?
{
HBRUSH?hbr?=?CDialog::OnCtlColor(pDC?pWnd?nCtlColor);
if?(nCtlColor==CTLCOLOR_DLG)
return?m_brush;
if?(nCtlColor==CTLCOLOR_STATIC)?
{
if?(!pWnd->IsKindOf(?RUNTIME_CLASS(?CEdit?)))
{
pDC->SetBkMode(TRANSPARENT);
return?m_brush;
}
}
return?hbr;
}
BOOL?CAbout::OnSetCursor(CWnd*?pWnd?UINT?nHitTest?UINT?message)?
{
CRect?rcButton;
CPoint?ptCursor;
CWnd?*pStatic=GetDlgItem(IDC_MAILSTATIC);
pStatic->GetWindowRect?(rcButton);
GetCursorPos(&ptCursor);
if?(rcButton.PtInRect?(ptCursor))
{
CWinApp?*pApp=AfxGetApp();
HICON?hIconBang=pApp->Loa
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2005-03-10?08:00??五子棋源代碼1\
?????目錄???????????0??2004-11-14?14:53??五子棋源代碼1\www.cnzz.cn\
?????目錄???????????0??2004-03-30?16:34??五子棋源代碼1\www.cnzz.cn\res\
?????文件???????62432??2004-02-01?12:14??五子棋源代碼1\www.cnzz.cn\res\1.bmp
?????文件???????83972??2004-02-01?12:43??五子棋源代碼1\www.cnzz.cn\res\2.bmp
?????文件???????73390??2004-02-01?15:06??五子棋源代碼1\www.cnzz.cn\res\3.bmp
?????文件???????93752??2004-02-01?16:00??五子棋源代碼1\www.cnzz.cn\res\4.bmp
?????文件???????74628??2004-02-01?16:29??五子棋源代碼1\www.cnzz.cn\res\5.bmp
?????文件??????133256??2004-01-27?13:27??五子棋源代碼1\www.cnzz.cn\res\bk.bmp
?????文件???????25974??2004-01-17?21:12??五子棋源代碼1\www.cnzz.cn\res\ButtonsWin3000.bmp
?????文件????????1194??2004-01-20?11:38??五子棋源代碼1\www.cnzz.cn\res\darkstone.bmp
?????文件????????1194??2004-01-20?11:37??五子棋源代碼1\www.cnzz.cn\res\gray1.bmp
?????文件????????1194??2004-01-20?11:35??五子棋源代碼1\www.cnzz.cn\res\gray2.bmp
?????文件?????????326??2004-02-08?20:20??五子棋源代碼1\www.cnzz.cn\res\Hand.cur
?????文件???????19015??2004-01-26?11:50??五子棋源代碼1\www.cnzz.cn\res\lose.wav
?????文件??????746120??2004-02-01?13:17??五子棋源代碼1\www.cnzz.cn\res\ms5.bmp
?????文件?????????766??2003-12-22?13:14??五子棋源代碼1\www.cnzz.cn\res\ms5.ico
?????文件?????1295674??2004-02-01?16:27??五子棋源代碼1\www.cnzz.cn\res\ms5.psd
?????文件?????????395??2003-12-22?13:12??五子棋源代碼1\www.cnzz.cn\res\ms5.rc2
?????文件???????31122??2004-01-26?11:51??五子棋源代碼1\www.cnzz.cn\res\newgame.wav
?????文件?????????926??2004-01-26?11:44??五子棋源代碼1\www.cnzz.cn\res\put.wav
?????文件????????9996??2004-01-26?11:48??五子棋源代碼1\www.cnzz.cn\res\regret.wav
?????文件???????88064??2004-02-04?15:54??五子棋源代碼1\www.cnzz.cn\res\score.m
?????文件????????1194??2004-01-20?11:37??五子棋源代碼1\www.cnzz.cn\res\whitestone.bmp
?????文件???????22781??2004-01-26?11:52??五子棋源代碼1\www.cnzz.cn\res\win.wav
?????文件????????4556??2004-02-08?20:58??五子棋源代碼1\www.cnzz.cn\About.cpp
?????文件????????1494??2004-02-08?20:53??五子棋源代碼1\www.cnzz.cn\About.h
?????文件????????7542??2000-05-22?10:57??五子棋源代碼1\www.cnzz.cn\AutoFont.cpp
?????文件????????2340??1999-11-30?08:48??五子棋源代碼1\www.cnzz.cn\AutoFont.h
?????文件????????3703??2004-01-27?13:55??五子棋源代碼1\www.cnzz.cn\CVSCDlg.cpp
?????文件????????1642??2004-01-27?13:55??五子棋源代碼1\www.cnzz.cn\CVSCDlg.h
............此處省略25個文件信息
評論
共有 條評論