WIN32汇编之菜单、加速键、快捷键

(一)
Invoke checkmenuitem,hmenu,ebx,eax
.elseif eax>=IDM_BIG&&eax<=DM_DETAIL
invokecheckmenuradioitem,hmenu,IDM_BIG,IDM_DETAIL,eax,MF_BYCOMMAND
.endif
重点与难点:
1、关于checkmenuitem
The CheckMenuItem function sets the state of the specified menuitem's check-mark attribute to either selected or clear.
设置菜单项的check状态的选择或清除
Syntax
DWORD CheckMenuItem(
HMENU hmenu,
UINT uIDCheckItem,
UINT uCheck
);
参数说明
UCHECK如下:
MF_BYCOMMAND uIDCheckItem参数为为命令ID
Indicates that the uIDCheckItem parameter gives the identifier ofthe menu item. The MF_BYCOMMAND flag is the default, if neither theMF_BYCOMMAND nor MF_BYPOSITION flag is specified.
MF_BYPOSITION uIDCheckItem参数为从0起始的菜单序号
Indicates that the uIDCheckItem parameter gives the zero-basedrelative position of the menu item.
MF_CHECKED 设置菜单项为选择
Sets the check-mark attribute to the selected state.
MF_UNCHECKED 设置菜单项为没有选择
Sets the check-mark attribute to the clear state
2、关于checkmenuradioitem
The CheckMenuRadioItem function checks a specified menu item andmakes it a radio item. At the same time, the function clears allother menu items in the associated group and clears the radio-itemtype flag for those items
用于radio类型的菜单项选择,选中某一项并清除其它项的选择标志,其它项由 UINT idFirst,
UINT idLast两个参数指定。
Syntax
BOOL CheckMenuRadioItem(

HMENU hmenu,
UINT idFirst,
UINT idLast,
UINT idCheck,
UINT uFlags
);
uFlags 参数:If this parameter is MF_BYCOMMAND, the other parametersspecify menu item identifiers(命令ID). If it is MF_BYPOSITION, theother parameters specify the menu item positions(菜单序号)
(二)
.elseif eax==wm_bycommand
mov eax,wparam
movzx eax,ax
..if eax==IDM_HELP||IDM_ABOUT
invoke _displaymenuitem,wparam
.else
invoke defwindowproc,hwnd,umsg,wparam,lparam;交给默认窗口处理程序处理
ret
.endif
.elseif

(三)右键弹出菜单
.elseif eax==WM_RBUTTONDOWN
invoke getcursorpos,addr @stpos;
invoketrackpopupmenu,hsubmenu,TPM_LEFT,@stops.x,@stops.y,null,hwnd,null;
.elseif eax==wm_close
call _quit
.else
invoke defwindowproc,hwnd,umsg,wparam,lparam;交给默认窗口处理程序处理
ret
.endif

重点与难点:
1、 the GetCursorPos function retrieves the cursor's position, inscreen coordinates.
返回当前光标位置,即鼠标位置是是相对于屏幕的座标。
Syntax
BOOL GetCursorPos(

LPPOINT lpPoint
);
2、 trackpopupmenu
The TrackPopupMenu function displays a shortcut menu at thespecified location and tracks the selection of items on the menu.The shortcut menu can appear anywhere on the screen.
在屏幕的任何指定位置显示一个弹出菜单。
Syntax
BOOL TrackPopupMenu(

HMENU hMenu,
UINT uFlags,
int x,
int y,
int nReserved,
HWND hWnd,
HWND prcRect
);
参数说明
(1) uFlags
TPM_CENTERALIGN
If this flag is set, the function centers the shortcut menuhorizontally relative to the coordinate specified by the xparameter.
TPM_LEFTALIGN
If this flag is set, the function positions the shortcut menu sothat its left side is aligned with the coordinate specified by thex parameter.
TPM_RIGHTALIGN
Positions the shortcut menu so that its right side is aligned withthe coordinate specified by the x parameter.
Use one of the following flags to specify how the functionpositions the shortcut menu vertically.
TPM_BOTTOMALIGN
If this flag is set, the function positions the shortcut menu sothat its bottom side is aligned with the coordinate specified bythe y parameter.
TPM_TOPALIGN
If this flag is set, the function positions the shortcut menu sothat its top side is aligned with the coordinate specified by the yparameter.
TPM_VCENTERALIGN
If this flag is set, the function centers the shortcut menuvertically relative to the coordinate specified by the yparameter.
Use the following flags to determine the user selection withouthaving to set up a parent window for the menu.
以上为菜单显示时的对齐方式相对于x、y参数
TPM_NONOTIFY用户选择菜单项时不发送通知消息
If this flag is set, the function does not send notificationmessages when the user clicks on a menu item.
TPM_RETURNCMD 返回命令ID
If this flag is set, the function returns the menu item identifierof the user's selection in the return value.
Use one of the following flags to specify which mouse button theshortcut menu tracks.
TPM_LEFTBUTTON 左键键选择菜单
If this flag is set, the user can select menu items with only theleft mouse button.
TPM_RIGHTBUTTON 右键选择菜单
If this flag is set, the user can select menu items with both theleft and right mouse buttons.
Windows 98/Me, Windows 2000/XP:Use any reasonable combination ofthe following flags to modify the animation of a menu. For example,by selecting a horizontal and a vertical flag you can achievediagonal animation. 可以用下列参数来展示菜单显示的动态效果
TPM_HORNEGANIMATION
Animates the menu from right to left.
TPM_HORPOSANIMATION
Animates the menu from left to right.
TPM_NOANIMATION
Displays menu without animation.
TPM_VERNEGANIMATION
Animates the menu from bottom to top.
TPM_VERPOSANIMATION
Animates the menu from top to bottom
(2) nReserved
Reserved; must be zero. 必须为null
(3) hWnd 要弹出菜单的句柄
[in] Handle to the window that owns the shortcut menu. This windowreceives all messages from the menu. The window does not receive aWM_COMMAND message from the menu until the function returns. If youspecify TPM_NONOTIFY in the uFlags parameter, the function does notsend messages to the window identified by hWnd. However, you muststill pass a window handle in hWnd. It can be any window handlefrom your application
仅指窗口的弹出菜单类型,在本函数返回后,窗口才会接收到wm_command消息,但POPUP类型的菜单只能在第二层中定义,如文件属于第一层,打开、新建等才属于第二层,所以hdunmrnu参数取得了子菜单句柄,invokegetsubmenu.hnemu,npos
,mov hsubmenu,eax。npos指定要取得的第一层菜单的序号,如第一层有2个菜单项,文件和查看,则文件为0,查看为1。
  _procwinmain endp

_winmaing proc
local @stwndclass:wndclassex
local @stmsg:MSG
local @haccelerator
invoke getmodulehandle,null
mov hinstance,eax
invoke loadmenu,hinstance,IDM_MIAN;加载菜单
mov hmenu,eax
invoke loadaccelerators,hinstance,IDA_MAIN;加载加速键
mov @haccelerator,eax
;注册窗口类和建立显示窗口省略
;...............
;...............
;重点:消息循环
.while true
invoke getmessage,addr @stmsg,null,0,0
.break .if eax==0
invoke translateaccelerator,hwinmain,@haccelerator,addr@stmsg
;关于translateaccelerator
;-----------
The TranslateAccelerator function processes accelerator keys formenu commands. The function translates a WM_KEYDOWN orWM_SYSKEYDOWN message to a WM_COMMAND or WM_SYSCOMMAND message (ifthere is an entry for the key in the specified accelerator table)and then sends the WM_COMMAND or WM_SYSCOMMAND message directly tothe appropriate window procedure. TranslateAccelerator does notreturn until the window procedure has processed the message.
对菜单的快键进行预处理,将WM_KEYDOWN或WM_SYSKEYDOWN消息处理成为WM_COMMAND或WM_SYSCOMMAND,并直接将消息送到窗口过程处理,直到窗口过程处理该消息后才返回.
Syntax

int TranslateAccelerator( HWND hWnd,
HACCEL hAccTable,加速键表的资源句柄
LPMSG lpMsg
);
Parameters

hWnd
[in] Handle to the window whose messages are to betranslated.
hAccTable
[in] Handle to the accelerator table. The accelerator table musthave been loaded by a call to the LoadAccelerators function orcreated by a call to the CreateAcceleratorTable function.
lpMsg
[in] Pointer to an MSG structure that contains message informationretrieved from the calling thread's message queue using theGetMessage or PeekMessage function.


[Return Value]

If the function succeeds, the return value isnonzero.执行成功返回非0

If the function fails, the return value is zero.不成功返回0

;-----------

;如果不属于加速键消息或处理失败,则进行标准的处理方案,否则以下不执行,因为该函数直接把
;消息发送到窗口过程,再进行发送
.if eax==0
invoke translatemessage,addr @stmsg
invoke dispatchmessage.addr @stmsg
.endif
.endw
ret
_winmain endp
start:
call _winmain
invoke exitprocess,null
end start

    菜单IDMENU [DISCARDABLE]
BEGIN
菜单项定义
....
END
菜单ID可以是字符型也可以是数值型,数值型ID>10000h,DISCARDABLE表示菜单不再使用的时候暂从内存释放。
MENUITEM 菜单文字,命令ID[,选荐列表]

MENUITEM SEPARATOR分隔条

POPUP 菜单文字[,选项列表]
BEGIN
item-definitions
...
END
顶层菜单
菜单文字:显示在菜单中的字符串。
命令ID:用来分辨不同的菜单项。
选项:用来定义菜单项的各种属性。
CHECKED
GRAYED:灰化
INACTIVE:禁用
MENUBREAK,MENUBARBREAK:此菜单项和以后的菜单项列到新的列中。
.386
.model flat,stdcall
option casemap:none
;---------------
include windows.inc
include user32.inc
include user32.lib
include kernel32.inc
include kernel32.lib
;-----------
ICO_MAIN EQU 1000H;图标
IDM_MAIN EQU 2000H;菜单
IDA_MAIN EQU 2000H;加速键
;-------------下面定义命令ID
IDM_OPEN EQU 4101H
IDM_OPTION EQU 4102H
IDM_EXIT EQU 4103H
......................
IDM_ABOUT EQU 4302H
;--------------------命令ID定义完毕
;------变量
.DATA?
hinstance dd ?
hwinmain dd ?
hmenu dd?
hsubmenu dd ?
;--------常量
.const
szclassname db 'menu example',0
szcaptionmain db 'menu',0
szmenuhellp db '帮助主题(&H)',0
szmenuabout db '关于本程序(&A)....',0
szcaption db '菜单选择',0
szformat db '您选择了菜单命令%08x',0
;---------代码段
.code
_displaymenuitem proc _dwcommandid;显示当前选择的菜单命令
local @szbuffer[256]:byte
pushad

invoke wsprintf,addr @szbuffer,addr szformat,_dwcommandid

;关于wsprintf函数

The wsprintf function formats and stores a series of characters andvalues in a buffer. Any arguments are converted and copied to theoutput buffer according to the corresponding format specificationin the format string. The function appends a terminating nullcharacter to the characters it writes, but the return value doesnot include the terminating null character in its charactercount.
格式化一系列的字符和值在缓冲区内,函数将一个终止的NULL字符插入字符的后面,返回 字符个数,不包括终止符。
语法:
int wsprintf(
LPTSTR lpOut,
LPCTSTR lpFmt,
...
);


lpOut缓冲区
[out] Pointer to a buffer to receive the formatted output. Themaximum size of the buffer is 1024 bytes.
lpFmt
含格式化控制符的字符串
[in] Pointer to a null-terminated string that contains theformat-control specifications. In addition to ordinary ASCIIcharacters, a format specification for each argument appears inthis string. For more information about the format specification,see the Remarks section.

被格化后插入上述字符串中的参数(可以有多个参数,随着上述字符串所含格式化控制符数量而定)
[in] Specifies one or more optional arguments. The number and typeof argument parameters depend on the corresponding format-controlspecifications in the lpFmt parameter.
 格式化规范如下
A format specification has the following form:

%[-][
[img][width][.precision]type
Field Meaning 以上规范中字段的意义
– Pad the output with blanks or zeros to the right to fill thefield width, justifying output to the left. If this field isomitted, the output is padded to the left, justify填充ing it to theright.
-:输出有左边开始的,用空格或0右填充宽度,如果没有这个则左填充。
[/img]
Prefix hexadecimal values with 0x (lowercase) or 0X(uppercase).
将数字用16进制格式0x或oX前缀
0 Pad the output value with zeros to fill the field width. If thisfield is omitted, the output value is padded with blankspaces.
用0填充宽度,没有这个参数用空格填充
width: Copy the specified minimum number of characters to theoutput buffer. The width field is a nonnegative integer. The widthspecification never causes a value to be truncated; if the numberof characters in the output value is greater than the specifiedwidth, or if the width field is not present, all characters of thevalue are printed, subject to the precision specification.
复制指定最小数量的字符到缓冲区中,但是如字符的实际宽度比指定最小数量还大,或这个参数缺省,所有字符被输出。

.precision :For numbers, copy the specified minimum number ofdigits to the output buffer. If the number of digits in theargument is less than the specified precision, the output value ispadded on the left with zeros. The value is not truncated when thenumber of digits exceeds the specified precision. If the specifiedprecision is 0 or omitted entirely, or if the period (.) appearswithout a number following it, the precision is set to 1.

数字的精确度
复制指定最小位数的数字到缓冲区中,但是如数字的实际位数比指定最小数量还小,用0从左边填充,实际位数超过指定,则值不会被删短,如果说指定为0或这个参数缺省,或这个参数指定时,该参数其小数点没有数字,则精确度为1,对于字符来说是复制最大数量的字符。

type Output the corresponding argument as acharacter, a string, or a number. This field can be any of thefollowing values.
type就是指输出到缓冲区的类型。
Value Meaning
c Single character. This value is interpreted as type WCHAR if thecalling application defines Unicode and as type __wchar_totherwise.
C Single character. This value is interpreted as type __wchar_t ifthe calling application defines Unicode and as type WCHARotherwise.
d Signed decimal integer. This value is equivalent to i.带符号的整数
hc, hC Single character. The wsprintf function ignores characterarguments with a numeric value of zero. This value is alwaysinterpreted as type __wchar_t, even when the calling applicationdefines Unicode.
hd Signed short integer argument.
hs, hS String. This value is always interpreted as typeLPSTR(被指定为lpstr类型), even when the calling application definesUnicode.
hu Unsigned short integer.
i Signed decimal integer. This value is equivalent to d.十进制整数
lc, lC Single character. The wsprintf function ignores characterarguments with a numeric value of zero. This value is alwaysinterpreted as type WCHAR, even when the calling application doesnot define Unicode.
ld Long signed integer. This value is equivalent to li.
li Long signed integer. This value is equivalent to ld.
ls, lS String. This value is always interpreted as typeLPWSTR(被指定为LPWSTR类型), even when the calling application does notdefine Unicode. This value is equivalent to ws.
lu Long unsigned integer.长整型无符号整数
lx, lX Long unsigned hexadecimal integer in lowercase oruppercase.
p Windows 2000/XP: Pointer. The address is printed usinghexadecimal. (16进制的指针类型)
s String. This value is interpreted as type LPWSTR when the callingapplication defines Unicode and as type LPSTR otherwise.
S String. This value is interpreted as type LPSTR when the callingapplication defines Unicode and as type LPWSTR otherwise.
u Unsigned integer argument. 无符号整数
x, X Unsigned hexadecimal integer in lowercase or uppercase.无符号16进制


To use buffers larger than 1024 bytes, use_snwprintf当缓冲区超过1024bytes时用_snwprintf
 接着1的程序

invoke messagebox,hwinmain,addr @szbuffer,offsetszcaption,MB_OK
popad;将前面保存的寄存器值复原,PUSHAD指令是把32位的通用寄存器全部入栈,入栈顺序为EAX,ECX,EDX,EX,质量保证执行前的ESP、
EBP、ESI、EDI。出栈顺序相反。
ret
_displaymenuitem endp

;退出
_quit proc
invoke destroywindow,hwinmain
invoke postquitmessagfe,null
ret
_quit endp
;窗口过程
_procwinmain proc uses ebx edi esi hwnd,umsg,wparam,lparam
local @stpos:point
local @hsysmenu

mov eax,umsg

.if eax==WM_CREATE

invokegetsubmenu,hmenu,1;得到第2个子菜单的句柄也就是查看,hmenu为总菜单的句柄。总菜单句柄用getmenu得到
mov hsubmenu,eax

;得到系统菜单并在系统菜单上增加自己的菜单即在系统菜单中的还原,移动等下面增加

invoke getsystemmenu,hwnd,false;

;-------------------------
;关于getsystemmenu访问系统菜单或控制菜单
Syntax

HMENU GetSystemMenu(
HWND hWnd,
BOOL bRevert
);
如果bRevert为true则将窗口菜单重置到缺省标准状态,以前的菜单销毁,返回NULL;为FALSE,则返回系统菜单拷贝的句柄。
这里的菜单项发送wm_syscommand消息。

;----------
mov @hsysmenu,eax
invoke appendmenu,@hsysmenu,MF_SPARATOR,0,NULL;在系统菜单里增加分隔符
invoke appendmenu,@hsysmenu,0,IDM_HELP,offsetszmenuhelp;增加‘帮助主题’菜单项
invoke appendmenu,@hsysmenu,0,IDM_ABOUT,offsetszmenuabout;增加‘关于本程序’菜单项
;----------
;关于appendmenu
;----------msdn
The AppendMenu function appends a new item to the end of thespecified menu bar, drop-down menu, submenu, or shortcut menu. Youcan use this function to specify the content, appearance, andbehavior of the menu item.

Syntax

BOOL AppendMenu(
HMENU hMenu,
UINT uFlags,
UINT_PTR uIDNewItem,
LPCTSTR lpNewItem
);
Parameters

hMenu
[in] Handle to the menu bar, drop-down menu, submenu, or shortcutmenu to be changed.
=================================================
uFlags
[in] Specifies flags to control the appearance and behavior of thenew menu item. This parameter can be a combination of the valueslisted in the following
Value Description
MF_BITMAP Uses a bitmap as the menu item. The lpNewItem parametercontains a handle to the bitmap.
MF_CHECKED Places a check mark next to the menu item. If theapplication provides check-mark bitmaps (see SetMenuItemBitmaps,this flag displays the check-mark bitmap next to the menuitem.
MF_DISABLED Disables the menu item so that it cannot be selected,but the flag does not gray it.
MF_ENABLED Enables the menu item so that it can be selected, andrestores it from its grayed state.
MF_GRAYED Disables the menu item and grays it so that it cannot beselected.
MF_MENUBARBREAK Functions the same as the MF_MENUBREAK flag for amenu bar. For a drop-down menu, submenu, or shortcut menu, the newcolumn is separated from the old column by a vertical line.
MF_MENUBREAK Places the item on a new line (for a menu bar) or in anew column (for a drop-down menu, submenu, or shortcut menu)without separating columns.
MF_OWNERDRAW Specifies that the item is an owner-drawn item. Beforethe menu is displayed for the first time, the window that owns themenu receives a WM_MEASUREITEM message to retrieve the width andheight of the menu item. The WM_DRAWITEM message is then sent tothe window procedure of the owner window whenever the appearance ofthe menu item must be updated.
MF_POPUP Specifies that the menu item opens a drop-down menu orsubmenu. The uIDNewItem parameter specifies a handle to thedrop-down menu or submenu. This flag is used to add a menu name toa menu bar, or a menu item that opens a submenu to a drop-downmenu, submenu, or shortcut menu.
MF_SEPARATOR Draws a horizontal dividing line. This flag is usedonly in a drop-down menu, submenu, or shortcut menu. The linecannot be grayed, disabled, or highlighted. The lpNewItem anduIDNewItem parameters are ignored.
MF_STRING Specifies that the menu item is a text string; thelpNewItem parameter is a pointer to the string.
MF_UNCHECKED Does not place a check mark next to the item(default). If the application supplies check-mark bitmaps (seeSetMenuItemBitmaps), this flag displays the clear bitmap next tothe menu item.


The following groups of flags cannot be used together:


MF_BITMAP, MF_STRING, and MF_OWNERDRAW
MF_CHECKED and MF_UNCHECKED
MF_DISABLED, MF_ENABLED, and MF_GRAYED
MF_MENUBARBREAK and MF_MENUBREAK

===========================
uIDNewItem
[in] Specifies either the identifier of the new menu item or, ifthe uFlags parameter is set to MF_POPUP, a handle to the drop-downmenu or submenu.


lpNewItem
[in] Specifies the content of the new menu item. The interpretationof lpNewItem depends on whether the uFlags parameter includes theMF_BITMAP, MF_OWNERDRAW, or MF_STRING flag, as shown in thefollowing table.


MF_BITMAP
Contains a bitmap handle.
MF_OWNERDRAW
Contains an application-supplied value that can be used to maintainadditional data related to the menu item. The value is in theitemData member of the structure pointed to by the lParam parameterof the WM_MEASUREITEM or WM_DRAWITEM message sent when the menu iscreated or its appearance is updated.
MF_STRING
Contains a pointer to a null-terminated string.
Return Value

If the function succeeds, the return value is nonzero. If thefunction fails, the return value is zero. To get extended errorinformation, call GetLastError.

;------------
【具身算法】VLA算法-Diffusion Policy 《扩散策略:多模态机器人控制的新方法》摘要 本文提出了一种基于扩散模型的机器人控制策略(DiffusionPolicy),用于解决视觉运动控制中的多模态行为、高维动作空间和训练稳定性问题。该方法利用去噪扩散概率模型(DDPM)生成动作序列,通过迭代优化处理复杂动作分布,显著提升了性能。实验表明,在15项机器人操作任务中,扩散策略平均性能提升46.9%,有效解决了传统显式/隐式策略的局限性。其核心优势在于:1)优雅建模多模态动作分布;2)适应高维动作空间;3)训练过程稳定。未来工作将探索与强化学习的结合及计算 阅读详情

相关推荐

UE5.4像素流送实战:GPU驱动、WebRTC与系统级调优全解析

像素流送是将实时3D渲染画面通过WebRTC编码推流至浏览器的关键技术,其本质是GPU硬件编码(如NVENC)与低延迟网络传输(UDP+BBR)的深度协同。理解其原理需跨越图形API(Vulkan/DX12)、实时音视频(H.264/H.265)、WebRTC信令与NAT穿透四大技术层。技术价值在于突破终端算力限制,支撑远程工业仿真、云VR看房等高交互场景;但落地难点集中于基础设施层——如NVIDIA驱动与UE5.4.3的CUDA Toolkit 12.2兼容性、Linux内核TCP/UDP参数调优、GPU

weixin_32943857的博客 616

Python自动操作电脑|pywin32

在windows系统上用Python脚本完成自动化办公,提高办公效率,消灭重复性劳动

yurensan的博客 2677

NUS-WIDE-10K数据集制作

NUS-WIDE是一个多标签数据集,数据集中一共包含26,9648个样本,可以分为81个类。最近在做跨模态检索项目,发现有很多论文里面都用到了NUS-WIDE-10K数据集,但是在网上也没有搜索到相关的数据集下载链接或者是数据集制作代码,所以自己动手写了一个NUS-WIDE-10K数据集的制作代码。 1.介绍 我在网上找到的最早关于NUS-WIDE-10K数据集描述的论文是:Cross-modal Retrieval with Correspondence Autoencoder。描述如下:作者选择了N

weixin_44012382的博客 4203

python 桌面级快捷键

可以直接copy到.txt记事本并通过迅雷云盘下载包并运行的python 全局键盘监听hook及桌面级快捷键应用

I_say_lie的博客 959

保姆级避坑指南:用Keil和J-Flash搞定凌思微LE5010蓝牙芯片的首次程序下载

本文提供了一份详细的保姆级避坑指南,帮助开发者使用Keil和J-Flash工具完成凌思微LE5010蓝牙芯片的首次程序下载。文章重点解决了算法文件混淆、协议栈漏烧和仿真器连接异常等常见问题,并详细介绍了开发环境配置、协议栈烧录和下载接口的物理层奥秘,助力开发者高效完成蓝牙开发任务。

weixin_28739079的博客 471

吊打BEVFormer!GaussianBeV实战:用3D高斯开启BEV分割新范式

GaussianBeV是一种基于3D高斯建模的BEV分割新方法,在自动驾驶感知任务中实现了SOTA性能。其核心创新在于将场景元素表示为3D高斯分布,通过均值、协方差和权重精确描述物体位置、形状和置信度,相比传统BEV方法具有更强的空间建模能力。文章详细介绍了GaussianBeV的原理、环境配置、训练推理流程及其在自动驾驶和城市3D重建中的应用,并讨论了优化方向和未来发展趋势。该方法在nuScenes等数据集上表现出色,为BEV分割任务提供了新的解决方案。

m0_71589036的博客 106

Win32基础

先release生成,再把静态库头文件 .lib文件和.dll文件复制到目标项目路径下,再添加现有项–>(添加头文件)源文件中声明头文件(#include "MyTool.h)–>**//vs2019步骤:**创建一个静态库(删掉代码中的示例函数,因为它没用)->头文件右键->添加->新建项。先release生成,再把静态库的.h文件和.lib文件复制到目标项目路径下->右键头文件再添加现有项–>它告诉链接器调用的函数在哪个d中,函数执行代码在d中的什么位置。当我们在程序中引用了一个.h文件里面的函数,

m0_67787176的博客 577

深度学习笔记——前向传播与反向传播、神经网络(前馈神经网络与反馈神经网络)、常见算法概要汇总

本文简要介绍深度学习的前向传播与反向传播,以及前馈神经网络与反馈神经网络。

haopinglianlian的博客 3045

孙鑫VC++深入详解(5):菜单

1、菜单命令响应函数  弹出式菜单(子菜单)Popup属性为true,其ID不能编辑,没有菜单命令响应函数;非弹出式菜单(菜单项)Popup属性为false,可以编辑其ID,可以为其设置菜单命令响应函数。  一般菜单资源ID前缀设为IDM_,光标资源ID前缀设为IDC_,图标资源ID前缀设为IDI_....... 右击菜单项为其添加菜单命令响应函数,消息类型选择COMMAND,类列表选择CM

milanleon的专栏 2366

《爬虫和逆向教程》 - 专栏介绍和目录

本专栏为爬虫初学者和进阶开发者量身定制的爬虫和逆向学习园地。为你提供全面而深入的爬虫和逆向技术指导,从入门到精通,从基础理论到高级实战,助你在数据的海洋中畅游,挖掘出有价值的信息。通过本专栏的学习,你将具备独立开发和优化爬虫程序的能力,及逆向分析能力和项目开发能力,成为爬虫领域的佼佼者。

数据知道的博客 2万+

SST专题(2-2)MMC-SST 输入级的工作原理及数学模型

本文研究了MMC-SST和iMMC-SST的电路结构及工作原理。系统由前级MMC电路和后级DC/DC电路组成,MMC负责电能转换和能量存储,DC/DC电路进行电压电流调节。重点分析了半桥型子模块(SM)的开关组态和工作原理,建立了平均值模型,推导了上下桥臂电压方程和环流特性。研究表明,通过合理控制子模块充放电模态可维持端口电压平衡,上下桥臂电压调控可影响网侧功率吸收,而环流特性对中压直流侧电压具有重要影响。

嵌入式老牛的博客 774

创建弹出式菜单

创建弹出式菜单时,先创建一个菜单资源,然后调用LoadMenu方法加载菜单资源。 BOOL LoadMenu( LPCTSTR lpszResourceName ); BOOL LoadMenu( UINT nIDResource ); 返回值:如果菜单资源装载成功,则返回非零值,否则为0。 参数: lpszResourceName指向一个空终止的字符串,该字符串包含了要

优快云zhwk的博客 2425

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

汇编语言全接触-61.Win32汇编教程五

其中,加速键ID是我们在程序中用LoadAccelerator装入加速键的资源编号,下面的每一项定义了一个键,VK_F1表示用F1,“A”表示键A,下面的VIRTKEY是必需的,再下面的CONTROL“或SHIFT、ALT”表示用CONTROL键组合,也就是说,如果你定义了:"C",IDM_COPY,VIRTKEY,CONTROL 而且在菜单定义中定义了 menuitem "拷贝",IDM_COPY,那么,你在程序中按下Ctrl-C实际上就是执行了菜单项“拷贝”。

qq_41237850的博客 1102

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Win32汇编--如何使用资源 [菜单和加速键]

使用资源 —— 菜单和加速键     主菜单,顶层菜单,弹出式菜单,子菜单,右键弹出式菜单,系统弹出式菜单。菜单中的菜单项有好几种,从资源定义的角度来看,分隔用的横线也是一个菜单项,除横线外其他菜单项可以供用户选择,也可以设置为“禁止”或“灰化”状态暂时停用。   菜单项上的圆点表示选中标记是互斥的,对钩表示是不互斥的。   加速键就是菜单项的快捷键。表示当窗口是激活的时候

new blog: www.burningcodes.net 4248

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Win32汇编--使用资源--菜单和加速键

使用资源 —— 菜单和加速键 主菜单,顶层菜单弹出式菜单,子菜单右键弹出式菜单系统弹出式菜单 菜单中的菜单项有好几种,从资源定义的角度来看,分隔用的横线也是一个菜单项,除横线外其他菜单项可以供用户选择,也可以设置为“禁止”或“灰化”状态暂时停用。 菜单项上的圆点表示选中标记是互斥的,对钩表示是不互斥的。 加速键就是菜单项的快捷键。表示当窗口是激活的时候,不必打开菜单,直接按快捷键就相当于选择了菜单

1470

Win32汇编教程5-菜单和加速键的使用

<br />本节的内容是上一节内容的扩展,所以示范的源程序是在上一节的基础上扩展的。<br /><br /> 有关菜单和加速键<br /><br />     菜单是Windows标准界面的最重要的组成部分,窗口的菜单条位于标题栏的下方,这个菜单通常被称为主菜单,列在主菜单下面的菜单项被称为下拉式菜单, 或弹出式菜单、子菜单等,而在标题栏左边的图标上点击也会弹出一个菜单,叫做系统菜单。加速键实际上是菜单项的快捷键,应用程序常在菜单项的右边标出激活 这个菜单项的快捷键,这就是加速键。菜单的结构是

Dark Night 709

win32 015使用菜单和加速键

.rc   资源     //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #include   //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #define ICO_MAIN  0x1000 //图标 /

刘明智的专栏 798

Win32汇编教程五 菜单和加速键的使用

--------------------------------------------------------------------------------有关菜单和加速键菜单是Windows标准界面的最重要的组成部分,窗口的菜单条位于标题栏的下方,这个菜单通常被称为主菜单,列在主菜单下面的菜单项被称为下拉式菜单,或弹出式菜单、子菜单等,而在标题栏左边的图标上点击也会弹出一个菜单,叫做系统菜单

蝈蝈俊.net 2644

win32汇编程序设计中菜单资源的定义

1.菜单的基本概念 如下图所示,在窗口中,菜单位于标题栏下边。这个菜单称为"主菜单"或者"顶层菜单",图中菜单的菜单项有"文件"、"查看"和"帮助"。单机主菜单上的项目后,可以弹出下一层菜单,叫做"弹出式菜单"或"子菜单"。子菜单中可以继续包含下一层子菜单。如单机"查看"弹出一个自子菜单后,再单机其中的"工具栏"可以继续弹出一个子菜单。在子菜单中可以继续弹出下一层子菜单的菜单项最...

paradox_1_0的博客 588

Win32汇编教程五:菜单和加速键的使用

有关菜单和加速键菜单是Windows标准界面的最重要的组成部分,窗口的菜单条位于标题栏的下方,这个菜单通常被称为主菜单,列在主菜单下面的菜单项被称为下拉式菜单,或弹出式菜单、子菜单等,而在标题栏左边的图标上点击也会弹出一个菜单,叫做系统菜单。加速键实际上是菜单项的快捷键,应用程序常在菜单项的右边标出激活这个菜单项的快捷键,这就是加速键。菜单的结构是可嵌套的,也就是说,你可以在选择一个菜单项时弹

zhangkala的专栏 1017

《WINDOWS 环境下32位汇编语言程序设计》第5章 使用资源(1)

菜单、图标与对话框都是可执行文件的组成部分,它们是以资源的形式存放在文件中的。但这些资源并不在源代码的数据段中定义,而是由链接程序放入文件的单独一个节区中,当运行中要用到资源的时候,必须借助API函数装入后才能使用。除了菜单、图标与对话框,Windows中还有其他一些类型的资源,它们是:● 菜单和加速键● 光标和图标● 位图● 对话框● 字符串资源● 版本信息● 自定义资源。本章介绍Win32程序使用这些资源。

chenyijun的专栏 1038

Win32汇编教程五

有关菜单和加速键     菜单是Windows标准界面的最重要的组成部分,窗口的菜单条位于标题栏的下方,这个菜单通常被称为主菜单,列在主菜单下面的菜单项被称为下拉式菜单,或弹出式菜单、子菜单等,而在标题栏左边的图标上点击也会弹出一个菜单,叫做系统菜单。加速键实际上是菜单项的快捷键,应用程序常在菜单项的右边标出激活这个菜单项的快捷键,这就是加速键。菜单的结构是可嵌套的,也就是说,

hnhbdss的专栏 798

VC++运行时库与可再发行组件:Windows开发依赖管理的核心

在Windows平台软件开发中,动态链接库(DLL)和运行时库是构建可执行程序的基础组件。其核心原理在于将通用功能代码封装为共享库,实现代码复用、减小程序体积并便于统一更新。这一机制的技术价值在于提升开发效率、保证系统稳定性,并简化软件分发流程。在桌面应用、游戏及系统工具等场景中,开发者必须正确处理运行时库依赖,否则会导致“找不到MSVCP140.dll”等常见错误。本文聚焦于VC++生态中的运行时库与可再发行组件包,深入解析其版本绑定机制、平台匹配原则及静默安装方式,帮助开发者从根本上解决软件部署中的依赖

all00747的博客 320

MFC工程框架深度解析:从核心原理到现代化改造实战

在Windows桌面应用开发领域,文档-视图架构是一种经典的软件设计模式,它实现了数据模型与用户界面的分离,提升了代码的可维护性和复用性。其核心原理在于通过明确的职责划分,让文档类专注于数据管理与持久化,视图类负责数据呈现与用户交互,框架类则协调两者并管理应用程序生命周期。这一设计思想在微软基础类库(MFC)中得到了经典实现,为无数遗留系统提供了稳定基石。理解MFC的工程框架,不仅有助于掌握Windows桌面应用的传统设计哲学,更能为维护和现代化改造那些仍在服役的核心业务系统提供关键支撑。本文将从工程结构与

weixin_30432579的博客 467

Win32之菜单和库

1.1 概念分类1、静态菜单:在菜单资源编辑器预先编辑好2、动态菜单:在程序运行的过程中通过代码生成3、快捷菜单:是前两种菜单的组合,在菜单资源编辑器中预先编辑好,然后在程序运行的过程中动态显示菜单项菜单里面的每一个元素都是一个菜单项菜单项包含两个最基本的要素:1、菜单项名字,2、该菜单项唯一的标识ID每一个菜单项还可以是嵌套的子菜单数组1.2 操作@1 点击资源文件中的”菜单和库.rc*"@2 鼠标右击Menu->选择添加资源或者直接插入然后就可以直接编辑了。

weixin_73548574的博客 1174

TrackPopupMenu

函数功能:该函数在指定位置显示快捷菜单,并跟踪菜单项的选择。快捷菜单可出现在屏幕上的任何位置。 函数原型:BOOL TrackPopupMenu(HMENU hMenu,UINT uFlags,int x,int y,int nReserved,HWND hWnd,CONST RECT* prcRect);  参数一览 hMenu:被显示的快捷菜单的句柄。此句柄可为调用Cre...

weixin_33834075的博客 449
上一篇: WIN32汇编学习应用之defwindowproc
下一篇: win32汇编-送消息给其它应用程序
deepfuture
博客等级 码龄17年 211粉丝 1287原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值