Mega Code Archive

 
Categories / Delphi / System
 

Getting the size of the desktop

Title: Getting the size of the desktop Question: How do I find the size of the Desktop minus the taskbar? Answer: Call the Windows API function SystemParametersInfo passing the SPI_GETWORKAREA parameter along with the address of the rectangle structure to receive the coordinates. Example: procedure TForm1.Button1Click(Sender: TObject); var hRect : TRect; begin SystemParametersInfo(SPI_GETWORKAREA,0,@hRect, 0); ShowMessage(IntToStr(hRect.Top) + ' ' + IntToStr(hRect.Left) + ' ' + IntToStr(hRect.Bottom) + ' ' + IntToStr(hRect.Right)); end;