qidong.cpp

来自「可以实现」· C++ 代码 · 共 70 行

CPP
70
字号
// qidong.cpp : implementation file
//

#include "stdafx.h"
#include "df.h"
#include "qidong.h"

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

/////////////////////////////////////////////////////////////////////////////
// Cqidong dialog


Cqidong::Cqidong(CWnd* pParent /*=NULL*/)
	: CDialog(Cqidong::IDD, pParent)
{
	//{{AFX_DATA_INIT(Cqidong)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_hIcon=AfxGetApp()->LoadCursor(IDR_MAINFRAME);
	m_hPro=NULL;
}


void Cqidong::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Cqidong)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Cqidong, CDialog)
	//{{AFX_MSG_MAP(Cqidong)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Cqidong message handlers

void Cqidong::OnButton1() 
{PROCESS_INFORMATION pi;
STARTUPINFO si;
memset(&si,0,sizeof(si)); 
si.cb=sizeof(si);
si.wShowWindow=SW_SHOW;
si.dwFlags=STARTF_USESHOWWINDOW;
BOOL fRct=CreateProcess(NULL,"mspaint.exe",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
						 NULL,NULL,&si,&pi);
AfxMessageBox("成功建立");
m_hPro=pi.hProcess;
	// TODO: Add your control notification handler code here
	
}

void Cqidong::OnButton2() 
{TerminateProcess(m_hPro,0);
m_hPro=NULL;

	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

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