3.0

3.0 | 3 ratings Rate this file 9 Downloads (last 30 days) File Size: 5.41 KB File ID: #11046
image thumbnail

Changing Window Titles

by Malcolm Wood

 

10 May 2006 (Updated 06 Jul 2010)

Provides the ability to change the titles of all windows in the MATLAB process

| Watch this File

File Information
Description

If you're using more than one instance of MATLAB at a time, it's useful to be able to tell them apart at a glance. This utility lets you rename the MATLAB window so that it can be distinguished from other instances in the task bar, and when tabbing between windows.

Two functions are included:

>> [hWnd,title] = findAllWindows
returns the names and handles of all windows in the MATLAB process.

>> setWindowTitle(hWnd,title)
allows you to set the title of any window in the MATLAB process.

An example script is included, as are help files and full source code.

You will need to build the MEX functions yourself. If you haven't run "mex" before, use:
>> mex -setup
and follow the instructions for selecting a compiler.

Then run:
>> mex findAllWindows.cpp
>> mex setWindowTitle.cpp
This works with Microsoft Visual Studio 2005, and probably with other versions too. If you encounter linking problems, try adding "user32.lib" to the end of the command.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
sethicon

MATLAB release MATLAB 7.2 (R2006a)
Other requirements Windows only. Tested in XP, but should work in any Win32 system. Tested in MATLAB 6.1 through 7.2 (R12.1 to R2006a).
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
13 May 2006 Rijki Randani

how i use this script in matlab??i try t run it in editor this is doesn't work..thanks..

13 May 2006 Urs (us) Schwarz

these few strokes do the same for JPG, GIF, and PNG images:

import com.mathworks.mde.desk.*;
d=MLDesktop.getInstance;
% load a jpg, here of size H:297/W:585
% - no need to do any scaling
img=javax.swing.ImageIcon('cloth.jpg');
f=d.getMainFrame;
% set the icon of the window as well as
% the tabbing panel
f.setIcon(img);
% set the title
f.setTitle('my personalized ML');

just a thought
us

16 May 2006 Vihang Patil

Does not run in compiled applications.. Please let me know if you could do it on your end

19 May 2006 Alex Nelson

To change the icon of a figure window, I started with Urs Schwarz's code, and played around until I got:
import com.mathworks.mde.desk.*
d = MLDesktop.getInstance;
f = d.getClient(get(gcf,'name'));
img=javax.swing.ImageIcon('icon.jpg');
r = f.getRootPane;
rp = r.getParent;
rp.setIcon(img);

31 May 2006 Malcolm Wood

I have removed the function which changed the icon for windows in the MATLAB process (which, by the way, was implemented as a MEX file because the Java solutions are only possible in recent versions of MATLAB). It has been brought to my attention that changing icons on figure windows and/or the MATLAB window breaches the licence agreement which states (in MATLAB 7 and later) that "the Licensee shall not alter, remove, or obscure any ... logo ... on or in copies of the Program". The same applies to compiled applications. Sorry folks!

30 May 2008 d d  
17 Dec 2009 Malcolm Wood

Review

Please login to add a comment or rating.
Updates
30 May 2006

Removed the function which changes the window icon, which is in violation of the licence agreement for MATLAB 7 and later.

17 Dec 2009

Review

25 Jun 2010

Added copyright lines. Removed binaries to comply with conditions of the site. Added compilation instructions.

06 Jul 2010

Removed mexw32 files.

Tag Activity for this File
Tag Applied By Date/Time
gui tools Malcolm Wood 22 Oct 2008 08:25:00
example Malcolm Wood 22 Oct 2008 08:25:00
window Malcolm Wood 22 Oct 2008 08:25:00
windows Malcolm Wood 22 Oct 2008 08:25:00
title Malcolm Wood 22 Oct 2008 08:25:00
titles Malcolm Wood 22 Oct 2008 08:25:00

Contact us at files@mathworks.com