Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- HWND GetConsoleHwnd()
- {
- #define MY_BUFSIZE 1024
- HWND hwndFound;
- char pszNewWindowTitle[MY_BUFSIZE];
- char pszOldWindowTitle[MY_BUFSIZE];
- GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
- wsprintf(pszNewWindowTitle,"%d/%d",
- GetTickCount(),
- GetCurrentProcessId());
- SetConsoleTitle(pszNewWindowTitle);
- Sleep(1);
- hwndFound=FindWindow(NULL, pszNewWindowTitle);
- SetConsoleTitle(pszOldWindowTitle);
- return(hwndFound);
- }
- int main()
- {
- //GetStdHandle(STD_OUTPUT_HANDLE)
- RECT r;
- POINT p;
- HWND wh=GetConsoleHwnd();
- COORD c={1,1};
- while(1){
- GetWindowRect(wh, &r);
- GetCursorPos(&p);
- //SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
- //cout << p.x - r.left << ":" << p.y - r.top << " ";
- SetCursorPosition((p.x - r.left - 9) / 8, (p.y - r.top - 30) / 12); //Для вин7
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment