Sounds Logical
Send Page To a Friend

Table Of Contents Previous Page Next Page

[M-Utilities overview]

M-Utilities: MATLAB function reference

winshowwin
Version 1.0 Requires MATLAB 6.0 (R12) or later

Change the display- ("show-") state of any window (PC-Windows only). Compatible with the MATLAB Compiler.

File format: m-file
Editable source code:
yes
Utilises non-editable functions: yes (mex dll, Windows API dll's)
Platform:
PC/Windows
Required MATLAB Toolboxes: none (except core MATLAB)
Demo version limitations: p-code only (cannot be compiled with the MATLAB Compiler)
Syntax:
 

winshowwin(Window);

  winshowwin(Window,Show);
  winshowwin(Window,Show,Options);
Arguments:
Input:
Window

if numeric, the MATLAB figure handle of the MATLAB figure window to be affected. If non-scalar, all entries which are valid MATLAB figure handles will be affected.

otherwise must be a string containing the full or partial name of the window (MATLAB or non-MATLAB Window) to be affected.

Show

[optional] must be a string consisting of one of the following possibilities:

'show' activates the window and displays it in its current size and position [default] if argument missing or empty
 
'hide' hides the window and activates another window
 
'maximize' maximizes the specified window
'minimize' minimizes the specified window and activates the next top-level window in the Z order
 
'restore' activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. This option should be used when restoring a minimized window.
 
'show_default' sets the show-state based on the SW_value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
 
'show_maximized' activates the window and displays it as a maximized window
 
'show_minimized' activates the window and displays it as a minimized window
 
'show_min_no_active' displays the window as minimized. Similar to 'show_minimized' but the window is not activated.
 
'show_current_no_active' displays the window in its current size and position. Similar to 'show' but the window is not activated.
 
'show_recent_no_active' displays the window in its most recent size and position. Similar to 'show_normal' but the window is not activated.
 
'show_normal' activates and displays a window. If the winod is minimized or maximized, the system restores it to its original size and position. An application should specify this option when displaying the window for the first time.
 
'show_force_min' Windows 2000/XP: minimizes a window, even if the thread that owns the window is hung. This option should only be used when minimizing windows from a different thread.
 
Options

[Optional] argument only relevant when the Window argument is a title (sub)-string rather than a MATLAB handle. Must be structure containing (some of) the fields listed below. Note: if the argument is omitted or if a given field is omitted, the respective [default] values are used.

Options.IsFullName flag which, when set equal to 1, designates that Window contains the full name appearing in the titlebar of the window. Conversely, if the flag is set to 0 [default] this designates that Window contains only a portion of the full name string, thereby indicating that a search must be conducted (on all open windows) to determine the full name containing the partial string. Note: this
is particularly useful when the window under question corresponds to a console application whose full name contains a path which depends on the location of the executable (and can therefore vary arbitrarily
from installation to installation).
 
Options.CaseSensitive flag which designates whether the search based on Window should be case-sensitive (flag value of 1, [default]) or case-insensitive (flag value of 0).
 
Options.AllWindows flag which designates whether the search based on Window should return all windows which qualify (flag value of 1, [default]) or only the first qualifying window (flag value of 0)
 
 
This function utilizes a mex function (Windows DLL) called mexshowwin.dll which is a wrapper function around the Win32 API function ShowWindow. The accompanying mexshowwin.m contains only the pragma %#mex which indicates to the MATLAB Compiler to expect a mex file rather than an m-file at compile-time.
  winenablewin    toggle window enable state
  winclosewin close window (designed for non-MATLAB windows)
  winontop  put window always on top
Examples:
Create a demo figure:
  h=figure(1);
   
Hide the window (using the MATLAB figure handle):
  winshowwin(h,'hide');
Show the window again (using the MATLAB figure handle)
  winshowwin(h,'show');
   
Create two demo figures:
  h(1)=figure(1); h(2)=figure(2);
Maximize both figures (using their MATLAB figure handles)
winshowwin(h,'maximize');
Minimize both figures (using their MATLAB figure handles)
winshowwin(h,'minimize');
Restore both figures (to previous setting, i.e. maximized)
  winshowwin(h,'restore');
Restore both figures to original settings (i.e. size and position when created)
  winshowwin(h,'show_default');
Minimize both figures (based on their partial title strings, both containing the substring 'Fig')
  winshowwin('Fig','minimize');
Set the flag to manipulate only the first window found
  Options.AllWindows=0;
Only one of the figures will be restored (i.e. the first found with 'Fig' in its name).
  winshowwin('Fig','restore',Options);
Restore both figures to original settings (i.e. size and position when created)
  winshowwin('Fig,'show_default');
Set the flag to enable case-sensitive search of the name strings
  Options.CaseSensitive=1;
No action will be taken since the uppercase 'FIG' substring does not appear in either of the figure namestrings
  winshowwin('FIG','minimize',Options);
Hide only figure(1) (based on its unique title string)
winshowwin('Figure No. 1','hide');
Set the flag to specify that full name expected (rather than partial)
  Options.IsFullName=1;
No action taken since 'No. 1' is not the full name
  winshowwin('No. 1','restore',Options);
Restore figure(1) (based on its full title string)
  winshowwin('Figure No. 1','restore',Options);
   
For an example on how to manipulate external (non-MATLAB) windows:
   
Open the default web browser at the Sounds Logical support area (requires internet access). The title of the browser window will contain the partial string 'Sounds Logical: M-Packs: Support'
  slmhelp -web;
Hide the browser window (using the non-MATLAB-window title partial string)
  winshowwin('Sounds Logical: M-Packs: Support','hide');
Restore the browser window (using the non-MATLAB-window title partial string)
  winshowwin('Sounds Logical: M-Packs: Support','restore');

Top Of Page Table Of Contents Previous Page Next Page

Send Page To a Friend

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement