⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setmap.cpp

📁 vc写的小游戏
💻 CPP
字号:
// setmap.cpp : implementation file
//

#include "stdafx.h"
#include "快一点.h"
#include "setmap.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CString getdir;
extern CString getfile;
/////////////////////////////////////////////////////////////////////////////
// setmap dialog


setmap::setmap(CWnd* pParent /*=NULL*/)
	: CDialog(setmap::IDD, pParent)
{
	//{{AFX_DATA_INIT(setmap)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void setmap::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(setmap)
	DDX_Control(pDX, IDC_COMBO1, m_list);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(setmap, CDialog)
	//{{AFX_MSG_MAP(setmap)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// setmap message handlers

void setmap::OnCancel() 
{	getdir="";
	CDialog::OnCancel();
}

void setmap::OnOK() 
{	GetDlgItemText(IDC_COMBO1, getfile);
	CDialog::OnOK();
}

BOOL setmap::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	char appdir[256];
	GetCurrentDirectory(256,appdir);
		 CString cc;
		 cc=appdir;
		 if(cc.Right(8)=="运行程序")
			cc="地图";
		 else	
		 cc="../运行程序/地图";
	getdir.Format("%s",cc);
	findfile0(getdir,"*.dat");
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int setmap::findfile0(CString DirName,CString ext)
{	WIN32_FIND_DATA	FindFileData;
	HANDLE hFindFile;
	SetCurrentDirectory(DirName);
	m_list.ResetContent();
	hFindFile=FindFirstFile(ext,&FindFileData);
	CString tFile;
	int p=0;
	if (hFindFile!=INVALID_HANDLE_VALUE)
	{	do	{tFile=FindFileData.cFileName;
			 if ((tFile==".")||(tFile=="..")) continue;
			 if (!(FindFileData.dwFileAttributes==FILE_ATTRIBUTE_DIRECTORY))
				{	m_list.AddString(tFile);
					p++;
				}
			}
		while (FindNextFile(hFindFile,&FindFileData));
	}
	FindClose(hFindFile);
	return p;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -