MFC中获得各个类的指针/句柄 ID的总结

MFC——子窗口之间传递参数和调用函数 @TOC MFC——子窗口之间传递参数和调用函数 这几天在用MFC做ui的时候遇到一个看起来很简单的问题,但是折腾了好久,最后在同门和老师的帮助下解决了这个问题,对MFC有了更深的理解,特此记录一下。 一、功能简介 实现功能:右边添加车型对话框可以选择车型,不同车型有不同的坡度(车型属性)。单击选择键,实现左边视图窗口车型改变为左边选择的车型,同时将坡度属性也传递到左边的视图类。 说明: 左边车辆信息基类为CFormView,右边选择车型窗口基类为CDialogEx类(对话框类和视图类差别还是挺大的 阅读详情
一般我们使用的框架是VC提供的Wizard生成的 MFC App Wizard(exe)框架,无论是多文档还是单文档,都存在 指针获取和操作问题。
下面这节内容主要是一般的框架,然后再讲多线程中的指针使用。使用到的类需要包含响应的头 文件。首先一般获得本类(视,文档,对话框都支持)实例指针 this,用this的目的,主要可以通过类中的函数向其他类或者函数中发指针,以便于在非本类中操作和使用本类中的功能。 这其中的关键在于理解 m_pMainWnd, AfxGetApp(),AfxGetMainWnd() 的意义!
1) 在View中获得Doc指针
CYouSDIDoc *pDoc=GetDocument();一个视只能有一个文档。
2) 在App中获得MainFrame指针
CWinApp 中的 m_pMainWnd变量就是MainFrame的指针,也可以: CMainFrame *pMain =(CMainFrame *)AfxGetMainWnd();
3) 在View中获得MainFrame指针
CMainFrame *pMain=(CmaimFrame *)AfxGetApp()->m_pMainWnd;
4) 获得View(已建立)指针
CMainFrame *pMain=(CmaimFrame *)AfxGetApp()->m_pMainWnd;
CyouView *pView=(CyouView *)pMain->GetActiveView();
5) 获得当前文档指针
CDocument * pCurrentDoc =(CFrameWnd *)m_pMainWnd->GetActiveDocument();
6) 获得状态栏与工具栏指针
CStatusBar * pStatusBar=(CStatusBar *)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR);
CToolBar * pToolBar=(CtoolBar *)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_TOOLBAR);
7) 如果框架中加入工具栏和状态栏变量还可以这样
(CMainFrame *)GetParent()->m_wndToolBar;
(CMainFrame *)GetParent()->m_wndStatusBar;
8) 在Mainframe获得菜单指针
CMenu *pMenu=m_pMainWnd->GetMenu();
9) 在任何类中获得应用 程序类
AfxGetInstanceHandle 得到 句柄,AfxGetApp 得到指针
B1.如何在自己的类和“应用程序类”中获得“文档类”的句柄?
SDI AfxGetMainWnd() -> GetActiveView() -> GetDocument() 得到指针
MDI AfxGetMainWnd() -> MDIGetActive() -> GetActiveView() -> GetDocument() 得到指针
B3.如何在“框架类”中获得“文档类”句柄?
SDI GetActiveView() -> GetDocument() 得到指针,MDI MDIGetActive() -> GetActiveView() -> GetDocument() 从 CMainFrame 得到指针,GetActiveView() -> GetDocument() 从 CChildFrame 得到指针
B4.如何在“视图类”中获得“文档类”句柄?
GetDocument()
C1.如何在“文档类”中获得“视图类”句柄?
GetView(),调用 GetFirstViewPosition 和 GetNextView 函数得到指针。
C2.如何在自己的类和“应用程序类”中获得“视图类”句柄?
SDI GetActiveView 得到指针
MDI MDIGetActive() -> GetActiveView() 从 CMainFrame 得到指针,GetActiveView 从 CChildFrame 得到指针

最后提醒大家,在提取到各个句柄之后,因为初次提取的都是标准类句柄,所以,在使用时要注意将标准句柄转换成自己的类的句柄。
如:
AfxGetApp();//得到的是WinApp类的句柄,
所以操作前记得转换成自己定义的类的句柄。
如:
((CMyApp*)AfxGetApp())->XXXX();//这的xxxx()就是你定义的类中间的成员。

另外,附上 MSDN 关于应用程序信息和管理的各个函数:
When you write an application, you create a single CWinApp-derived object. At times, you may want to get information about this object from outside the CWinApp-derived object.
The Microsoft Foundation Class Library provides the following global functions to help you accomplish these tasks:
Application Information and Management Functions
AfxFreeLibrary
Decrements the reference count of the loaded dynamic-link library (DLL) module; when the reference count reaches zero, the module is unmapped.

AfxGetApp
Returns a pointer to the application's single CWinApp object.

AfxGetAppName
Returns a string containing the application's name.

AfxGetInstanceHandle
Returns an HINSTANCE representing this instance of the application.

AfxGetMainWnd
Returns a pointer to the current "main" window of a non-OLE application, or the in-place frame window of a server application.

AfxGetResourceHandle
Returns an HINSTANCE to the source of the application's default resources. Use this to access the application's resources directly.

AfxInitRichEdit
Initializes the version 1.0 rich edit control for the application.

AfxInitRichEdit2
Initializes the version 2.0 and later rich edit control for the application.

AfxLoadLibrary
Maps a DLL module and returns a handle that can be used to get the address of a DLL function.

AfxRegisterWndClass
Registers a Windows window class to supplement those registered automatically by MFC.

AfxSocketInit
Called in a CWinApp::InitInstance override to initialize Windows Sockets.

AfxSetResourceHandle
Sets the HINSTANCE handle where the default resources of the application are loaded.

AfxRegisterClass
Registers a window class in a DLL that uses MFC.

AfxBeginThread
Creates a new thread.

AfxEndThread
Terminates the current thread.

AfxGetThread
Retrieves a pointer to the current CWinThread object.

AfxWinInit
Called by the MFC-supplied WinMain function, as part of the CWinApp initialization of a GUI-based application, to initialize MFC. Must be called directly for console applications using MFC.
ID--HANDLE--HWND三者之间的互相转换

id->句柄(由ID得到句柄)-----------hWnd = ::GetDlgItem(hParentWnd,id); 

id->指针(由ID得到指针)-----------CWnd::GetDlgItem(); 

句柄->id(由句柄得到ID)-----------id = GetWindowLong(hWnd,GWL_ID); 

句柄->指针(由句柄得到指针)--------CWnd *pWnd=CWnd::FromHandle(hWnd); 

指针->ID(由指针得到ID)----------id = GetWindowLong(pWnd->GetSafeHwnd,GWL_ID); 

GetDlgCtrlID(); 

指针->句柄(由 指针得到句柄)--------hWnd=cWnd.GetSafeHandle() or mywnd->m_hWnd; 
MFC-窗口类的指针与句柄的关系 1 窗口类的指针与句柄的关系 1.1   关系 1.1.1  总述 这段时间学习MFC,一直有疑问,为什么有个窗口对象还要窗口句柄呢?控件ID又有什么用?这些东西是不是多余了。下面是我现阶段的认识,有不对的就请指出来大家一起讨论,问题会越辩越明的。有新的认识时,我会更新的。   MFC中的对象,比如对话框对象,都会占用内存空间,我们就可以用指针指向此对象进行访问,但windows还提供了句 阅读详情

相关推荐

UR10e+D435+ag95夹爪 gazebo 仿真记录(一)

学习仿真环境gazebo下利用UR10e机械臂搭建模拟平台,此博客用于记录搭建过程!!主要参考光头明明、总有一天全城的人都要高看我们和bug404_三位博主。最终自己功能包的主要参考了bug404_的ur_platform,感觉这个结构比较合理。运行环境:Ubuntu18.04+Ros-melodic+Gazebo9。

Forbiven的博客 6330

MFC中获得各个类的指针/句柄的总结

http://yuyin1018.blog.163.com/blog/static/35277171200882321755246/ 一般我们使用的框架是VC提供的Wizard生成的MFC App Wizard(exe)框架,无论是多文档还是单文档,都存在指针获取和操作问题。下面这节内容主要是一般的框架,然后再讲多线程中的指针使用。使用到的类需要包含响应的头文件。首先一般获得本类(视,

yanglijing的专栏 1340

2006NOIP普及组真题 4. 数列

从上述推理中,我们发现要输出的幂次和中的第 N 项(也就是幂次和中的序号N),对应的二进制位数和幂次和对应的二进制位数相同。当 k=3 时,k的幂次为1, 3, 9, 27, 81…,即第0位,第2位均为1,转成 k 进制(k=3)时。,即第2位,第3位均为1,转成 k 进制(k=3)时。转成 k 进制(k=3)时的幂次和为。,即第0位,第1位,第2位均为1,(即第0位,第1位,第2位均为1)N=12时,12的二进制是。(即第0位,第2位均为1)(即第2位,第3位均为1)结论:这道题就变成了。

weixin_40252159的博客 1514

主对话框如何调用子对话框的变量及事件

添加变量  CMySubDlg* m_dlgSub;//子对话框变量 在主对话框的初始化函数中  m_dlgSub = new CMySubDlg;  if(m_dlgSub->GetSafeHwnd() == 0)   m_dlgSub->Create(IDD_MYSUB_DIALOG); 以后在使用子对话框的变量及函数时直接调用如:m_dlgSub->变量名(或函数)

liuhongwei_study的专栏 750

数据库崩溃恢复机制:REDO日志与UNDO日志详解

在数据库管理系统中,事务的持久性和一致性是至关重要的。为了保证在系统崩溃或发生故障时数据不会丢失,数据库引入了恢复机制。其中,REDO日志和UNDO日志是两种关键的恢复技术。本文将详细描述这两种日志的作用、工作原理以及它们在数据库崩溃恢复中的应用。

My_wife_QBL的博客 1413

将点云坐标转换成世界坐标的demo

将点云坐标转换成世界坐标的demo

howard789的博客 2208

MFC如何实现主对话框调用子对话框

MFC如何实现主对话框调用子对话框 1、新建对话框资源 (1) 选中“资源文件”右键→添加→资源 (2)选中“Dialog” →新建 (3) 改对话框左上角描述文字(如“子对话框”) (4) 改对话框ID(如“CHILDDIALODG1”) 结果: 2、添加子对话框类 (1) 选中子对话框右键→添加类 (2)填写类名(如“test1”) 结果: 3、为子对话框类添加消息处理程序(如“OnPaint”) 一共有两种方法: 方法一: (1)选中项目右键→类向导 (2)按下图指示操作: 方法二:

m0_50714865的博客 3443

TDISP(TEE Device Interface Security Protocol)软件操作流程

/ 1. SPDM会话相关定义(🔶1-37、🔶1-187)// SPDM会话ID// AES-256-GCM加密密钥(TDISP要求)// 初始向量// 会话是否激活// 2. IDE流配置(🔶1-52、🔶1-625)// IDE流ID// 4个子流的AES密钥(覆盖所有子流类型)// 密钥是否已配置// 3. TDI状态与配置(🔶1-207、🔶1-210)TDI_CONFIG_UNLOCKED = 0, // 初始配置态。

inquisiter 1436

MFC笔记(一):一个对话框类调用(访问)另一个对话框类的成员变量

MFC笔记(一):一个对话框类调用(访问)另一个对话框类的成员变量 MFC中一个对话框类CDailog1要访问另外一个对话框类CDailog2对象的成员变量,这就需要获得对话框类CDailog2的对象的指针,有好几种方法可以实现,如维护一个单例模式、设置静态变量等。 本文设置以静态变量的方法为例,实现对两个对话框之间数据访问。 一、创建MFC对话框程序 1.首先创建一个MFC对话框应用程序,命名为...

闫小亘的博客 8387

【AI大模型应用开发实战】大型语言模型评估指南白皮书(LLM Eval)

近年来,大型语言模型(LLM)在自然语言处理领域取得了重大进展,例如 GPT-3 和 Chat-GPT。这些模型经过大型数据集的训练,在文本相关任务中表现出卓越的能力,甚至超越了人类。本文将简要介绍如何验证 LLMs 性能的评估指标。自然语言处理(NLP)是人工智能的一个领域,涉及计算机和人类语言之间的交互。NLP 的基本任务之一是语言建模 (LM),它涉及构建统计模型来分析和生成自然语言。LM 已成为推进机器语言智能的关键方法,使机器能够执行机器翻译、情感分析和对话系统等任务。

AI天才研究院 1015

BDD测试用例:Playwright的MCP Server实战

Playwright MCP Server建立了大模型和真实的浏览环境之间的桥梁,可以让大模型操作多款浏览器完成测试任务。

Criss@陈磊 454

MFC 中获得各个类的指针/句柄 ID的总结

一般我们使用的框架是VC提供的Wizard生成的MFC App Wizard(exe)框架,无论是多文档还是单文档,都存在指针获取和操作 问题。 下面这节内容主要是一般的框架,然后再讲多线程中的指针使用。使用到的类需要包含响应的头文件。 首先一般获得本类(视,文档,对话框都支持)实例指针 this,用this的目的,主要可以通过类中的函数向其他类或者函数中发指针,以便于在非本类中操作和使用本

1434

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

(转)MFC中获得各个类的指针/句柄 ID的总结

http://www.cnblogs.com/ylhome/archive/2009/10/06/1578478.html 一般我们使用的框架是VC提供的Wizard生成的MFCApp Wizard(exe)框架,无论是多文档还是单文档,都存在指针获取和操作问题。下面这节内容主要是一般的框架,然后再讲多线程中的指针使用。使用到的类需要包含响应的头文件。首先一般获得本类(视,文档,对话框都支持)...

weixin_30501857的博客 94

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

MFC中获取各个窗口(对话框)之间的指针、对象、句柄

https://blog.csdn.net/lihui126/article/details/43340695 MFC在很多的对话框操作中,我们经常要用到在一个对话框中调用另一个对话框的函数或变量.可以用如下方法来解决. HWND hWnd=::FindWindow(NULL,_T("Sphere")); //得到对话框的句柄 C***Dialog* pWnd= (C...

active2489595970的博客 2486

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

MFC中获取各个窗体之间的句柄或者指针对象的方法

MFC在很多的对话框操作中,我们经常要用到在一个对话框中调用另一个对话框的函数或变量.可以用如下方法来解决.    HWND hWnd=::FindWindow(NULL,_T("Sphere"));      //得到对话框的句柄    C***Dialog* pWnd= (C***Dialog*)C***Dialog::FromHandle(hWnd); //由句柄得到对话框的对象指针

ghevinn欢迎您光临 3537

MFC中获取各个窗口之间的句柄或者指针对象的方法

MFC在非常多的对话框操作中,我们常常要用到在一个对话框中调用还有一个对话框的函数或变量.能够用例如以下方法来解决. HWND hWnd=::FindWindow(NULL,_T("Sphere")); //得到对话框的句柄 C***Dialog* pWnd= (C***Dialog*)C***Dialog::FromHandle(hWnd); //由句柄得到对话框的对象指针...

locat的专栏 392

MFC通过对话框窗口句柄获得对话框对象指针

mfc如何获得控件句柄 CWnd *pWnd = GetDlgItem(ID_***); // 取得控件的指针 HWND hwnd = pWnd->GetSafeHwnd(); // 取得控件的句柄 MFC在很多的对话框操作中,我们经常要用到在一个对话框中调用另一个对话框的函数或变量.可以用如下方法来解决. HWND hWnd=::FindWindow(NULL,_...

u011555996的博客 1432

mfc 找出一个窗口中的所有控件句柄_MFC中获取各个窗口之间的句柄或者指针对象的方法...

win32直接操作的是句柄HANDLE。每一个句柄就相应windows窗体,而vc对HANDLE进行类封装,间接操作的都是HANDLE,如今句柄仅仅是类的一个成员变量。从句柄到指针CWnd* pWnd=CWnd::FromHandle(hWnd); //a temporary CWnd object is created //and attached.pWnd->Attach(hWnd); ...

weixin_31881743的博客 1111
上一篇: GetSystemMetrics详解
下一篇: MFC中获取窗口句柄及相关函数
heary29
博客等级 码龄12年 37粉丝 85原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值