我希望我的程序能够像Team Player一样工作。多个鼠标,多个光标,但只有一个焦点。但问题是我无法隐藏默认的光标。我只想让它不可见。到目前为止,这仅在我的应用程序内起作用。
有没有一种方法可以在整个系统中隐藏光标(仅在关闭应用程序之前)?
这个可以运行:(但我不能完全使用它)
ShowCursor(false);
并且
Screen.Cursor:=crNone;
有没有一种方法可以在整个系统中隐藏光标(仅在关闭应用程序之前)?
编辑: 这个方法不起作用:
procedure myShowCursor(Show :boolean);
var cursor1, cursor2: HCursor;
begin
cursor1 :=CopyIcon(Screen.Cursors[crDefault]);
cursor2 := LoadCursorFromFile('blank\blank.cur');
if Show then
SetSystemCursor(cursor1, OCR_NORMAL)
else
SetSystemCursor(cursor2, OCR_NORMAL);
end;
这个可以运行:(但我不能完全使用它)
procedure myShowCursor;
var cursor1, cursor2: HCursor;
begin
cursor1 :=CopyIcon(Screen.Cursors[crDefault]);
cursor2 := LoadCursorFromFile('blank\blank.cur');
SetSystemCursor(cursor2, OCR_NORMAL);
SetSystemCursor(cursor1, OCR_NORMAL)
end;
已解决: 通过SystemParametersInfo恢复系统光标
procedure TForm1.myShowCursor(Show :boolean);
var cursor1: HCursor;
begin
cursor1 := LoadCursorFromFile('blank\blank.cur');
if Show then
SystemParametersInfo(SPI_SETCURSORS,0,0,WM_SETTINGCHANGE or SPIF_UPDATEINIFILE )
else
SetSystemCursor(cursor1, OCR_NORMAL);
end;