-
December 3rd, 2008, 05:28 AM
#1
Mimimizing the window created by a process
I am creating a process to launch mspaint application using the following code
::CreateProcess(0, strCmdLine.GetBuffer(0), 0, 0, FALSE, 0, 0, 0, &si, &pi)
Once the application is launched, i need to minimise the paint application. How can i do it?
-
December 3rd, 2008, 05:31 AM
#2
Re: Mimimizing the window created by a process
Originally Posted by zuhrs
I am creating a process to launch mspaint application using the following code
::CreateProcess(0, strCmdLine.GetBuffer(0), 0, 0, FALSE, 0, 0, 0, &si, &pi)
Once the application is launched, i need to minimise the paint application. How can i do it?
Find the window and minimize it with ShowWindow function
-
December 3rd, 2008, 05:59 AM
#3
Re: Mimimizing the window created by a process
You mean you want to minimize the window of the application that launched the other process, of the window of the application that was launched?
-
December 3rd, 2008, 06:17 AM
#4
Re: Mimimizing the window created by a process
Hi,
It can be done using 6th argument in CreateProcess():
DWORD dwCreationFlags to SW_SHOWMINIMIZED
-
December 3rd, 2008, 06:23 AM
#5
Re: Mimimizing the window created by a process
Originally Posted by cilu
You mean you want to minimize the window of the application that launched the other process, of the window of the application that was launched?
I need to minimize the application which launched the process
-
December 3rd, 2008, 06:37 AM
#6
-
December 3rd, 2008, 06:50 AM
#7
Re: Mimimizing the window created by a process
You can also try to send a WM_SYSCOMMAND with SC_MINIMIZE to the application's main window. But ShowWindow(SW_MINIMIZE) for the application's main window, should do the job.
-
December 3rd, 2008, 07:09 AM
#8
Re: Mimimizing the window created by a process
Originally Posted by VictorN
Dosn't ShowWindow(SW_MINIMIZE) work?
Or "the application which launched the process" has no window at all?
ShowWindow takes 2 arguments - hwnd and cmdShow.
So minimize the application i need to get the hwnd for that. How can i get it?
-
December 3rd, 2008, 07:24 AM
#9
Re: Mimimizing the window created by a process
Originally Posted by zuhrs
ShowWindow takes 2 arguments - hwnd and cmdShow.
Yes, if you are using plain Win APIs
Originally Posted by zuhrs
So minimize the application i need to get the hwnd for that. How can i get it?
Since you created a window in your application (and you didn't say you hadn't done it) that you got somewhere in your code this window handle returned by one of the Win API such as CreateWindow(Ex) or CreateDialog or something similar
Last edited by VictorN; December 3rd, 2008 at 07:34 AM.
Victor Nijegorodov
-
December 3rd, 2008, 07:30 AM
#10
Re: Mimimizing the window created by a process
If I have the handle and try doing all this
::SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
SendMessage(hwnd, SW_SHOW,0,0);
ShowWindow(hwnd, SW_SHOW);
SetForegroundWindow(hwnd);
BringWindowToTop(hwnd);
Still I am not able to bring the window to top
I asked about minimizing the parent window because i need the focus on the newly created application, but it is not happening
-
December 3rd, 2008, 07:38 AM
#11
Re: Mimimizing the window created by a process
Originally Posted by zuhrs
If I have the handle and try doing all this
::SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
.....
Still I am not able to bring the window to top
What is the hwnd you are using here?
Originally Posted by zuhrs
I asked about minimizing the parent window because i need the focus on the newly created application, but it is not happening
What is "not happening"? Minimizing of your application window? Or what?
Victor Nijegorodov
-
December 3rd, 2008, 07:44 AM
#12
Re: Mimimizing the window created by a process
The parent window is creating a process and I am not able to bring the newly created window to top. For this reason i have tried to minimise the parent window so that the focus will be on the newly created application.
In short I need to have the newly created application in the top. How can i do that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|