Good day to all.

There is an application (game) running in full window mode (the cursor is not used explicitly, i.e. hidden). There is an application written in Delphi and programmatically located on top of all windows (also hidden from the taskbar). Required.

  1. To prevent the cursor from appearing in the game when the application goes beyond the form (ideally disable / hide it completely when the application is launched). I tried ShowCursor(False) and Screen.Cursor := crNone; in the TForm1.FormPaint handler, loading an empty cursor from a file when creating a form, but when you move the mouse, the cursor still appears in the game for a while and then just disappears.

  2. So that when you hit the mouse in the limits of the form and click the game does not collapse. Tried form1.Enabled:=false but did not help.

I tried to learn the traps, but did not understand how to use them.

  • one
    Explain more clearly what you need - AseN
  • the cursor when going outside the form, which has a small size, appears in the game and disappears, it is necessary that this should not happen when you click the mouse in the game on the area where the form is located, the game collapses, it also needs to be removed - Ksen Ters

1 answer 1

 procedure TForm1.FormCreate(Sender: TObject); var rtemp,rtemp2,rtemp3,rtemp4,rtemp5,rtemp6:thandle; wx,wy,ww,wh:integer; begin windows.SetParent(form1.Handle,getdesktopwindow); SetWindowPos(form1.handle,HWND_TOPMOST,0,0,form1.Width,form1.Height,SWP_SHOWWINDOW or SWP_NOOWNERZORDER or SWP_NOZORDER); SetWindowLong(form1.handle, GWL_EXSTYLE, GetWindowLong(form1.handle, GWL_EXSTYLE) or WS_EX_LAYERED {or WS_EX_TRANSPARENT} or WS_EX_TOPMOST);; SetWindowPos(form10.handle,HWND_TOPMOST,0,0,form10.Width,form10.Height,SWP_SHOWWINDOW {or SWP_NOOWNERZORDER or SWP_NOZORDER}); wx:=200; wy:=40; //левый верхний край окна на десктоп ww:=800; wh:=600; //размеры окна на десктоп with form1 do begin rTemp := CreaterectRgn(0, 0, screen.Width, screen.Height); rTemp2 := CreaterectRgn(wx,wy+5+13,wx+ww,wy+wh-17); rTemp3 := CreaterectRgn(33,wy+25,33+72,wy+25+93); rTemp4 := CreaterectRgn(33,wy+118+46,33+72,wy+118+46+93); rTemp5 := CreaterectRgn(33,wy+257+46,33+72,wy+257+46+93); rTemp6 := CreaterectRgn(33,wy+396+46,33+72,wy+396+46+93); CombineRgn(rTemp, rTemp, rTemp2, RGN_DIFF); CombineRgn(rTemp, rTemp, rTemp3, RGN_DIFF); CombineRgn(rTemp, rTemp, rTemp4, RGN_DIFF); CombineRgn(rTemp, rTemp, rTemp5, RGN_DIFF); CombineRgn(rTemp, rTemp, rTemp6, RGN_DIFF); SetWindowRgn(form1.Handle, rTemp, True); DeleteObject(rTemp); DeleteObject(rTemp2); DeleteObject(rTemp3); DeleteObject(rTemp4); DeleteObject(rTemp5); DeleteObject(rTemp6); end; Application.OnIdle := OnIdle; end; 
  • Thanks, but this one helped: procedure TForm1.Timer1Timer (Sender: TObject); begin Scr.Handle: = GetWindowDC (GetDeskTopWindow); with Scr do begin Pen. Color: = cllime; MoveTo ... - Ksen Ters pm