资源简介
用MFC建立了一个简单的画图窗口,实现绘制多边形,硬币,椭圆,矩形等。涉及鼠标交互,快捷键,按钮添加
代码片段和文件信息
#include “stdafx.h“
#include
#include
#include
#include
#include
#include
#include
#include
#define MAX_CONSOLE_LINES 500;
HANDLE g_hConsoleOut; // Handle to debug console
void RedirectIOToConsole(const char title[]);
// This function dynamically creates a “Console“ window and points stdout and stderr to it.
// It also hooks stdin to the window
// You must free it later with FreeConsole
void RedirectIOToConsole(const char title[])
{
int hConHandle;
long lStdHandle;
CONSOLE_SCREEN_BUFFER_INFO coninfo;
FILE *fp;
// allocate a console for this app
AllocConsole();
// set the screen buffer to be big enough to let us scroll text
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE) &coninfo);
coninfo.dwSize.Y = MAX_CONSOLE_LINES;
// How many lines do you want to have in the console buffer
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE) coninfo.dwSize);
// redirect unbuffered STDOUT to the console
g_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle _O_TEXT);
fp = _fdopen( hConHandle “w“ );
*stdout = *fp;
setvbuf( stdout NULL _IONBF 0 );
// redirect unbuffered STDIN to the console
lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle _O_TEXT);
fp = _fdopen( hConHandle “r“ );
*stdin = *fp;
setvbuf( stdin NULL _IONBF 0 );
// redirect unbuffered STDERR to the console
lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);
hConHandle = _open_osfhandle(lStdHandle _O_TEXT);
fp = _fdopen( hConHandle “w“ );
*stderr = *fp;
setvbuf( stderr NULL _IONBF 0 );
SetConsoletitle(title);
// make cout wcout cin wcin wcerr cerr wclog and clog point to console as well
// Uncomment the next line if you are using c++ cio or comment if you don‘t
ios::sync_with_stdio();
}
相关资源
- 基于MFC的TCP调试助手源码95706
- 基于mfc的多线程文件传输
- MFC数字钟(基于VC6.0)
- VC++MFC小游戏实例教程(实例)+MFC类库
- 用VC6.0实现多边形扫描线填充算法
- ChartCtrl控件库(可在VS2019中使用)
- 商品库存管理系统 C++ MFC
- mfc 调用redis
- MFC视频播放器源码(支持avi/wma/mp3等格
- c++多边形交并差运算
- mfc绘图大全(画直线、矩形、椭圆)
- MFC控件重绘
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- MFC文档_视图_框架_模板结构体系深入
- 简单员工管理系统(适合初学MFC)
- MFC五子棋游戏
- MFC UDP编程
- MFC的异步网络通讯应用程序
- C++MFC模块讲解,黑发程序员课程整理
- 一个简单而强大的基于MFC的web server源
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- 扫描线多边形填充算法实现
- MFCaccess.rar
- VC++MFC课程设计的学生成绩管理系统
- MFC 日历控件 万年历 Calendar自绘
- CrystalDiskInfo-HDD/SSD硬盘信息,SMART信息
- MFC自定义界面HUI,高效简单,含详细
- 仿射密码-Affine cipher
- c++MFC车牌自动识别定位,只能定位和
评论
共有 条评论