I'm new to programming. I'm using Delphi 10.4 Community Edition. I'm trying to run the BassPlayer demo project, but I get an error when trying to compile and run it. It happens in a file named wa_ipc.pas
on line 1691. I have no idea how to fix this error.
function SendMessageRetStr(wnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): String;
var
dwProcessId: DWORD;
phandle: THandle;
P: Pointer;
C: Cardinal;
PB: Pointer;
B: Byte;
begin
Result := '';
GetWindowThreadProcessID(wnd, pointer(dwProcessId));
phandle := OpenProcess(PROCESS_VM_READ, False, dwProcessId);
if phandle = 0 then exit;
P := Pointer(SendMessage(wnd, uMsg, wParam, lParam));
PB := nil;
B := 0;
repeat
if not ReadProcessMemory(phandle,P,@PB,1,C) then break; (*<-- Error message here*)
B := Byte(PB);
if B <> 0 then begin
Result := Result + Chr(B);
end;
P := Pointer(DWord(P)+1);
until (B=0);
CloseHandle(phandle);
end;
The error I get is:
[dcc32 Error] wa_ipc.pas(1691): E2033 Types of actual and formal var parameters must be identical
Within the Winapi.Windows.pas
unit, the ReadProcessMemory()
function is declared as:
function ReadProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer; nSize: SIZE_T; var lpNumberOfBytesRead: SIZE_T): BOOL; stdcall;