using System . Runtime . InteropServices;
[ DllImport ( "User32.DLL" )]
public static extern bool SetSystemCursor( IntPtr hcur, uint id);
public const uint OCR_NORMAL = 32512 ;
public const uint OCR_IBEAM = 32513 ;
[ DllImport ( "User32.DLL" )]
public static extern bool SystemParametersInfo( uint uiAction , uint uiParam ,
IntPtr pvParam, uint fWinIni);
public const uint SPI_SETCURSORS = 87 ;
public const uint SPIF_SENDWININICHANGE = 2 ;
private void button1_Click( object sender , EventArgs e)
{
//
SetSystemCursor( Cursors . WaitCursor . CopyHandle(), OCR_NORMAL);
SetSystemCursor( Cursors . WaitCursor . CopyHandle(), OCR_IBEAM);
//..
}
private void button2_Click( object sender , EventArgs e)
{
//
SystemParametersInfo(SPI_SETCURSORS, 0 , IntPtr . Zero, SPIF_SENDWININICHANGE);
}
//------------------Delphi--------------------
procedure TForm1 . Button1Click ( Sender : TObject );
begin
SetSystemCursor ( CopyIcon ( Screen . Cursors [ crHourGlass ]), OCR_NORMAL );
SetSystemCursor ( CopyIcon ( Screen . Cursors [ crHourGlass ]), OCR_IBEAM );
end ;
procedure TForm1 . BitBtn1Click ( Sender : TObject );
begin
SystemParametersinfo ( SPI_SETCURSORS , 0 , nil , SPIF_SENDCHANGE );
end ;