View Single Post
Old 06-12-2007, 11:37   #3
andbin
Senior Member
 
L'Avatar di andbin
 
Iscritto dal: Nov 2005
Messaggi: 5206
Quello che sono riuscito a fare tramite codice con le API Win32 è questo:

Codice:
#define STRICT
#define _WIN32_WINNT 0x0500 
#include <windows.h>

int main (void)
{
    HANDLE hStdOut;
    COORD c;
    SMALL_RECT sr;
    HWND hWnd;

    hStdOut = GetStdHandle (STD_OUTPUT_HANDLE);

    c = GetLargestConsoleWindowSize (hStdOut);

    SetConsoleScreenBufferSize (hStdOut, c);

    sr.Left = 0;
    sr.Top = 0;
    sr.Bottom = c.Y-1;
    sr.Right = c.X-1;

    SetConsoleWindowInfo (hStdOut, TRUE, &sr);

    hWnd = GetConsoleWindow ();
    SetWindowPos (hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE);

    return 0;
}
Ho omesso, per brevità, i controlli sui valori di ritorno. Però funziona. Nota: ho usato la funzione GetConsoleWindow() che è disponibile solo da Win2000 in poi.
__________________
Andrea, Senior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
Java Versions Cheat Sheet
andbin è offline   Rispondi citando il messaggio o parte di esso