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

📄 cbtext.cpp

📁 VC++写的ping 的原码。
💻 CPP
字号:
#include "stdafx.h"
#include "cbtext.h"
#include <memory.h>

/* Code snippet to set clipboard text.
 * From "Developing Professional Applications for Windows 95
 * and Windows NT Using MFC" by Marshall Brain/ Lance Lovette */

BOOL CBText::SetText(CString s)
{
	HGLOBAL temp;
	CWinApp *app=AfxGetApp();
	CFrameWnd *fw=(CFrameWnd *)app->m_pMainWnd;
	LPTSTR str;

	if (!::OpenClipboard(fw->m_hWnd))
		return FALSE;
	::EmptyClipboard();
	temp = GlobalAlloc(GHND, s.GetLength()+1);
	if (temp == NULL)
	{
		CloseClipboard();
		return FALSE;
	}
	str=(char *)GlobalLock(temp);
	memcpy(str,LPCTSTR(s), s.GetLength()+1);
	GlobalUnlock((void *)temp);
	SetClipboardData(CF_TEXT,temp);
	CloseClipboard();
	return TRUE;
}

⌨️ 快捷键说明

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