我正在尝试用汇编编写一个程序,我需要的第一件事就是特定进程的主窗口的句柄。我一直在尝试使用 FindWindow 来获取它,但到目前为止还没有运气;FindWindow 显然一直返回零。谁能指出我在这里错过了什么?谢谢。
.486
.model flat, stdcall
option casemap :none
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
NtpTitle db "Untitled - Notepad",0
MsgNoNtp db "Notepad not found.",0
MsgNtp db "Found Notepad.",0
NullString db 0
hWndNtp dd 0
.code
start:
invoke FindWindow, offset NullString, offset NtpTitle
mov hWndNtp, eax
jz noNotepad
invoke MessageBox, 0, offset MsgNtp, 0, 40h
invoke ExitProcess, 0
noNotepad:
invoke MessageBox, 0, offset MsgNoNtp, 0, 10h
invoke ExitProcess, 1
end start