I cannot compile this code. Could I have a help? Thanks.
procedure ChangeOutsideDateTime(h: HWND; dt: TDateTime);
var
st: TSystemTime;
pst: Pointer;
hDTP: Cardinal;
hProc: THandle;
dwWrote: DWORD;
begin
DateTimeToSystemTime(dt, st);
pst:= VirtualAllocEx(h, nil, SizeOf(st), MEM_COMMIT, 0);
if pst <> nil then begin
if GetWindowThreadProcessId(h, hDTP) > 0 then begin
hProc:= OpenProcess(PROCESS_VM_OPERATION, false, hDTP);
if WriteProcessMemory(hProc, pst, @st, SizeOf(st), dwWrote) > 0 then begin
SendMessage(h, DTM_SETSYSTEMTIME, GDT_VALID, hDTP);
CloseHandle(hProc);
end;
end;
VirtualFreeEx(h, pst, 0, MEM_RELEASE);
end;
end;
It shows "Types of actual and formal var parameters must be identical" at line where is using "WriteProcessMemory".