1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #include <windows.h>
#define OLD_CONSOLE_TITLE_BUFFER_SIZE 1024
#define NEW_CONSOLE_TITLE_BUFFER_SIZE 22
int main(int argc,char *argv[]) {
HWND hCon;
char newTitle[NEW_CONSOLE_TITLE_BUFFER_SIZE];
char oldTitle[OLD_CONSOLE_TITLE_BUFFER_SIZE];
if (argc!=3)
return 1;
GetConsoleTitle(oldTitle,OLD_CONSOLE_TITLE_BUFFER_SIZE);
sprintf(newTitle,"%d/%d",GetTickCount(),GetCurrentProcessId());
SetConsoleTitle(newTitle);
Sleep(40);
hCon=FindWindow(NULL,newTitle);
SetConsoleTitle(oldTitle);
SetWindowPos(hCon,NULL,atoi(argv[1]),atoi(argv[2]),0,0,SWP_NOZORDER|SWP_NOSIZE);
return 0;
} |
Partager