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

📄 demodlg.cpp

📁 ASP切分器
💻 CPP
字号:
/********************************************************************/
/*																	*/
/*  DemoDlg.cpp														*/
/*																	*/
/*  Implementation of the CDemoDlg class.							*/
/*																	*/
/*  Programmed by Pablo van der Meer								*/
/*	http://www.pablovandermeer.nl									*/
/*																	*/
/*  Last updated: 22 february 2003									*/
/*																	*/
/********************************************************************/


#include "stdafx.h"
#include "Demo.h"
#include "DemoDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


CDemoDlg::CDemoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDemoDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDemoDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CDemoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDemoDlg)
	DDX_Control(pDX, IDC_INPUT, m_editInput);
	DDX_Control(pDX, IDC_OUTPUT, m_editOutput);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDemoDlg, CDialog)
	//{{AFX_MSG_MAP(CDemoDlg)
	ON_BN_CLICKED(IDC_RUN, OnRun)
	ON_BN_CLICKED(IDC_CLEAR, OnClear)
	ON_BN_CLICKED(IDC_VIEW, OnView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/********************************************************************/
/*																	*/
/* Function name : OnInitDialog										*/
/* Description   : Initialize dialog.								*/
/*																	*/
/********************************************************************/
BOOL CDemoDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}


/********************************************************************/
/*																	*/
/* Function name : OnRun											*/
/* Description   : Execute ASP script.								*/
/*																	*/
/********************************************************************/
void CDemoDlg::OnRun() 
{
	// Get script code...
	CString strText;
	m_editInput.GetWindowText(strText);

	// TODO: Add extra initialization here
	if (m_AspParser.Initialize())
	{
		if (m_AspParser.Execute(strText))
		{
			CString strText;
			m_AspParser.GetResponseBuffer(strText);
			m_editOutput.SetWindowText(strText);
		}
		m_AspParser.CleanUp();
	}
}


/********************************************************************/
/*																	*/
/* Function name : OnClear											*/
/* Description   : Clear input and output fields					*/
/*																	*/
/********************************************************************/
void CDemoDlg::OnClear() 
{
	m_editInput.SetWindowText("");
	m_editOutput.SetWindowText("");
}


/********************************************************************/
/*																	*/
/* Function name : OnView											*/
/* Description   : View output in default browser					*/
/*																	*/
/********************************************************************/
void CDemoDlg::OnView() 
{
	char szTempPath[MAX_PATH];
	GetTempPath(sizeof(szTempPath), szTempPath);

	CString strFileName;
	strFileName.Format("%s\\asp_test.html", szTempPath);

	CString strText;
	
	m_editOutput.GetWindowText(strText);
	
	try
	{
		CFile outputFile(strFileName, CFile::modeCreate | CFile::modeWrite);
		outputFile.Write(strText, strText.GetLength());
		outputFile.Close();
	}
	catch(CFileException *ex)
	{
		ex->Delete();
	}
	ShellExecute(0, "open", strFileName, 0, 0, SW_SHOWNORMAL);
}

⌨️ 快捷键说明

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