- 浏览: 4333451 次
- 性别:
- 来自: 湛江
博客专栏
-
SQLite源码剖析
浏览量:79428
-
WIN32汇编语言学习应用...
浏览量:68376
-
神奇的perl
浏览量:101498
-
lucene等搜索引擎解析...
浏览量:281206
-
深入lucene3.5源码...
浏览量:14608
-
VB.NET并行与分布式编...
浏览量:65559
-
silverlight 5...
浏览量:31320
-
算法下午茶系列
浏览量:45206
文章分类
最新评论
-
yoyo837:
counters15 写道目前只支持IE吗?插件的东西是跨浏览 ...
Silverlight 5 轻松开启绚丽的网页3D世界 -
shuiyunbing:
直接在前台导出方式:excel中的单元格样式怎么处理,比如某行 ...
Flex导出Excel -
di1984HIT:
写的很好~
lucene入门-索引网页 -
rjguanwen:
在win7 64位操作系统下,pygtk的Entry无法输入怎 ...
pygtk-entry -
ldl_xz:
http://www.9958.pw/post/php_exc ...
PHPExcel常用方法汇总(转载)
2个函数
invoke postmessage,hwnd,msg,wparam,lparam
invoke sendmessage,hwnd,msg,wparam,lparam
对于不同的MSG,WPARAM和LPARAM所代表的信息是不同的
1、postmessage
MSDN
The PostMessage function places (posts) a message in the messagequeue associated with the thread that created the specified windowand returns without waiting for the thread to process themessage.
这个函数将消息送到指定窗口的线程后马上返回而不等待,sendmessage必须等该消息被处理后才能返回。
To post a message in the message queue associate with a thread, usethe PostThreadMessage function.
Syntax
BOOL PostMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
Parameters
hWnd
[in] Handle to the window whose window procedure is to receive themessage. The following values have special meanings.
HWND_BROADCAST
The message is posted to all top-level windows in the system,including disabled or invisible unowned windows, overlappedwindows, and pop-up windows. The message is not posted to childwindows
送给系统的的所有顶层主窗口,不会送到子窗口
.
NULL
The function behaves like a call to PostThreadMessage with thedwThreadId parameter set to the identifier of the currentthread.
Msg
[in] Specifies the message to be posted.
wParam
[in] Specifies additional message-specific information.
lParam
[in] Specifies additional message-specific information.
Return Value
If the function succeeds, the return value is nonzero.成功返回非0
If the function fails, the return value is zero. To get extendederror information, call GetLastError. 错误返回0
Remarks
Messages in a message queue are retrieved by calls to theGetMessage or PeekMessage function.
Applications that need to communicate using HWND_BROADCAST shoulduse the RegisterWindowMessage function to obtain a unique messagefor inter-application communication.
The system only does marshalling for system messages (those in therange 0 to WM_USER). To send other messages (those above WM_USER)to another process, you must do custom marshalling.
If you send a message in the range below WM_USER to theasynchronous message functions (PostMessage, SendNotifyMessage, andSendMessageCallback), its message parameters cannot includepointers. Otherwise, the operation will fail. The functions willreturn before the receiving thread has had a chance to process themessage and the sender will free the memory before it isused.
Do not post the WM_QUIT message using PostMessage; use thePostQuitMessage function.
Windows 2000/XP: There is a limit of 10,000 posted messages permessage queue. This limit should be sufficiently large. If yourapplication exceeds the limit, it should be redesigned to avoidconsuming so many system resources. To adjust this limit, modifythe following registry key:
2、SendMessage Function
--------------------------------------------------------------------------------
The SendMessage function sends the specified message to a window orwindows. It calls the window procedure for the specified window anddoes not return until the window procedure has processed themessage.
发送消息给窗口,并调用指定窗口的窗口过程,到窗口过程处理该消息才返回。
To send a message and return immediately, use theSendMessageCallback or SendNotifyMessage function. To post amessage to a thread's message queue and return immediately, use thePostMessage or PostThreadMessage function.
Syntax
LRESULT SendMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
Parameters
hWnd
[in] Handle to the window whose window procedure will receive themessage. If this parameter is HWND_BROADCAST, the message is sentto all top-level windows in the system, including disabled orinvisible unowned windows, overlapped windows, and pop-up windows;but the message is not sent to child windows.
Msg
[in] Specifies the message to be sent.
wParam
[in] Specifies additional message-specific information.
lParam
[in] Specifies additional message-specific information.
Return Value
The return value specifies the result of the message processing; itdepends on the message sent.
Remarks
Applications that need to communicate using HWND_BROADCAST shoulduse the RegisterWindowMessage function to obtain a unique messagefor inter-application communication.
The system only does marshalling for system messages (those in therange 0 to WM_USER). To send other messages (those above WM_USER)to another process, you must do custom marshalling.
If the specified window was created by the calling thread, thewindow procedure is called immediately as a subroutine. If thespecified window was created by a different thread, the systemswitches to that thread and calls the appropriate window procedure.Messages sent between threads are processed only when the receivingthread executes message retrieval code. The sending thread isblocked until the receiving thread processes the message. However,the sending thread will process incoming nonqueued messages whilewaiting for its message to be processed. To prevent this, useSendMessageTimeout with SMTO_BLOCK set. For more information onnonqueued messages, see Nonqueued Messages.
==============
一个发送消息的子程序,将消息发送到打开的记事本窗口中。
szdestclass db 'notepad',0
_sndtontoepad proc _lpsz
local @hwinntoepad
pushad
invoke findwindow,addrszdestclass,null;找到指定应用程序即WINDOWS的记事本程序的句柄
===================
;关于findwindow
msdn
The FindWindow function retrieves a handle to the top-level windowwhose class name and window name match the specified strings. Thisfunction does not search child windows. This function does notperform a case-sensitive search.
获得顶层窗口的句柄,不查找子窗口,查找时不分大小写
To search child windows, beginning with a specified child window,use the FindWindowEx function.
Syntax
HWND FindWindow(
LPCTSTR lpClassName,;窗口类名
LPCTSTR lpWindowName;窗口标题名称
);
Parameters
lpClassName窗口类名
[in] Pointer to a null-terminated string that specifies the classname or a class atom created by a previous call to theRegisterClass or RegisterClassEx function. The atom must be in thelow-order word of lpClassName; the high-order word must bezero.
If lpClassName points to a string, it specifies the window classname. The class name can be any name registered with RegisterClassor RegisterClassEx, or any of the predefined control-classnames.
If lpClassName is NULL, it finds any window whose title matches thelpWindowName parameter. 如果窗口类名为NULL,则按标题名称查找
lpWindowName窗口标题名称
[in] Pointer to a null-terminated string that specifies the windowname (the window's title). If this parameter is NULL, all windownames match.
Return Value
If the function succeeds, the return value is a handle to thewindow that has the specified class name and window name.
If the function fails, the return value is NULL. To get extendederror information, call GetLastError.
Remarks
If the lpWindowName parameter is not NULL, FindWindow calls theGetWindowText function to retrieve the window name for comparison.For a description of a potential problem that can arise, see theRemarks for GetWindowText.
举例:☆☆☆☆☆☆☆☆☆
To check if the Microsoft IntelliType version 1.x software isrunning, call FindWindow as follows:
FindWindow("MSITPro::EventQueue",NULL);
To check if the IntelliType version 2.0 software is running, callFindWindow as follows:
FindWindow("Type32_Main_Window", NULL);
If the IntelliType software is running, it sends WM_APPCOMMANDmessages to the application. Otherwise the application must installa hook to receive WM_APPCOMMAND messages.
☆☆☆☆☆☆☆☆☆☆
Microsoft Windows 95 or later: FindWindowW is supported by theMicrosoft Layer for Unicode (MSLU). To use this, you must addcertain files to your application, as outlined in Microsoft Layerfor Unicode on Windows 95/98/Me Systems.
===========
.if eax
mov ecx,eax
.endif
;☆☆☆☆☆☆关于childwindowfrompoint
ChildWindowFromPoint Function
--------------------------------------------------------------------------------
The ChildWindowFromPoint function determines which, if any, of thechild windows belonging to a parent window contains the specifiedpoint. The search is restricted to immediate child windows,grandchildren, and deeper descendant windows are notsearched.
获取处在父窗口指定位置的子窗口的句柄。
Syntax
HWND ChildWindowFromPoint( HWND hWndParent,
POINT Point
);
Parameters
hWndParent
[in] Handle to the parent window.
Point
[in] Specifies a POINT structure that defines the clientcoordinates (relative to hWndParent of the point to bechecked.
Return Value
The return value is a handle to the child window that contains thepoint, even if the child window is hidden or disabled. If the pointlies outside the parent window, the return value is NULL. If thepoint is within the parent window but not within any child window,the return value is a handle to the parent window.
;☆☆☆☆☆☆☆
.if eax ;获得了子窗口即编辑窗口的指针
mov @hwinnotepad,eax
mov esi,_lpsz
@@:
loadsb;将数据送向累加器,数据在ds:esi中,而movs中,目的地址为es:dsi
or al,al
movzx eax,al
invoke postmessage,@hwinnotepad,WM_CHAR,eax,1
jmp @B
@@:
.endif
popad
ret
_setndtonotepad endp
发表评论
-
win下开发跨平台GUI程序的另类选择
2011-05-03 17:21 2145GTK+ ● GTK+的网站:www.gtk. ... -
WIN32汇编之菜单、加速键、快捷键
2010-02-20 16:38 3077(一)Invoke checkmenuitem,h ... -
WIN32汇编学习应用之defwindowproc
2010-02-20 16:36 2664defwindowproc窗口过程对一些消息的默认处理方式WM ... -
windows中WM_CLOSE消息和WM_DESTORY消息的不同之处
2010-02-20 16:33 23871、WM_CLOSE仅代表用户发出了关闭的指令,但窗口过程可以 ... -
WIN32汇编获取应用程序句柄
2010-02-20 16:32 2119getmodulehandle使用方法invoke getm ... -
WIN32汇编语言学习应用之消息获取
2010-02-20 16:31 1679MSG结构:MSG STURCTHwnd DWORD ?Mes ... -
一个WIN32汇编的完整窗口入门程序的理解与注释
2010-02-20 16:28 3656;WIN32汇编的注释是;,其实WIN32汇编和VC有很多 ... -
汇编中通用寄存器的目的
2010-02-20 16:24 21001、EAX和AX:累加器,所有的I/O指令用它来与外部设备 ... -
汇编几个段
2010-02-17 16:39 4179反汇编后几个段的含义 预定义段 一个WindowsNT ... -
WIN32汇编语言解析
2010-02-17 16:36 2517win32汇编中的sizeof win32汇编中的s ... -
设置与获取窗口标题文本
2010-02-17 16:32 1959获得: CString xx=""; ... -
win32汇编快速入门
2010-02-17 16:31 4618汇编可以开发WINDOWS程序 ... -
WIN32汇编-HELLO,WORLD!
2010-02-17 16:29 4338我们用WIN32汇编构建 ... -
保护模式下段寄存器的作用
2010-02-17 14:39 31531、保护模式一,虽然在寻址上没有分段的限制问题,但对要对一个地 ... -
WIN32汇编-反汇编
2010-02-17 14:33 2745学好WIN32汇编,平时需 ... -
玩转菜单-菜单资源
2010-02-08 17:31 1893菜单资源 WINDOWS程序的菜单通常编译前定义在资 ... -
二进制资源和自定义资源使用定义
2010-02-08 17:29 21451、二进制资源 (1)定义格式: 资源IDRCDA ... -
LISTBOX和LIST CONTROL的项目增加方法
2010-02-08 17:28 53991、LIST CONTROL(report方式): (1)类 ... -
取IP寄存器的当前值
2010-02-08 17:27 1864call $+3 POP CX 把IP寄存器的当前值放 ... -
ret/retn人为改变执行地址
2010-02-08 17:27 27771、CALL和RET/RETN是一对指令,CALL把返回 ...
相关推荐
Win32应用程序虽然和其他32位应用程序(例如32位保护模式DOS程序)一样可以使用386汇编语言和保护模式编程,但是Win32应用程序的执行机制与其他32位应用程序有一定的差别,例如消息循环、动态链接等,Win32汇编语言...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书作者有十多年的汇编编程经验,很清楚初学者在哪些地方会遇到问题,所以本书在系统全面地介绍Win32汇编编程的同时,也穿插了很多作者的经验之谈,使读者能够快速入门并最终熟练地写出各种Windows应用程序。...
MASM32是面向WIN32程序开发的,MASM611是面向DOS的,MASM32不使用中断调用了,而是使用微软的应用程序开发接口API和其他高级开发语言差不多了。而MASM611才是使用中断。 解压后大约15M 而压缩后才3.4M 分享学习的...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
Windows环境下32位汇编语言是一种全新的编程语言...本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
Windows 把每一个 Win32 应用程序放到分开的虚拟地址空间中去运行,也就是说每一个应用程序都拥有其相互独立的 4GB 地址空间,当然这倒不是说它们都拥有 4GB 的物理地址空间,而只是说能够在 4GB 的范围内寻址。...
前言 ...本书主要的内容将放在32位宏汇编对比DOS汇编所不同的部分,以及Win32应用程序的汇编实现上。不求全面,只求精也!(说句老实话,也不敢对自己不精通的地方妄加评论,以免破坏自己的良好形象。
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...
《Windows环境下32位汇编语言程序设计》从编写应用程序的角度,从“HelloWorld"这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。Windows环境下32位...
本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是...