- 博客(28)
- 收藏
- 关注
原创 VC中自定义消息实现(转载于并加以修改)
VC中自定义消息实现 1.方法一Step 1:使用RegisterWindowMessage来确定一个没有被windows本身抢占的消息值,在想添加消息文件中添加代码:const UINT WM_USERDEFMSG = ::RegisterWindowMessage(_T("UserDefMsg"));Step 2:定义消息的处理过程:在处理消息的类(如Dlg类
2008-01-09 10:48:00
1133
原创 消息反射
关于ON_WM_CTLCOLOR_REFLECTafx_msg HBRUSH CtlColor ( CDC* pDC, UINT nCtlColor );Message Reflection for Windows ControlsNote The following technical note has not been updated since it was first
2007-12-08 20:43:00
1199
原创 令代码简洁的ON_CONTROL_RANGE
关于ON_CONTROL_RANGEON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn )Use this macro to map a contiguous range of control IDs to a single message handler function for a specified Windows notificati
2007-12-08 20:41:00
2090
原创 如何添加系统中Lib到当前项目
如何添加系统中Lib到当前项目 (1)在Project | Settings | Link | Object/library modules:输入Lib名称,不同的Lib之间用空格格开。 (2)#pragma comment(lib,"yourlib.lib")
2007-12-08 20:40:00
798
原创 MFC播放音频文件
关于PlaySoundBOOL PlaySound( LPCSTR pszSound, HMODULE hmod, DWORD fdwSound );The PlaySound function plays a sound specified by the given filename, resource, or system event. (
2007-12-08 20:39:00
2960
原创 设置鼠标图形的时机
关于CWnd::OnSetCursorafx_msg BOOL CWnd::OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message );The framework calls this member function if mouse input is not captured and the mouse
2007-12-08 20:36:00
653
原创 用于控制Tab键的函数
关于CWnd::GetNextDlgTabItemCWnd* CWnd::GetNextDlgTabItem( CWnd* pWndCtl, BOOL bPrevious = FALSE) const;COleControlSiteOrWnd* CWnd::GetNextDlgTabItem( COleControlSit
2007-12-08 20:34:00
1019
原创 气球形状的ToolTip
关于ToolTip StylesToolTip controls support a variety of control styles in addition to standard window styles. A ToolTip control always has the WS_POPUP and WS_EX_TOOLWINDOW window styles, regardles
2007-12-08 20:33:00
880
原创 读取string table 的字符串
关于CStringT::LoadStringBOOL CStringT::LoadString(HINSTANCE hInstance,UINT nID, WORD wLanguageID);BOOL CStringT::LoadString(HINSTANCE hInstance,UINT nID);BOOL CStringT::LoadString(UIN
2007-12-08 20:31:00
1484
原创 绘制3D按钮
关于CDC::Draw3dRectvoid CDC::Draw3dRect(LPCRECT lpRectCOLORREF clrTopLeft, , COLORREF clrBottomRight);void CDC::Draw3dRect(int x,int y,int cx,int cy,COLORREF clrTopLeft,COLORREF clrBottomRigh
2007-12-08 20:28:00
930
原创 绘制边框
关于CDC::FrameRectvoid CDC::FrameRect(LPCRECT lpRect,CBrush* pBrush);Draws a border around the rectangle specified by lpRect. The function uses the given brush to draw the border. The width and heig
2007-12-08 20:26:00
974
原创 关于CWnd::OnGetDlgCode
关于CWnd::OnGetDlgCodeafx_msg UINT CWnd::OnGetDlgCode( );Called for a control so the control can process arrow-key and TAB-key input itself. Normally, Windows handles all arrow-key and TAB-key in
2007-12-08 20:25:00
2617
原创 CButtonST的学习
宏的应用#define BTNST_USE_BCMENUclass CButtonST{#ifdef BTNST_USE_BCMENUDWORD SetMenu(UINT nMenu, HWND hParentWnd, BOOL bWinXPStyle = TRUE, UINT nToolbarID = NULL, CSize sizeToolbarIcon =
2007-12-08 20:12:00
5134
1
原创 绘制3d字体
3D 字体m_cr3DHiliteColor = RGB(255,255,255);pDCMem->SetTextColor(m_cr3DHiliteColor);if (m_3dType == Raised) rc.OffsetRect(-1,-1);else //type is Sunken rc.OffsetRe
2007-11-15 16:04:00
964
原创 关于SetBkMode(TRANSPARENT) 设置透明窗口
关于SetBkMode(TRANSPARENT)pDC->SetBkMode(TRANSPARENT);使文本背景与控件背景一样。这个函数只能去掉文字的背景,默认情况下,一个文字是一个方块,文字用文本前景,背景用文字背景(可能和窗口背景不一样),使用这个函数后,文字背景就透明了(和窗口背景一样),但窗口背景并不也变成透明.ModifyStyleEx(0,WS_EX_TRANSPAREN
2007-11-15 15:48:00
11494
原创 MFC 双缓冲(double buffering)
MFC 双缓冲(double buffering)把image显示在monitor上有多种方法,最简单的就是把image直接画出,但这样会导致画面闪烁(Flicker)。因为每次更新图片时计算机要erase然后redraw,在这个时间段内观察者会看到上一次的背景,但这个时候本应该是显示下一个frame。要解决这个问题,就可以使用双缓冲Double buffering技术。先把image
2007-11-15 15:47:00
4134
原创 打开ie 和 mail
CString strLink;GetWindowText(strLink);if (m_Link == HyperLink){ShellExecute(NULL,_T("open"), strLink, NULL, NULL, SW_SHOWNORMAL);}if (m_Link == MailLink){strLink = "mailto:" + strL
2007-11-15 15:46:00
819
原创 calculate Text rectangle
关于DT_CALCRECTDetermines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of the rectangle pointed to by the lpRect parameter and extends the bas
2007-11-15 15:43:00
622
原创 Get Parent Window Color
Get Parent Window ColorCWnd *pParent = GetParent();HBRUSH hParentBrush = (HBRUSH)::SendMessage(pParent->GetSafeHwnd(), WM_CTLCOLOR, CTLCOLOR_DLG, (long)pParent); Fi
2007-11-15 15:38:00
736
原创 CLabel Code学习
关于SS_LEFTNOWORDWRAP SS_LEFTNOWORDWRAP属性是用来关闭文本回绕的。它会强迫使用左对齐属性,多余的文字被剪裁。关于SS_OWNERDRAWSpecifies that the owner of the static control is responsible for drawing the control. The owner window
2007-10-30 23:01:00
3029
原创 BEGIN_MESSAGE_MAP和END_MESSAGE_MAP
BEGIN_MESSAGE_MAP和END_MESSAGE_MAP首先看定义#define BEGIN_MESSAGE_MAP(theClass, baseClass) / const AFX_MSGMAP* theClass::GetMessageMap() const / { return &theClass::messageMap; }
2007-10-30 21:42:00
5285
1
原创 关于DECLARE_MESSAGE_MAP
#define DECLARE_MESSAGE_MAP() /private: / static const AFX_MSGMAP_ENTRY _messageEntries[]; /protected: / static AFX_DATA const AFX_MSGMAP messageMap; / virtual const AFX_MS
2007-10-29 22:51:00
6390
1
原创 关于LOGFONT
关于LOGFONT(1)Defines the attributes of a font.typedef struct { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItal
2007-10-24 21:58:00
1086
原创 关于参数BYTE byCharSet = ANSI_CHARSET
字符集选项: #define ANSI_CHARSET 0 #define DEFAULT_CHARSET 1 #define SYMBOL_CHARSET 2 #define SHIFTJIS_CH
2007-10-24 21:50:00
4204
原创 关于stdafx
关于#include "stdafx.h"(1)Standard Application Frame Extend没有函数库,只是定义了一些环境参数,使得编译出来的程序能在32位的操作系统环境下运行。Windows和MFC的include文件都非常大,即使有一个快速的处理程序,编译程序也要花费相当长的时间来完成工作。由于每个.CPP文件都包含相同的include文件,为每个.CPP文件都
2007-10-24 21:17:00
4135
原创 关于 DEBUG_NEW
#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif (1) 在 MFC 中,可以使用 DEBUG_NEW 宏代替 new 运算符来帮助定位内存泄漏。在程序的“Debug”版本中,DEBUG_NEW将为所分配的每个对象跟踪文件名和
2007-10-24 20:05:00
3818
原创 WM_USER 与 WM_APP
WM_USER 与 WM_APP#define WM_GET (WM_USER+112) 和 #define WM_GET (WM_APP+112)除了值不同外,有区别吗?(1)WM_USER through 0x7FFF Integer messages for use by private window classes. WM_APP through 0xBFFF Messag
2007-10-23 23:23:00
4728
原创 关于#pragma once
关于#pragma once一.解析指令(#pragma) 在所有的预处理指令中,#pragma指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作。#pragma指令对每个编译器给出了一个方法,在保持与C和C++语言完全兼容的情况下,给出主机或操作系统专有的特征。依据定义,编译指示是机器或操作系统专有的,且对于每个编译器都是不同的。其格式一般为:#
2007-10-23 22:28:00
1265
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人