Questions tagged [showwindow]

Winapi function that manipulates Windows window display options. It shows, hides, maximalises and minimalises window by HWND handle passed to it. This is windows only function.

showWindow is member of winAPI.

Syntax:

BOOL WINAPI ShowWindow(
  _In_  HWND hWnd,
  _In_  int nCmdShow
);

Parameters:

(int) hWnd
Window handle

(int) nCmdShow
Display mode. There are constanst defined for display mode. Zero (0 - SW_HIDE) results in window being completely hidden.

Code example:

Hide console window:

ShowWindow(GetConsoleWindow(), 0);   //Console window must exist

More info

More info on Microsoft web page.

55 questions
5
votes
2 answers

Why make the initial call to ShowWindow()?

First a caveat, I only very recently started learning about the WinAPI. I'm sure this question has been asked many times before, but for some reason I can't find it anywhere online. The question is simply this; why bother with the initial call to…
PvtWitt
  • 79
  • 3
5
votes
2 answers

ShowWindow Function Doesn't Work When Target Application Is Run As Administrator

I am writing a program that shows/hides the window of some target application. I was testing it out earlier and noticed something strange. If I run the target application as Administrator (right-click->Properties, "Compatability" tab, "Run this…
Jan Tacci
  • 2,931
  • 16
  • 56
  • 82
3
votes
2 answers

Maximized Window Restores to Full Screen

Using CWnd::ShowWindow(SW_SHOWMAXIMIZED) maximizes my app window as expected. However, when clicking the restore button on the app (or double clicking the title-bar), the restored size is the same size as the maximized window, which is confusing for…
Adi Shavit
  • 15,030
  • 2
  • 55
  • 121
3
votes
2 answers

How to stop Explorer starting my application maximized?

Explorer seems to always start my application with SW_MAXIMIZE (STARTF_USESHOWWINDOW is set in STARTUPINFO.dwFlags). I know that ShowWindow will use this value the first time you/Windows needs to display a window but it has the unfortunate…
Anders
  • 83,372
  • 11
  • 96
  • 148
3
votes
3 answers

Controlling other windows from C# app

I'm writing a C# app that will aggregate control of several applications (WMP, Google Earth, etc.). For apps that I am not writing myself, I am launching as a process, so I have their handles (handle = Process.Start("C:\whatever.exe"); is the code,…
Jay
  • 500
  • 6
  • 16
3
votes
3 answers

Why do I have to call showWindow on my NSWindowController twice on 10.5?

I've got a subclass of an NSWindowController that I'm using to load a window from a nib and show it on the screen. Below is the code that is called when I want to show the window. On 10.6 when showCustomWindow is called the window is displayed,…
Austin
  • 4,328
  • 7
  • 39
  • 59
3
votes
2 answers

ShowWindow invalid window handle

I have been trying recently to create a window class using the Windows API in C++. However, whenever I attempt to call ShowWindow, the function sets the last error to 1400 (ERROR_INVALID_WINDOW_HANDLE). After trying for a while, I stumbled across…
Mmarss
  • 178
  • 5
2
votes
1 answer

CDialog ShowWindow problem

I have a SDI application. In the application there's a modeless dialog which is used to show some message like communicating with the server during doing work. Question is, when the dialog's parent window is set to main frame, the ShowWindow method…
Wilbur
  • 21
  • 2
2
votes
2 answers

Hiding a control in Windows

I can't figure out how to hide a child window (a control), more specifically a GroupBox and a PushButton. I thought ShowWindow() with SW_HIDE as the second parameter would do the job, but it simply doesn't work. Yet SW_SHOW works just fine. I have…
stelonix
  • 656
  • 1
  • 5
  • 23
2
votes
0 answers

Issue with monitor numbers when docking laptop to multiple monitors

I developed an application that I can assign programs to specific monitors so that when I dock my laptop, which results in all my open windows being pushed to my main monitor, I can press a global hotkey, Alt+d, and all the applications that have…
Jordanr
  • 21
  • 4
2
votes
2 answers

Set the window state of a hidden window

Time ago I asked this question, it was solved here: Unhide process by its process name? But now, and for unknown reason, the C# or Vb.Net code provided there is not working, and I don't understand why not. I did some modifications to the original…
ElektroStudios
  • 17,150
  • 31
  • 162
  • 376
2
votes
1 answer

VB: ShowWindow focus issue

I'm attempting to send automated keystrokes to an application that does not support copy+paste via a small VB form. The form loads data from a text file and uses SendKeys to fire it over once I click a button. Everything appears to work except for…
2
votes
1 answer

How to use ShowWIndow() and SetForegroundWindow Correctly?

Here is what I want to do: 1)Open an application with username 2)Give some inputs 3)Open 2nd window for the application with different username 4)Give some inputs again 5)Switch to first application window, do somethg 6)Switch to second…
user3325210
  • 133
  • 1
  • 11
2
votes
1 answer

Window called with "showWindow" not focused

i have a simple cocoa coredata statusbar application with Xcode 4.6.2. This is the situation: Renamed MainMenu.xib to PreferencesWindow.xib, deleted the mainmenu, created a simple and working coredata function with arraycontrollers and bindings in…
Val K.
  • 113
  • 1
  • 10
2
votes
0 answers

Maximize (Fullscreen) MainWindow of a Process through C# and user32

I am using: private const int SW_SHOWMAXIMIZED = 3; [DllImport("user32.dll")] public static extern int ShowWindow(IntPtr hWnd, int nCmdShow); To try and maximize another window on the current computer. However, this "Maximize" only makes the window…
Kyle Uithoven
  • 2,334
  • 5
  • 27
  • 41
1
2 3 4