Sounds Logical
Send Page To a Friend

Table Of Contents Previous Page Next Page

[M-Utilities overview]

M-Utilities: MATLAB function reference

winclosewin
Version 1.0 Requires MATLAB 6.0 (R12) or later

Close any window(s) (PC-Windows only). Designed for use with non-MATLAB windows, but includes a call to the MATLAB close function if supplied with a MATLAB window as an argument. Compatible with the MATLAB Compiler.

Note: only works on windows owned by the calling application. Typical example of usage would be in combination with the MATLAB Compiler when building a standalone application. Since the MATLAB-compiler-generated application can take a few moments to initialise (especially if it has a GUI), it may be desirable to invoke a "startup splash screen" created directly in C/C++ which is visible while the MATLAB-compiler-generated GUI is initialising. Once the MATLAB-compiler-generated application is ready, it can destroy the spash screen by making a call to winclosewin.

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:
 

winclosewin(Window);

  winclosewin(Window,Options);
Arguments:
Input:
Window

if numeric, the MATLAB figure handle of the MATLAB figure window to be closed using the MATLAB built-in "close" command. If non-scalar, all entries which are valid MATLAB figure handles will be closed.

otherwise must be a string containing the full or partial name of the window to be closed.

WARNING: for closing MATLAB (or MATLAB-compiler-generated) windows, use the built-in "close" (or "delete") command (or this function with numeric figure handle(s)). DO NOT use this function with string argument on MATLAB windows -- the windows will close but will interfere with MATLAB's internal figure handling.

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 mexclosewin.dll which is a wrapper function around the Win32 API function DestroyWindow. The accompanying mexclosewin.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
  winontop  put window always on top
  winshowwin    change window display ("show") state
Examples:
For MATLAB figures, just use the built-in "close" command. NEVER use winclosewin with string arguments on MATLAB figures.
   
For an example on how to manipulate external (non-MATLAB) windows, see the ReSample product from Sounds Logical (free downloadable demo available from www.soundslogical.com). This standalone application was built using the MATLAB Compiler. It uses winclosewin (compiled in) to close a splash-screen generated using C/C++ within the main() function before the compiled MATLAB GUI boots up.

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