Click here to Skip to main content
11,930,048 members (50,684 online)
Click here to Skip to main content
Add your own
alternative version


78 bookmarked

Window Sizer

, 7 Aug 2002 CPOL
Rate this:
Please Sign up or sign in to vote.
A hot-key based program that lets you resize your current window to any size. Useful for web designers and GUI developers as it helps avoid frequent screen-resolution changes.


Window Sizer is a little program that I wrote when I was having to frequently change screen resolutions when testing web pages or GUI applications to make sure that they worked alright in other resolutions than my default one. Often we also had requests from clients with weird specifications like a maximum window size of 600 x 600 or something equally bizarre. Then I found that when I was editing CP articles I had to switch to 800 x 600 to make sure that the article looked fine in that resolution too. All this culminated in this little app that you see.


Just run the app once, probably at windows startup. Just drag a short cut to the Start-Menu's Startup-folder. You'll see a green tree icon on your system tray. That's to let you know that Window Sizer is active. Now just make your window active by clicking on it and press CTRL-ALT-F12 which is the keyboard shortcut that brings up Window Sizer. Now you can choose one of the resolutions from the list box or use a custom resolution, and then click on Resize to resize the window to that size. If you close the Window Sizer window the program won't exit, it simply hides itself. The resolution list in the list box will never exceed your screen resolution. Thus if you are on 800 x 600, don't expect to see 720 x 720 in the list box. But you can type what you feel like into the Custom size text boxes at your own risk of course. You can exit the program by right clicking on the task tray and choosing Exit.

Technical details

Basically we use GetForegroundWindow() to get the current window. This usually works better than GetActiveWindow() on XP and 2K because they have some kind of funny option that when set prevents windows from taking over the focus. This means we end up with crazy situations where the foreground window may not be the active window and vice versa. Now we use MoveWindow() to resize the window. If the resizing gets the window out of screen, we center the window on the screen. We also remove the WS_MAXIMIZE if it is set because otherwise the OS will not know that the window has been un-maximized. Initially I had over-looked such a contingency and had experienced some weird side effects.


I'd like to thank David Wulff and Roger Wright for doing some quick testing for me. It was okay when I alone was using it, but when I thought of CP-ing it, I wanted some external testing and these two gentlemen helped me by testing out the application. Of course there might be a few bugs left for all I know. But I am hoping on getting some quality feedback and suggestions as usual.


  • Aug 08 2002 - Added an MSI Installer


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Nish Nishant
United States United States
Nish Nishant is a Software Architect/Consultant based out of Columbus, Ohio. He has over 15 years of software industry experience in various roles including Lead Software Architect, Principal Software Engineer, and Product Manager. Nish is a recipient of the annual Microsoft Visual C++ MVP Award since 2002 (13 consecutive awards as of 2014).

Nish is an industry acknowledged expert in the Microsoft technology stack. He authored
C++/CLI in Action for Manning Publications in 2005, and had previously co-authored
Extending MFC Applications with the .NET Framework for Addison Wesley in 2003. In addition, he has over 140 published technology articles on and another 250+ blog articles on his
WordPress blog. Nish is vastly experienced in team management, mentoring teams, and directing all stages of software development.

Contact Nish : You can reach Nish on his google email id voidnish.

Website and Blog

You may also be interested in...

Comments and Discussions

QuestionNo download link pops up!! Pin
Member 955539629-Oct-12 9:30
memberMember 955539629-Oct-12 9:30 
AnswerRe: No download link pops up!! Pin
Nish Sivakumar29-Oct-12 9:38
mvpNish Sivakumar29-Oct-12 9:38 
QuestionWindow Sizer Pin
wwmjava18-Oct-12 15:49
memberwwmjava18-Oct-12 15:49 
QuestionNot working in windows 7 Pin
Deepak.Prahlad15-Aug-11 21:10
memberDeepak.Prahlad15-Aug-11 21:10 
AnswerRe: Not working in windows 7 Pin
vvqboy5-Aug-14 22:15
membervvqboy5-Aug-14 22:15 
GeneralNeed to set a size for the windows contents, excluding the window border Pin
Adam Reece16-May-11 7:20
memberAdam Reece16-May-11 7:20 
GeneralMy vote of 4 Pin
Patrick Kalkman23-Jan-11 6:00
memberPatrick Kalkman23-Jan-11 6:00 
GeneralGreat Article Pin
Gaurav Dudeja India19-Apr-10 1:47
memberGaurav Dudeja India19-Apr-10 1:47 
Questionis there a newer or similar free version out now? Pin
july churches10-Oct-08 9:15
memberjuly churches10-Oct-08 9:15 
GeneralCtrl+Alt+F12 Does Not Work Pin
Kirill Osipov9-Oct-07 21:05
memberKirill Osipov9-Oct-07 21:05 
GeneralRe: Ctrl+Alt+F12 Does Not Work Pin
Deepak.Prahlad15-Aug-11 21:12
memberDeepak.Prahlad15-Aug-11 21:12 
GeneralVery Cool Nish Pin
Jeffrey Walton15-Dec-06 13:53
memberJeffrey Walton15-Dec-06 13:53 
Generalactive window Pin
krishnachandran18-Dec-05 19:25
memberkrishnachandran18-Dec-05 19:25 
GeneralProblem related to COM Wrapper Pin
paresh_vs15-Nov-04 4:02
memberparesh_vs15-Nov-04 4:02 
QuestionCan not resize Yahoo Messenger 6.0 window Pin
JList9-Oct-04 8:16
memberJList9-Oct-04 8:16 
GeneralWindow Sizer Pin
Wayland Moncrief5-Dec-03 9:53
sussWayland Moncrief5-Dec-03 9:53 
GeneralBitmap stretching Pin
collincode15-Sep-03 20:49
membercollincode15-Sep-03 20:49 
GeneralRe: Bitmap stretching Pin
Nishant S15-Sep-03 22:18
editorNishant S15-Sep-03 22:18 
GeneralResizing IE Pin
Uwe Keim19-Jul-03 22:41
sitebuilderUwe Keim19-Jul-03 22:41 
GeneralGreat work! Pin
Ryan Binns26-Mar-03 19:44
memberRyan Binns26-Mar-03 19:44 
GeneralWindow Sizer Predefined sizes Pin
Paul Farry13-Mar-03 18:15
memberPaul Farry13-Mar-03 18:15 
GeneralRe: Window Sizer Predefined sizes Pin
Nishant S13-Mar-03 20:46
editorNishant S13-Mar-03 20:46 
GeneralThis is what I was looking for Pin
WillemM3-Mar-03 21:39
memberWillemM3-Mar-03 21:39 
GeneralRe: This is what I was looking for Pin
Nishant S8-Mar-03 6:15
editorNishant S8-Mar-03 6:15 
GeneralStandard Window Sizes Pin
IanL19-Feb-03 23:58
memberIanL19-Feb-03 23:58 
GeneralRe: Standard Window Sizes Pin
Nishant S8-Mar-03 6:16
editorNishant S8-Mar-03 6:16 
GeneralExcellent Nish Pin
Jörgen Sigvardsson22-Nov-02 3:34
memberJörgen Sigvardsson22-Nov-02 3:34 
GeneralRe: Excellent Nish Pin
Nishant S23-Dec-02 11:58
editorNishant S23-Dec-02 11:58 
GeneralRe: Excellent Nish Pin
collincode15-Sep-03 21:41
membercollincode15-Sep-03 21:41 
GeneralRe: Excellent Nish Pin
Nishant S15-Sep-03 22:20
editorNishant S15-Sep-03 22:20 
General1.5 problems Pin
Andreas Saurwein29-Aug-02 5:31
memberAndreas Saurwein29-Aug-02 5:31 
GeneralRe: 1.5 problems Pin
Nishant S23-Dec-02 11:58
editorNishant S23-Dec-02 11:58 
GeneralRe: 1.5 problems Pin
usxue23-May-03 0:59
memberusxue23-May-03 0:59 
GeneralDamn this is useful Pin
David Wulff29-Aug-02 5:17
memberDavid Wulff29-Aug-02 5:17 
GeneralRe: Damn this is useful Pin
Nishant S23-Dec-02 11:57
editorNishant S23-Dec-02 11:57 
Generalwindowsizer Pin
Praetorian19-Aug-02 15:43
memberPraetorian19-Aug-02 15:43 
GeneralRe: windowsizer Pin
Nishant S26-Aug-02 0:43
editorNishant S26-Aug-02 0:43 
Generalwindowsizer Pin
philip kruger19-Aug-02 15:37
sussphilip kruger19-Aug-02 15:37 
GeneralWonderful Program Pin
Josykatz18-Aug-02 1:22
memberJosykatz18-Aug-02 1:22 
GeneralRe: Wonderful Program Pin
Nishant S18-Aug-02 16:51
editorNishant S18-Aug-02 16:51 
Generaldream-shot Pin
christoph braendle8-Aug-02 8:56
memberchristoph braendle8-Aug-02 8:56 
GeneralRe: dream-shot Pin
Nishant S8-Aug-02 15:37
editorNishant S8-Aug-02 15:37 
GeneralRe: Use this app if you want to break your monitor Pin
Nishant S8-Aug-02 1:54
editorNishant S8-Aug-02 1:54 
GeneralRe: Use this app if you want to break your monitor Pin
Nishant S8-Aug-02 17:00
editorNishant S8-Aug-02 17:00 
GeneralRe: Use this app if you want to break your monitor Pin
James T. Johnson8-Aug-02 1:01
editorJames T. Johnson8-Aug-02 1:01 
GeneralRe: Use this app if you want to break your monitor Pin
Nishant S8-Aug-02 1:07
editorNishant S8-Aug-02 1:07 
GeneralWonderful! Pin
Shog97-Aug-02 20:16
memberShog97-Aug-02 20:16 
GeneralRe: Wonderful! Pin
Colin^Davies7-Aug-02 20:22
memberColin^Davies7-Aug-02 20:22 
GeneralRe: Wonderful! Pin
Nishant S7-Aug-02 21:22
editorNishant S7-Aug-02 21:22 
GeneralRe: Wonderful! Pin
Nishant S7-Aug-02 21:20
editorNishant S7-Aug-02 21:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151126.1 | Last Updated 8 Aug 2002
Article Copyright 2002 by Nish Nishant
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid