
对话框/属性页
zgl7903
iPad回帖太累人
展开
-
基于状态机的 CSV 文件数据解析
#include <tchar.h>#include <afxtempl.h>#include <stdio.h>#include <string.h>#ifndef CStringA#define CStringA CString#endif //CStringA//解析CSV行数据核心代码//chLine 输入行//szDa...原创 2019-12-27 16:32:26 · 546 阅读 · 3 评论 -
对话框自己处理边框拖动
LRESULT CDlg2Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { enum _tagDragMask_t { _DragNull = 0x00, _DragLeft = 0x01, _DragTop = 0x02, _DragRi...原创 2019-11-23 16:00:16 · 371 阅读 · 0 评论 -
CStatic + CImage 实现简单的图片显示控件
#pragma once// ImageStatic.h#include #include class CImageStatic : public CStatic{ DECLARE_DYNAMIC(CImageStatic)public: CImageStatic(); virtual ~CImageStatic(); BOOL SetImage(LPCT原创 2015-06-26 19:42:05 · 6752 阅读 · 9 评论 -
让 基于 CWnd 类能接收键盘消息
让 基于 CWnd 类能接收键盘消息, 两个关键点 WM_GETDLGCODE 返回时增加 DLGC_WANTALLKEYS|DLGC_WANTCHARS, 第二 使用 SetFocus 选中焦点LRESULT CMyWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your原创 2017-02-16 17:30:14 · 1353 阅读 · 0 评论 -
子窗口随父窗口缩放管理类
因为记录了子窗口原始相位位置,因此不论缩放多少次,相对位置都不会发生变化#pragma once#include <Afxtempl.h>class CWindowSizeMange{protected: typedef struct _tagSizeData_t { HWND hWndCtrl; //窗口句柄 double fLeft,...原创 2018-02-12 13:14:47 · 1559 阅读 · 1 评论 -
自定义对话框类名
标准的对话框类都以“#32770”作为类名,当然常规的应用没有任何问题,但是如果FindWindow查找窗口时就比较容易造成困扰。下面就来介绍下自定义对话框类的简单方法。 首先第一步 修改资源 .rc 文件中的类名,添加CLASS "你想要的类名"IDD_DLG7_DIALOG DIALOGEX 0, 0, 133, 69STYLE DS_MODALFRAME | WS_POPUP | WS...原创 2018-04-09 14:39:57 · 1190 阅读 · 0 评论 -
枚举多显示器信息 EnumDisplayMonitors 应用
class CMultiMonitorEnumerator{public: int m_iMontorNumber; typedef struct _tagVMonitorInfo_t { HMONITOR hMonitor; //显示器句柄 TCHAR szDevice[32]; //显示器名 RECT rcVirtual; //虚拟显示屏坐标 R...原创 2018-07-05 12:52:25 · 9442 阅读 · 0 评论 -
智能接收条码编辑框
以扫码枪回车作为区分, 下次输入时自动清除 // MyEdit.h : header file#pragma once#define WM_MYINPUT_MSG (WM_USER + 1000)/////////////////////////////////////////////////////////////////////////////// CMyEdit wi...原创 2018-11-09 09:22:56 · 313 阅读 · 0 评论 -
使用CFontDialog 选择字体
{ #ifndef CF_INACTIVEFONTS #define CF_INACTIVEFONTS 0x02000000L #endif //CF_INACTIVEFONTS //初始化字体结构体 LOGFONT lgFont={0}; //填充用于初始化LOFGONT GetFont()->GetLogFont(&lgFont); CFon...原创 2019-05-22 19:31:54 · 1130 阅读 · 0 评论 -
在内存创建对话框资源
//////////////////////////////////////////////////////////////////////////BaseDynDialog.h#pragma onceclass CBaseDynDialog : public CDialog{ DECLARE_DYNAMIC(CBaseDynDialog) public: ...原创 2019-05-30 18:26:04 · 508 阅读 · 0 评论 -
在菜单中搜索某项指定ID菜单经过的路径
//获取菜单路径BOOL GetMenuPath(HMENU hMenu, UINT uIDM, CStringArray &szPath){ //按位置搜索ID for(int iPos=0; iPos<GetMenuItemCount(hMenu); iPos++) { //获取菜单信息 TCHAR szString[128]; MEN...原创 2019-07-25 12:41:54 · 450 阅读 · 0 评论 -
从CMFCPropertyGridProperty派生新类,实现点击时显示下拉列表
class CMFCPropertyGridPropertyCB : public CMFCPropertyGridProperty{// Constructionpublic: CMFCPropertyGridPropertyCB(const CString& strName, const COleVariant& varValue, LPCTSTR lpszDesc...原创 2019-08-09 07:03:58 · 1622 阅读 · 1 评论 -
在ActiveX中调出属性页
HRESULT CTestActiveXCtrl::ShowPorpertyPages(void){ AFX_MANAGE_STATE(AfxGetStaticModuleState()); // TODO: 在此添加调度处理程序代码 HRESULT hr = S_OK; LPUNKNOWN lpDisp = GetIDispatch(FALSE); LCID lcid原创 2015-05-13 05:16:17 · 947 阅读 · 1 评论 -
CColorDialog的非模态实现
早上看到论坛上有人发问CColorDialog怎么实现非模态,仔细追踪了一下,CColorDialog继承自CCommonDialog,而CCommonDialog在构造时给CDialog类的对话框资源ID是0, //CColorDialog构造函数CColorDialog::CColorDialog(COLORREF clrInit, DWORD dwFlags, CWnd* pPa原创 2012-08-07 17:06:46 · 3139 阅读 · 0 评论 -
在对话框中添加TOOLBAR
//.hCToolBar m_wndToolBar; BOOL CTestDlg::OnInitDialog(){ CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the applicatio原创 2012-03-15 16:37:51 · 2548 阅读 · 0 评论 -
CFileDialog 使用 OFN_ALLOWMULTISELECT 标志选择多个文件
CFileDialog dlg( TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, NULL, NULL ); DWORD MAXFILE = 2562; //2562 is the max TCHAR* pc = new TCHAR[MAXFILE * (MAX_PATH+1) + 1]; pc[0] = pc[1] = 0; d...原创 2010-09-01 07:19:00 · 7785 阅读 · 0 评论 -
基于对话框的空闲消息处理
//.h head file#include // For WM_KICKIDLEpublic:afx_msg LRESULT OnKickIdle(WPARAM, LPARAM);//.CPPBEGIN_MESSAGE_MAP(CIdleDlg, CDialog) ON_MESSAGE(WM_KICKIDLE, OnKickIdle)END_MESS原创 2010-05-07 14:12:00 · 900 阅读 · 0 评论 -
修改CPropertySheet类默认的TAB位置
BOOL CMyPropertySheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // TODO: Add your specialized code here //修改TAB风格 CTabCtrl *pTabCtrl = GetTabControl(); DW原创 2010-01-08 20:52:00 · 1087 阅读 · 0 评论 -
自绘对话框标题栏
void CDD2Dlg::OnNcPaint() { //使用默认的操作先刷新 CDialog::OnNcPaint(); //计算TitleBar的坐标区域 CRect titleRect; GetWindowRect(&titleRect); DWORD DialogBaseUnits = GetDialogBaseUnits(); WORD Dialog原创 2008-07-29 12:47:00 · 1594 阅读 · 0 评论 -
自绘CTabCtrl控件的实现
//头文件#pragma once// OwnerdrawTabCtrl.h : header file/////////////////////////////////////////////////////////////////////////////// COwnerdrawTabCtrl windowclass COwnerdrawTabCtrl : publ原创 2010-09-03 15:07:00 · 12739 阅读 · 4 评论 -
使用 FlashWindowEx 实现闪屏效果
BOOL FlashWindowProc(HWND hWnd, int nCount, DWORD dwBaud){ BOOL bRet = 0;#ifndef FLASHWINFO typedef struct { UINT cbSize; HWND hwnd; DWORD dwFlags; UINT uCou原创 2010-02-02 21:53:00 · 4557 阅读 · 1 评论 -
从CPropertySheet派生一个具有自绘功能的新类
//从CPropertySheet派生一个新类 //具有自绘题头功能 #pragma once// OwnerDraw_PropertySheet.h : header file///////////////////////////////////////////////////////////////////////////////// COwnerDraw_Pr原创 2011-12-23 16:34:25 · 2067 阅读 · 1 评论 -
实现对话框在位图作为背景时的控件透明
/////////////////TransparentDlg.h #pragma once/////////////////////////////////////////////////////////////////////////////// CTransparentDlg dialogclass CTransparentDlg : public CDialog...原创 2010-09-24 10:00:00 · 4305 阅读 · 2 评论 -
给显示窗口添加一个Resizeable的角标
CRect rcGrip; GetClientRect(rcGrip); rcGrip.left = rcGrip.right-GetSystemMetrics(SM_CXVSCROLL); rcGrip.top = rcGrip.bottom-GetSystemMetrics(SM_CYVSCROLL); CDC *pDC = GetDC(); if(!pDC->D原创 2010-04-02 13:22:00 · 1300 阅读 · 0 评论 -
修改CDialog模态对话框函数DoModal 使对话框显示可以受WS_VISIBLE风格控制
调试追踪DoModal的执行过程发现对话框显示的位置在 CWnd::RunModalLoop(DWORD dwFlags)中BOOL bShowIdle = (dwFlags & MLF_SHOWONIDLE) && !(GetStyle() & WS_VISIBLE);……if (bShowIdle){ ShowWindow(SW_SHOWNORMAL); //这里显示出来了原创 2010-03-22 21:55:00 · 4661 阅读 · 6 评论 -
在PropertySheet中插入一PropertyPage页
int COwnerDraw_PropertySheet::InsertPage(CPropertyPage* pPage, int nIndex){ ASSERT_VALID(this); ENSURE_VALID(pPage); ASSERT_KINDOF(CPropertyPage, pPage); if(nIndex GetPageCount())//add to原创 2010-03-04 08:55:00 · 1783 阅读 · 0 评论 -
可滚动属性页(对话框)实现
//SCrollAblePropertyPage.h#pragma once// CSCrollAblePropertyPage 对话框class CSCrollAblePropertyPage : public CPropertyPage{ DECLARE_DYNAMIC(CSCrollAblePropertyPage)public: CSCrollA原创 2011-02-22 11:09:00 · 1404 阅读 · 0 评论