用户自定义的的消息

Win32消息机制和用户自定义消息类型 用户可自定义消息。 阅读详情
用户自定义的的Windows消息(也就是以WM_开头,除了WM_COMMAND以外的消息,这类消息
在WM_USER以下的是系统消息,WM_USER以上的可以由用户自己定义),是消息发出者直接
发给对应CWnd的窗体句柄,由CWnd负责消息的响应。所以这类消息必须同一个CWnd类对应,
更精确的说必须与一个HWND类型的窗体句柄相对应。

关于发送消息的函数:

SendMessage可以理解为,SendMessage函数发送消息,等待消息处理完成后,SendMessage
才返回。稍微深入一点,是等待窗口处理函数返回后,SendMessage就返回了。

PostMessage可以理解为,PostMessage函数发送消息,不等待消息处理完成,立刻返回。
稍微深入一点,PostMessage只管发送消息,消息有没有被送到则并不关心,只要发送了消
息,便立刻返回。


自定义消息步骤:

1.声明消息:
#define WM_MYMSG (WM_USER+8)

2.在类声明中声明消息处理函数:
afx_msg LRESULT OnMyMsgHandler(WPARAM wParam,LPARAM lParam);

DECLARE_MESSAGE_MAP()

3.实现消息映射:
BEGIN_MESSAGE_MAP(CXXXDlg, CDialog)
ON_MESSAGE(WM_MYMSG,OnMyMsgHandler)
END_MESSAGE_MAP()

4.实现消息处理函数:
LRESULT CXXXDlg::OnMyMsgHandler(WPARAM wParam,LPARAM lParam)
{
//AfxMessageBox("Hello,World!");
return 0;
}

5.发送消息:
::SendMessage(::AfxGetMainWnd()->m_hWnd,WM_MYMSG,0,0);
Delphi中的用户自定义消息深入解析 在软件开发中,用户自定义消息(User-Defined Messages)为开发者提供了扩展操作系统或应用程序消息系统的能力。这种机制允许应用程序定义自己的消息类型,以便在运行时根据特定条件发送和处理这些消息。自定义消息通常用于实现特定的功能需求,比如组件间的通信、自定义控件或模块之间的交互等。用户自定义消息是一种强大的工具,因为它允许开发者绕过传统的函数调用机制,采用事件驱动的方式来增强应用程序的响应性和模块化。 阅读详情

相关推荐

窗口之间通过消息和文本文件实现信息传递

主程序启动的时候,运行外部可执行文件启动副窗口,通过PostMessage(CHwnd,MyMsg,uservar,uservar)消息函数和文本文件实现主副窗口之间信息传递。

Delphi中的Windows消息处理

这里采用自定义消息的方法。注意:delphi中自定义消息值范围为:WM_USER到$7FFF之间。 1.应用程序中的消息(在同一个应用程序的不同Form间进行消息处理)示例:Form1:unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,

【昆山人在上海】 868

模块 stm32_基于STM32设计的RFID读卡模块电路方案(原理图+程序)

采用stm32F030F4,用PWM产生125KHZ的方波,经过推挽电路进行功率放大,高频电流进入LC串联谐振电路,345uH和4.7NF的谐振频率正好是125KHZ,这时电容两端电压会到十几伏。当有卡接近线圈时,线圈两端会有曼彻斯特编码的调幅波。通过二极管以及电容的检波和滤波,产生的小信号送入LM358进行放大和整形,变成单片机可以读取的曼彻斯特编码信号。• IO 分配(采用内部晶...

weixin_28686771的博客 3815

使用Windows消息控制Winamp(Delphi)

使用Windows消息控制Winamp(Delphi)--------------------------------------------------------------------------------第一部分:得到Winamp的窗口Winamp是一个32位的Windows应用程序。也就是说,我们可以使用32位的Windows编程的一些基础技术来实现控制Winamp,即使用Wi

40Star的专栏 1632

「Unity3D」Addressable版本冲突解析:SBP与Addressables兼容性问题实战指南

本文深入解析Unity3D中Addressable与SBP(Scriptable Build Pipeline)版本冲突问题,提供实战解决方案。当遇到「Build Task CreateBuiltInShadersBundle failed」错误时,可通过版本匹配、临时资源引用或构建参数调整解决。文章详细分析兼容性原理,并给出版本组合指南与最佳实践,帮助开发者高效处理资源构建问题。

weixin_29001683的博客 410

基于IP2369与STM32的45W双向PD移动电源设计

USB PD(Power Delivery)是一种面向高功率、智能协商的通用快充协议,其核心在于通过BMC编码在CC线上完成供电能力(PDO)动态匹配与电压/电流精准调控。IP2369作为高度集成的PD协议管理芯片,内置PHY、协议引擎与MOSFET驱动,可卸载MCU实时通信压力;而STM32F103系列凭借低功耗STOP模式与丰富外设,成为电源状态管理与用户交互的理想协处理器。该组合显著提升系统鲁棒性与能效比,适用于便携式移动电源、嵌入式备用电源及PD协议教学验证等场景。本文围绕IP2369配置电阻精度、

weixin_42608299的博客 516

在delphi线程中实现消息循环

Delphi的TThread类使用很方便,但是有时候我们需要在线程类中使用消息循环,delphi没有提供.花了两天的事件研究了一下win32的消息系统,写了一个线程内消息循环的测试.但是没有具体应用过,贴出来给有这方面需求的DFW参考一下.希望大家和我讨论.{-----------------------------------------------------------------...

284

国产麒麟系统各版本镜像下载

以上各链接均为迅雷下载,禁止商业用途!

2302_79474754的博客 6127

DELPHI中自定义消息的发送和接收

DELPHI中的消息处理机制 Delphi是Borland公司提供的一种全新的WINDOWS编程开发工具。由于它采用了具有弹性的和可重用的面向对象Pascal(object-orientedpascal)语言,并有强大的数据库引擎(BDE),快速的代码编译器,同时又提供了众多出色的构件。受到广大编程人员的青睐。在众多的编程语言(如VB,PowerBuilder,Powerpoint等)中脱颖而出

xtfnpgy 8378

Python 实战:全面解析“微信搜一搜”内容爬取,从入门到企业级架构

本文将带你从零搭建爬虫项目,采用 Requests、Scrapy、Selenium、Proxy 池、中间人监控(如 Fiddler/mitmproxy)、分布式调度、数据库持久化、断点续抓等方案,实现可持续、抗封能力强的内容抓取系统。理解“微信搜一搜”页面结构与 Javascript 渲染逻辑;使用 Scrapy 框架搭建分布式爬虫;使用 Selenium 模拟浏览器抓取;构建代理池提升爬取成功率;对抗验证码、IP 封禁与 cookie 过期问题;

2201_76125261的博客 1393

OpenCV实战系列——图像线条提取

基于内容的图像分析,需要从构成图像的像素集合中提取有意义的特征。轮廓、线条、区域等是基本的图像基元,可用于描述图像中包含的元素。本节将介绍如何提取重要的图像线条特征。

m0_58523831的博客 1万+

MFC用户自定义消息

之前做过佳能相机和位移平台的额二次开发,当时遇到一个棘手的问题,就是位移平台如何知道相机已经拍完照了,或者相机如何知道位移平台已经运行到指定位置,当时为了方便采用了定时器来定时检测位移平台的位置,结果在后续的工作中引起了各种意想不到的错误。其实用户自定义消息之前了解过,由于之前编程一直没用到过,所以没去深入研究,主要也是自己偷懒怕麻烦。偷懒这个坏习惯必须要改,就像这次的相机开发一...

a757428997的博客 226

智能车图像处理4-入门级分析3 ---十字路口补线

PS :入门级文章适合新手,如果已经有基础可以去看进阶篇文章。

taiyuezyh的博客 1万+

注册用户自定义消息

​通过 PostThreadMessage将消息投递到指定线程的消息队列。​。

felicity_one的博客 740

【QGIS入门实战精品教程】4.2:QGIS矢量数据采集(地图数字化)案例教程

本文基于上一个实验栅格数据地理配准,讲述在QGIS中创建shp格式矢量数据(点、线、面)并进行矢量数据的采集与编辑。 文章目录一、实验数据及任务二、创建Shapefile图层三、数字化超详细步骤 一、实验数据及任务 1. 实验数据:为了保证实验的连贯性,本次实验采用的数据为上一个实验地理配准的结果数据,为配准后的甘肃省地图。 参考阅读:【QGIS入门实战精品教程】4.1:QGIS栅格数据地理配准完整操作流程 添加实验数据: 2. 实验任务:本实验任务为以配准后的甘肃省地图为底图,创建点状(地级市.

智慧空间实验室 3382

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

MFC中用户自定义类响应自定义消息

【转】MFC中用户自定义类响应自定义消息   这篇技术文章不是讨论经典的MFC中的消息工作机理的,讨论消息工作原理、方式和路径的文章在网上和书本中 随处可见。网上众多的讨论都是关于如何响应并进行用户自定义消息映射的;网上还有一些文章介绍如何在自定 义类中响应Windows消息,在本文中都简略叙述。但是,网上大部分的文章没用透彻阐述如何在用户自定义类中 响应自定义消息这一通用

JUST DO IT 2182

深度学习工具包 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")

MFC中,如何自定义用户消息

1、用处 在多个类之间传递消息。当需要响应用户操作,本类却无法实现时,可以向系统发出消息。然后让系统中的需要的位置实现它。 2、方法 2.1定义这个消息,并让拥有者发送这个这个消息,传递一个整型参数 这里才需要发送消息的地方(实现文件,cpp文件中) 添加以下代码: 1 //--让父窗口去更改值 2 int nrow(0); 3 GetOwner()->Send...

weixin_30750335的博客 89

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

MFC中用户自定义消息的实现

今天继续做一个小单子,其中一个GridCtrl控件的WM_CHAR消息在被GridCtrl响应后需要再被主对话框响应,因此考虑在GridCtrl的OnChar函数中给主对话框发送一个用户自定义消息。这一节来复习一下基本步骤。 步骤一:在头文件最好是 resource.h 中声明消息 #define WM_MYCHARMSG WM_USER + 1 步骤二:在响应类中声明消息映射(这一步通常可以

对酒当歌,人生几何。譬如朝露,去日苦多 717

再探MFC(七)用户自定义消息

介绍用户自定义消息使用场合以及如何使用.

soliddream66的专栏 830

MFC的自定义消息(用户消息)的定义与使用

MFC的自定义消息(用户消息)的定义与使用 自定义消息的响应和资源消息的响应有很多类似之处;资源消息的响应是以资源的ID号作为标识的;自定义的消息要自己声明消息ID; 一.           定义: 第一步要声明消息: #define WM_MYMSG  WM_USER+200 第二步要在类声明中声明消息映射: DECLARE_MESSAGE_MAP() 第三步要在类声明中定义消息

郑海波(莫川)的优快云博客 4444

用户自定义消息至少要 WM_USER+100开始

<br />用户自定义消息至少要 WM_USER+100开始,100以下有时收到不到消息啊!

LZNJ06的专栏 1587

MFC:用户自定义消息

Win32/MFC 用户消息追加

hcf_hot的博客 329

注册系统预定义消息和注册用户自定义消息的差异

书籍:《Visual C++ 2017从入门到精通》的3.8.5 查找/替换对话框的使用环境:visual studio 2022内容:[例 3.14] 查找/替换对话框的使用说明:以上内容大部分来自腾讯元宝。在MFC中,注册系统预定义消息和自定义消息。

felicity_one的博客 605

Windows用户自定义消息实现程序间通信

这是按照个人需要编写的用户自定义消息程序间通信的发送程序。 程序找到名为“Hand Gesture V1.0"的窗口,将当前点的X, Y坐标发给这个窗口。 当然这个窗口的程序里要加入相应的接收函数。 以下是程序代码,main函数是用来测试的。主要在于send_message函数。 #include "windows.h" #include //define use message #de

974

MFC中用户自定义类响应自定义消息(转)

这篇技术文章不是讨论经典的MFC中的消息工作机理的,讨论消息工作原理、方式和路径的文章在网上和书本中随处可见。网上众多的讨论都是关于如何响应并进 行用户自定义消息映射的;网上还有一些文章介绍如何在自定义类中响应Windows消息,在本文中都简略叙述。但是,网上

小菜鸟的足迹~ 3033
上一篇: 使用位运算加速乘除法运算
下一篇: 任务栏托盘
cp32212116
博客等级 码龄13年 106粉丝 58原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值