Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Resize C++ console Window

  • 08-03-2003 3:02pm
    #1
    Closed Accounts Posts: 18


    Hello there,

    Can anyone tell me if its posible to resize the console window in Borland C++ Builder 4 from within the code. I'm trying to make it bigger than the default size.


    Thanks in advance.


Comments

  • Closed Accounts Posts: 189 ✭✭Kenshin


    I don't think you can do that from your code.


  • Registered Users, Registered Users 2 Posts: 1,372 ✭✭✭silverside


    I Remember reading about this in one of Mike Blazcksak's books. I don't think there is a simple way; you may be able to kludge it by doing a FindWindow() call using the command window title which will be something like c:\\mydir\\myapp.exe and sending a series of WM_COMMAND messages to emulate the menu items which do the same thing, there may be some other specific windows APIs to do the same thing.

    Just curious, why do you want to anyway?


  • Closed Accounts Posts: 18 Fergal20


    I have to display a graph on the console screen and I want the screen to be bigger!


  • Registered Users, Registered Users 2 Posts: 6 Martial_Law


    Hiya,

    I use VC++, a little different than Borland C++ 4.0 but it may be done in a similar manner...

    This is how you resize the window in VC++

    LRESULT CALLBACK WndProc(HWND hWnd,UINT Message,WPARAM wParam,LPARAM lParam)
    {
    static HDC hDC;
    static HGLRC hRC;
    int width,height;

    switch(Message)
    {
    case WM_CREATE://create your window
    hDC = GetDC(hWnd);
    g_HDC = hDC;
    SetUpPixelFormat(hDC);
    //set up pixel format need to write this yourself

    hRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC,hRC);
    Initialize(); //set up what is in the window

    return 0;
    break;

    case WM_CLOSE://when the window is closed
    wglMakeCurrent(hDC,NULL);
    wglDeleteContext(hRC);

    PostQuitMessage(0);
    return 0;
    break;

    case WM_SIZE:

    height = HIWORD(lParam);
    width = LOWORD(lParam);

    if(height == 0)
    height = 1;

    return 0;
    break;
    return(DefWindowProc(hWnd,Message,wParam,lParam));
    }

    That is for VC++ using a windows application...
    I'm sure it is something similar in borland

    Martial Law


Advertisement