有答案今天结贴-怎么取得控制台左上角在屏幕上的坐标

有答案今天结贴-----如何取得控制台左上角在屏幕上的坐标
我写了一个控制台程序,想知道控制台的左上角在电脑显示屏的坐标,如何实现

------解决方案--------------------
#include <windows.h>
#include <tchar.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
TCHAR szClassName[] = _T( "ConsoleWindowClass ");
HWND hwnd;
RECT rect;

hwnd = NULL;
do
{
hwnd = FindWindowEx(NULL,hwnd,szClassName,NULL);
if (hwnd != NULL)
{
GetWindowRect(hwnd,&rect);
printf( "hwnd = %u (%d,%d)--(%d,%d)\n ",
hwnd,rect.left,rect.top,rect.right,rect.bottom);
}
}while(hwnd != NULL);
printf( "Hello World!\n ");
return 0;
}

------解决方案--------------------
GetWindowRect(hwnd,&rect);
ClientToScreen(hwnd,&rect); // 关键点,转换为屏幕坐标