errorlog.cpp

来自「一个pmfix程序」· C++ 代码 · 共 87 行

CPP
87
字号
// ErrorLog.cpp : implementation file
//

#include "stdafx.h"
#include "win32.h"
#include "ErrorLog.h"
#include "pmfix.h"

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

/////////////////////////////////////////////////////////////////////////////
// CErrorLog dialog


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


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


BEGIN_MESSAGE_MAP(CErrorLog, CDialog)
	//{{AFX_MSG_MAP(CErrorLog)
	ON_BN_CLICKED(IDC_BUTTON_COPY, OnButtonCopy)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CErrorLog message handlers

BOOL CErrorLog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//Set log text
	GetDlgItem(IDC_EDIT_ERRORLOG)->SetWindowText
			(
				((CPmfix*) GetParent())->log
			);

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}




void CErrorLog::ClipboardSetText(const char *text, UINT format)
{
	// Open clipboard
    OpenClipboard();

	EmptyClipboard();
    
    // Setup a memory HANDLE for the clipboard
	HANDLE hMem = GlobalAlloc( GMEM_FIXED, (strlen(text)+1)*sizeof(char));
    char* pStr = (char*)GlobalLock( hMem );
    strcpy( pStr, text );
    GlobalUnlock( hMem );

    // Tell Clipboard to use our handle now.
    ::SetClipboardData( format, hMem );

	CloseClipboard();
}

void CErrorLog::OnButtonCopy() 
{
	ClipboardSetText(((CPmfix*) GetParent())->log, CF_TEXT);
}

⌨️ 快捷键说明

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