Menu

how to control two console app windows?ogl

Peterka_P
2011-11-13
2012-09-26
  • Peterka_P

    Peterka_P - 2011-11-13

    Hi, I'm writing big project in dev c++ (winapi and opengl). By default in
    project settings I had win32 GUI, so only one window with opengl was showed. I
    decided to add background common window, so I can write into it some
    instructions how to control opengl app - just quick manual. In project
    settings I changed option to win32 console and everything is working fine.
    Only small problem is that, I want to make this background console window
    (with manual, not the main window) move and resize to demand location, so both
    windows can be on by one, not one partially hidden behind main window. I
    searched info, and found some helpful functions like MoveWindow and so on - it
    works, but for my main window with opengl. The first parameter for e.g
    MoveWindow(hwnd, 50, 50, 350, 350, true); should be hwnd, and in this case it
    means my main window ( if I tried against GetConsoleWindow - it says out of
    scope). The background console window is created only by selecting this option
    in project options. Is there any way to choose between main console window,
    which is selected by default and the common, background console?How to choose
    for a while the other window, use function move and make it background as it
    is for default right now?
    I appreciate your help. Thank you from mountain.

     
  • Jim Pattee

    Jim Pattee - 2011-11-14

    You should have two hwnd identifiers, one for the main window and one for the
    background.
    How did you open the background window?

     
  • Peterka_P

    Peterka_P - 2011-11-15

    That's where the problem is. I don't even create the bakground window. I just
    made app that use opengl, so in my program should be only one console window.
    But when I choose in project options - win32 console application, the
    background one appears. The main console window can be controlled, and the
    background one is just created I don't know when - it is just but selecting
    this option. When I put some commnd like cout, the text is shown in the
    background one. I don't know how to get the hwnd pointer to the background
    one, that is created by compiler?I guess

     
  • Jim Pattee

    Jim Pattee - 2011-11-15

    You are creating a windows program, not a console program.
    Instead of win32 console application, select the option for a windows program.
    The console window should disappear.

     
  • Peterka_P

    Peterka_P - 2011-11-15

    Yes, that's correct information. The point is, that I want the background,
    second console window to be showed. I already putted some info in it, about
    how to control opengl app. I need to have two consoles. All I want is to
    control size and position of background console window.

     
  • Jim Pattee

    Jim Pattee - 2011-11-15

    You cannot control the size and position of a window that is not created by
    your program.

    You can create a sub window to display the info in an edit control. As you can
    probably guess, this will be fairly time consuming.

    An easier option would be to create a HTML file and open it in the default
    browser with ShellExecuteEx().

    If you want to use the console window you will have to be satisfied with not
    being able to control it with the program.

     
  • Peterka_P

    Peterka_P - 2011-11-15

    Hmm thank you for reply. If so, the background console window cannot be
    controlled, I'll try to move the main one, so they can be both one by one.
    It's not good solution I think, because that background console window, is
    controlled (position) by operating system, but every time I see it's in left-
    top corner of screen ( 50px, 50px as I good remember). Maybe it will work
    good, I'll see.

     
  • Jim Pattee

    Jim Pattee - 2011-11-16

    You can set the size and position of the console window manually. Right click
    on the top bar and select Properties. The Layout tab has size and position.

     
  • Peterka_P

    Peterka_P - 2011-11-16

    Yes, but I doubt. that common user of my app will make it manually. But never
    mind, if I cannot control it from my program lines, I'll figure out something
    else. Good to know about what You say, thank you for help. In meantime I will
    post some new problem about closing application - x button on opengl console
    window doesn't kill the program process, but I'll try to search the internet
    and forum first.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.