Announcement

Collapse
No announcement yet.

Child console size

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Child console size

    I take users through a series of calculations with FORTRAN modules using a PB/CC menu application that also provides utilities to process input and output files. The utilities, all PB/CC modules, are invoked by shelling from the menu application. The console of one utility needs to be larger than the default size of the parent console and it includes the statement ShowWindow hWnd&, %SW_MAXIMIZE to avoid scroll bars. This works as desired the first time the utility is invoked but not on subsequent attempts.

    MSDN indicates that the second parameter of the ShowWindow function "is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter". In subsequent calls, the parameter can be %SW_MAXIMIZE among others. My observations would suggest that on subsequent shellings the parameter is ignored and the console is not displayed as its initial matter.

    Is their some means to obtain a consistent console (maximized) upon subsequent shellings? How do I set the nCmdShow parameter of the
    WinMain function prior to shelling to child? Can the parent provide the STARTUPINFO for a child? Suggestions welcomed and examples appreciated by a physicist who programs out of necessity.

  • #2
    > Can the parent provide the STARTUPINFO for a child

    Yes. See STARTUPINFO structure as passed as parameter #9 using the CreateProcess() function to launch the child process.

    Note also: I would not trust "window" commands to work reliably on CONSOLEs. I would use the relevant console members of STARTUPINFO (there's only one or two which apply to console operation) if launching a console application as the child process.

    If it's your console program which is launched, you can get the STARTUPINFO structure passed to your program using the deviously-named "GetStartupInfo" function.

    Unless I am mistaken, it is your responsibility to size the window or console to agree with the info passed in STARTUPINFO.

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment

    Working...
    X