Sounds Logical
Send Page To a Friend

Table Of Contents Previous Page Next Page

[M-Utilities overview]

M-Utilities: MATLAB function reference

winchangeicon
Version 1.0 Requires MATLAB 6.0 (R12) or later

Change the icon 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:
  winchangeicon(Window,Icon);
  winchangeicon(Window,Icon,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.

Icon

must be a string consisting of one of the following possibilities:

'<filename>.ico' specifies the filename (with relative or full path if not in working directory) containing the icon. MUST be a valid icon file with an ".ico" extension.
'error' white/red cross (built-in system icon)
'question' question-mark (built-in system icon)
'warning' exclamation-mark (built-in system icon)
'windows' Windows logo (built-in system icon)
'default' default application (built-in system icon)
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 mexchangeicon.dll which is a wrapper function around the Win32 API function SendMessage (with appropriate arguments for changing the small and large icon). The accompanying mexchangeicon.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
  winshowwin    change window display ("show") state
Examples:
Create a demo figure:
  h=figure(1);
   
Replace the MATLAB icon with the 'question-mark' icon (using the MATLAB figure handle):
  winchangeicon(h,'question');
   
Create two demo figures:
  h(1)=figure(1); h(2)=figure(2);
Replace the MATLAB icons with the 'exclamation-mark' icon (using the MATLAB figure handles):
winchangeicon(h,'warning');
Replace the MATLAB icons with the homemade icon (in 'myicon.ico', distributed with M-Utilities) (using the MATLAB figure handles)
winchangeicon(h,'myicon.ico');
Set the flag to manipulate only the first window found
  Options.AllWindows=0;
Only one of the figures will have its icon changed (i.e. the first found with 'Fig' in its name).
  winchangeicon('Fig','error',Options);
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
  winchangeicon('FIG','windows',Options);
Change the icon figure(1) only (based on its unique title string)
winchangeicon('Figure No. 1','windows');
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
  winchangeicon('No. 1','question',Options);
Change the icon figure(1) (based on its full title string)
  winchangeicon('Figure No. 1','question',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;
Change the browser window icon to 'myicon.ico' (using the non-MATLAB-window title partial string)
  winchangeicon('Sounds Logical: M-Packs: Support','myicon.ico');

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