Wo ist GetConsoleHandle definiert?!
-
Hallo ich will die Konsole ausblenden, nachdem ich von einer Konsolenanwendung aus nen Fenster erzeugt habe. Ich habe mich informiert und bin auf eine Funktion GetConsoleHandle bestossen, mit dessen Hilfe es möglich sein soll, das HWND der Konsole zu bekommen, um sie dann mit ShowWindow an- / abzuschalten. Leider findet mein Compiler die Funktion aber nicht, auch wenn windows.h includiert ist.
Gruß Para
-
könnte daran liegen das es die funktion nicht gibt. (zumindest kenne ich sie nicht)
aber so geht'schar szConsoleTitle[MAX_PATH]; GetConsoleTitle(szConsoleTitle, MAX_PATH); HWND hConsole = FindWindow (NULL, szConsoleTitle); ShowWindow(hConsole, SW_HIDE);
-
bool MACWindow::showConsole (bool is_shown) { if (is_shown == true) { char* ptr_ctitle = new char [256]; GetConsoleTitle (ptr_ctitle, sizeof (ptr_ctitle)); ShowWindow (FindWindow (NULL, ptr_ctitle), SW_SHOW); return true; } if (is_shown == false) { char* ptr_ctitle = new char [256]; GetConsoleTitle (ptr_ctitle, sizeof (ptr_ctitle)); ShowWindow (FindWindow (NULL, ptr_ctitle), SW_HIDE); return true; } }so klappts net....
-
Korrektur es funktioniert doch
mein fehler....Danke
-
und so ist es nur halb so lang

void MACWindow::showConsole (bool is_shown) { char *ptr_ctitle = new char [256]; GetConsoleTitle (ptr_ctitle, 256); ShowWindow (FindWindow (NULL, ptr_ctitle), (is_shown ? SW_HIDE : SW_SHOW)); }