function GetCaption(hWnd: LongWord): string;
var
szWindowText: array[0..254] of Char;
begin
SendMessage(hWnd, WM_GETTEXT, MAX_PATH, Integer(@szWindowText[0]));
Result := szWindowText;
end;
proc GetCaption hCalcp
local @Wintext:BYTE ;换成全局 @Wintext db ? 编译通过
lea eax,[@Wintext]
push eax
invoke SendMessage, [hCalcp], WM_GETTEXT, MAX_PATH,eax
pop eax
ret
endp
再讲你的错误
#define WM_GETTEXT 0x000D Parameters wParam The maximum number of characters to be copied, including the terminating null character.
ANSI applications may have the string in the buffer reduced in size (to a minimum of half that of the wParam value) due to conversion from ANSI to Unicode.
lParam A pointer to the buffer that is to receive the text.