当鼠标悬停在已放置在主机控件上的控件上时,我想得到鼠标的绝对坐标.例如,主机控制是一个按钮放在面板上的面板.当鼠标悬停在按钮上时,我想获得相对于面板的鼠标坐标.
我试过这个显而易见的东西,看看我得到了什么:
procedure TfmWorkingScreen.pnlScreenAreaMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
StatusBar1.SimpleText := 'Left ' + IntToStr(X) + ' Right ' + IntToStr(Y);
end;
Run Code Online (Sandbox Code Playgroud)
显然,这仅在鼠标位于面板控件上时才有效.有没有办法获得所需的坐标?
我使用RRUZ的解决方案来改善禁用图像的外观.以下摘录,例如:
procedure HookProc(Proc, Dest: Pointer; var BackupCode: TXRedirCode);
var
n: DWORD;
Code: TXRedirCode;
begin
Proc := GetActualAddr(Proc);
Assert(Proc <> nil);
if ReadProcessMemory(GetCurrentProcess, Proc, @BackupCode, SizeOf(BackupCode), n) then
begin
Code.Jump := $E9;
Code.Offset := PAnsiChar(Dest) - PAnsiChar(Proc) - SizeOf(Code);
WriteProcessMemory(GetCurrentProcess, Proc, @Code, SizeOf(Code), n);
end;
end;
Run Code Online (Sandbox Code Playgroud)
与Delphi 2007一起工作得很好,但是当我在Delphi XE10中使用它时,我得到了
E2033实际和正式var参数的类型必须相同
在调用ReadProcessMemory和WriteProcessMemory时
据我所知,类型是相同的.任何人都可以告诉我什么'需要改变?
我提前为这个模糊的问题道歉,但谁能给我一个关于这个问题的指针?
Delete 键在我的应用程序中无法正常工作。例如,Delete 键在编辑框中无效(即它不会删除突出显示的文本)但 Shift Delete 确实有效。在整个应用程序中似乎都是这种情况。我已经禁用了所有 keypreviews 和 OnKey 事件,以防它们导致它但问题仍然存在。
谁能建议我可以在哪里寻找问题?
运行 Windows 10 Delphi 10.3.3
I have been running FastMM4 on my code to see if I have any memory leaks...
This has reported a load of class UniCodeString leaks when I close the program. Are these real and how do I interpret the Event Log: This is a typical block report:
--------------------------------2020/10/21 17:32:01--------------------------------
A memory block has been leaked. The size is: 120
This block was allocated by thread 0x5648, and the stack trace (return addresses) at the time was:
430547 [FastMM4.pas][FastMM4][_ZN7Fastmm411DebugGetMemEx][8737]
409534 [System.pas][System][_ZN6System7_GetMemEx][4803] …Run Code Online (Sandbox Code Playgroud)