|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
求解,为什么_KenInitdial执行完之后,无法正确保存hDest,当执行子程序BT_ReadInfo,hDest是另外一个值?
.386
.model flat, stdcall
option casemap :none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Equ 等值定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DLG_Main equ 1000
IDB_1 equ 1
GB_GameInfo equ 1001
GB_WinInfo equ 1002
STC_Table equ 1003
STC_Seat equ 1004
BT_SelTable equ 1005
BT_SelSeat equ 1006
ED_TableInfo equ 1007
ED_SeatInfo equ 1008
BT_GameStart equ 1009
STC_X equ 1010
STC_Y equ 1011
ED_X equ 1012
ED_Y equ 1013
BT_ReadInfo equ 1014
BT_Initdial equ 1015
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
hInstance dd ?
szBuffer dd ?
hDest dd ?;保存目标句标
stDestRect RECT <>;保存目标坐标
.const
szDestCap db '无标题 - 记事本',0;目标标题
szMeDestFind db 'The handle you are finding is %x',0
szShow db '这是:%x',0
szMeCap db '123',0
fmtRect db '%d',0;坐标格式化
szNotFound db 'Receive Message Window not found!',0
intRealX equ 655
intRealY equ 568
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_KenInitdial proc _hWnd,_lpszDestCap,_BT_Initdial
;找到目标窗口,保存目标句柄,更改对话框标题
pushad
invoke FindWindow,NULL,_lpszDestCap
.if eax
mov hDest,eax
invoke SetWindowText,_hWnd,addr szDestCap
invoke GetDlgItem,_hWnd,_BT_Initdial
invoke EnableWindow,eax,FALSE
.else
invoke MessageBox,NULL,offset szNotFound,offset szMeCap,MB_OK
.endif
popad
ret
_KenInitdial endp
_GameStart proc _hWnd,_stDestRect:RECT,_intRealX,_intRealY
LOCAL @GameStartRect:RECT
pushad
mov eax,_stDestRect.left
add eax,_intRealX
mov @GameStartRect.left,eax
mov eax,_stDestRect.top
add eax,_intRealY
mov @GameStartRect.top,eax
invoke SetCursorPos,@GameStartRect.left,@GameStartRect.top
popad
ret
_GameStart endp
_ProcDlgMain proc uses ebx edi esi hWnd,wMsg,wParam,lParam
mov eax,wMsg
.if eax == WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
;invoke LoadIcon,hInstance,ICO_MAIN
;invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax == WM_COMMAND
mov eax,wParam
.if ax == IDOK
invoke EndDialog,hWnd,NULL
.elseif ax == BT_Initdial
;找到目标窗口,保存句柄,更改对话框标题
invoke _KenInitdial,hWnd,addr szDestCap,BT_Initdial
invoke UpdateWindow,hWnd
.elseif ax == BT_ReadInfo
;读取目标窗口坐标,并显示
invoke GetWindowRect,hDest,offset stDestRect
invoke wsprintf,addr szBuffer,addr fmtRect,stDestRect.left
invoke MessageBox,NULL,offset szBuffer,offset szMeCap,MB_OK
invoke SetDlgItemText,hWnd,ED_X,addr szBuffer
invoke wsprintf,addr szBuffer,addr fmtRect,stDestRect.top
invoke MessageBox,NULL,offset szBuffer,offset szMeCap,MB_OK
invoke SetDlgItemText,hWnd,ED_Y,addr szBuffer
invoke UpdateWindow,hWnd
.elseif ax == BT_GameStart
;开始游戏
invoke _GameStart,hWnd,stDestRect,intRealX,intRealY
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_Main,NULL,offset _ProcDlgMain,NULL
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
|
|