浅谈【windows.h】(3)

· · 个人记录

上期回顾:

  1. 浅谈【windows.h】(1)
  1. 浅谈【windows.h】(2)
void GetClient()
{
    HWND windows;    //句柄变量,第一节中有介绍
    while(true)
    {
        windows=FindWindow(NULL,"新建文本文档.txt - 记事本");
        RECT rectangle;      //矩形变量,用于记录矩形四个角的数据
        GetClientRect(windows,&rectangle);
        printf("%d,%d,%d,%d\n",rectangle.left,rectangle.top,rectangle.right,rectangle.bottom);
        Sleep(1000);
    }
}
void GetWin()
{
    HWND windows;
    while(true)
    {
        windows=FindWindow(NULL,"新建文本文档.txt - 记事本");
        RECT rectangle;
        GetWindowRect(windows,&rect);
        printf("%d,%d,%d,%d\n",rectangle.left,rectangle.top,rectangle.right,rectangle.bottom);
        Sleep(300);
    }

}
void SleepTime(double x)
{
    Sleep(x*1000);//换算,1秒=1000毫秒
}

上一篇~~~~下一篇