• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Windows State


How can I control the windows state of another application, that get launched from within my app.  What I want to do is have the application come up in a "Maximized" state when it is launched. Please provide example.

Thanks,
TJ
0
aj85
Asked:
aj85
  • 3
  • 2
1 Solution
 
edeyCommented:
If you are using shellExecute(ex) to start the app:

HINSTANCE ShellExecute(

    HWND  hwnd,      // handle to parent window
    LPCTSTR  lpOperation,      // pointer to string that specifies operation to perform
    LPCTSTR  lpFile,      // pointer to filename string
    LPTSTR  lpParameters,      // pointer to string that specifies executable-file parameters
    LPCTSTR  lpDirectory,      // pointer to string that specifies default directory
    INT  nShowCmd       // whether file is shown when opened
   );

use SW_MAXIMIZE for nShowCmd.




GL
Mike
0
 
aj85Author Commented:


This is very close to what I need, however I am using WinExec. What do I use for that?
0
 
edeyCommented:
Given the following:


UINT WinExec(

    LPCSTR  lpszCmdLine,      // address of command line
    UINT  fuCmdShow       // window style for new application
   );

fuCmdShow

Specifies how a Windows-based application window is to be shown and is used to supply the wShowWindow member of the STARTUPINFO parameter to the CreateProcess function. For a list of the acceptable values, see the description of the nCmdShow parameter of the ShowWindow function.


use SW_MAXIMIZE for fuCmdShow



GL
Mike
0
 
aj85Author Commented:

Thank you, the points are yours.  Very clear answer.

TJ
0
 
edeyCommented:
Glad to be of service :)


GL
Mike
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now