随笔分类 -  VC++/MFC

摘要:思路来自:MFC Tutorial - Creating a window with two classes在工程中新建一个类CChildFrameclass CChildFrame : public CFrameWnd在构造函数中:1 CChildFrame::CChildFrame()2 {3 Create(NULL,"MFC Tutorial Part 1 CoderSource Window");4 }可选:添加WM_PAINT消息: 1 void CChildFrame::OnPaint() 2 { 3 CPaintDC dc(this); // device c 阅读全文
posted @ 2013-01-03 23:41 SubmarineX 阅读(2961) 评论(0) 推荐(1)
摘要:Win32应用中创建多窗口,创建同一个窗口类的多个窗口对象和不同窗口类的窗口对象。 1 // win32_多窗口.cpp : Defines the entry point for the application. 2 // 3 4 #include "stdafx.h" 5 #include "resource.h" 6 7 #define MAX_LOADSTRING 100 8 9 // Global Variables: 10 HINSTANCE hInst; // current instance ... 阅读全文
posted @ 2013-01-03 20:36 SubmarineX 阅读(7368) 评论(0) 推荐(0)
摘要:参考:http://blog.csdn.net/desow/article/details/4592847环境是 XP + VC++6.0。按照方法1添加:把 .h 文件添加到以下目录:把GdiPlus.lib 添加到以下目录:接着是针对具体的工程设置:a. StdAfx.h 中:b. CXXXApp 类中声明两个变量:c. CXXXApp 类中的 InitInstance() 中调用 GdiplusStartup 方法:d. CXXXApp 类中声明ExitInstance 方法,并定义:!!!声明的时候我只是照猫画虎写的!!! 阅读全文
posted @ 2012-12-22 15:49 SubmarineX 阅读(239) 评论(0) 推荐(0)
摘要:MFC中,使用Edit控件显示中文遇到乱码。自己写了两个函数进行转化 1 // CString转换成string 2 string CDictDlg::CString2string(CString &str) 3 { 4 char *pCh = new char[MY_EDIT_TEXT_LENG]; 5 // W(2B) -> A(B) 6 WideCharToMultiByte(CP_ACP, 0, str.GetBuffer(), -1, pCh, str.GetLength() * 2, NULL, NULL); 7 pCh[str.GetLength(... 阅读全文
posted @ 2012-06-06 23:40 SubmarineX 阅读(1042) 评论(0) 推荐(0)
摘要:显示位图并去掉位图周围空白区域:需要调用函数:TransparentBlt具体参见:http://baike.baidu.com/view/1080409.htm?fr=ala0_1 函数功能:该函数对指定的源设备环境中的矩形区域像素的颜色数据进行位块(bit_block)转换,并将结果置于目标设备环境。 函数原型:BOOL TransparentBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int hHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOr.. 阅读全文
posted @ 2010-09-04 18:42 SubmarineX 阅读(264) 评论(0) 推荐(0)