code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "shellapi.h"#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
POINT pt;
HWND hwnd;
char m1[40];
RECT r1;
GetCursorPos (&pt);
hwnd = WindowFromPoint(pt);
GetClassName(hwnd, m1, 39);
GetWindowRect (hwnd, &r1);
Edit1->Text = IntToStr (r1.top);
Edit2->Text = IntToStr (r1.left);
Edit3->Text = IntToStr (r1.right);
Edit4->Text = IntToStr (r1.bottom);
Edit5->Text = m1;
}
//---------------------------------------------------------------------------