This idea mainly came to me while working on my old Fujitsu 266 Mhz, running Windows 2000, with only 64MB of RAM. Internet browsing was painfully slow. When I had multiple windows open and maximized/restored down, it was most excruciating! Yes, I could just click on "Show Desktop", then click on my IE shortcut, but that's 2 clicks man!! Come on! I wanted an option on Internet Explorer to minimize all other windows, then open my new instance of IE. This should be an option, if you ask me, but is not. So forth was born PowerMini!
This article does not have great coding content but has potential to become a great CP community application or at least, influence browser developers to include minimizing other windows when starting, as an option. Another motivating factor for me to make this article: I am tired of seeing "Articles Submitted 0" in my profile. I have published one article on CodeGuru though.
I would also like to disclaim, that none of the code was written by me. The meat of the app was by Tone Skoda and is noted in the source. It took me a long time to find a function to handle the minimizing of windows. Now I kind of threw the application together and have tried to comment it to the best I could. I know there are improvements that could be made to the code, that I am sure people will point out. This will be good. It will help me become a better programmer, since I am a stand alone, self-taught programmer, big thanks to CP! This function definitely needs improving! I tried searching around to see how I could get my hands on getting the default browser, but no luck, and scrapped investing anymore time into it. Feel free to improve this part! (Started improving in v1.1).
I think it would be great if others would add what they would like to see in this application, instead of asking me to write the code. For example, someone gets an idea, that someone writes the code, that person posts a discussion message with the added code, I will update the source and application version in the article.
Setting up PowerMini for Use
You have two options. Download the installation only file, above. This installs it for you, with no source code included.
- Download the powermini.zip file (Demo project above). This contains the VC6 project and some extra resources files. Then extract to desired folder.
- Locate the PowerMini.exe file in the Release subfolder and create a shortcut to the desktop (right-click > Send to > Desktop)
- Drag and Drop the PowerMini shortcut to your QuickLaunch Toolbar. NOTE: You may change the shortcut icon to any of the 5 different icons included in the .exe. Feel free to design and add your own, they will probably be better than mine :)
I personally have the regular IE shortcut in my QuickLaunch toolbar with PowerMini right next to it.
The Code Version 1.2
This 1.2 update was needed after trying to add Crazy Browser to the list of supported browsers. I think Crazy Browser sets itself as the default browser correctly (or incorrectly), as mentioned I have not found any well documented information about how Windows finds the default web browser. Anyway, Crazy Browser when setting itself as the default browser, writes a registry key to
HKEY_CLASSES_ROOT\htmlfile\shell in the registry and NOT to
HKEY_CLASSES_ROOT\htmlfile\shell\open\command! Which kind of creates some problems, on my Windows 98se machine at work (not on my WinXP laptop though?!?). If Crazy Browser is your default browser and you use an internet shortcut, it opens whatever is in the
HKEY_CLASSES_ROOT\htmlfile\shell\open\command path instead of Crazy Browser, maybe this is why it is called "Crazy", sorry couldn't resist. The PowerMini v1.2 now has 2 supporting functions instead of 1.
CString GetRegKey(HKEY m_Folder, CString str_Path, CString str_Name) returns any given registry
CString GetHomePage() returns the users' homepage URL.
#include <span class="code-string">"stdafx.h"</span>
The 2nd function:
BOOL CALLBACK EnumWindowsProc( HWND hwnd, LPARAM lParam)
if(style & WS_OVERLAPPEDWINDOW &&
(style & WS_POPUP)== false)
if( IsIconic(hwnd) == false )
if( IsIconic(hwnd) == true )
int APIENTRY WinMain(HINSTANCE hInstance,
extern CString GetHomePage();
extern CString str_Browser;
extern HICON m_hIcon;
m_hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
CString str_Homepage = GetHomePage();
ShellExecute(m_hWnd, "open", str_Browser,
str_Homepage, NULL, SW_SHOWDEFAULT);
Points of Interest
I was surprised not to find any existing code on the major coding sites about how to minimize and maximize open windows. Maybe because it is common knowledge, but not to this wanna-be programmer.
- Only looks for Internet Explorer and Netscape homepages (only b/c they are the only ones I have installed). I will update as I receive more info on other browsers (this info might be good/useful to have documented in one place anyway. I tried searching the net for a page that has info on the registry keys for browsers and their homepages, but no such site exists).
- Does not fully minimize restored windows (it mini's them, but not fully).
- "It's bad for people trying to learn from your code." see .S.Rod. 15:16 4 Jan '03 post. Sorry you "Professionals", I'm still learning
- 2 unresolved externals error - Debug ONLY.
- VC7 build errors, better off just creating a new project and pasting code, and importing icons.
- An Options popup menu if user right-clicks on shortcut or PowerMini.exe (like IE's) (I tried doing this feature myself but found myself investing too much time and not getting answers to my stumbling).
- Cooler icons in the build, so you have plenty of options to choose from.
- Anything else you can think of.
Article posted 1/4/03 12:10am PT
- 1/4/03 11:35am PT: Removed the setup.exe from powermini_src.zip. Oops, wonder why it was so big.
- 1/4/03 1:20pm PT: Improved
GetHomePage() by getting actual default browser instead of guessing.
- 1/4/03 1:20pm PT: Posted v1.1 src and install.
- 1/17/03 8:31pm PT: Posted v1.2 src and install. Added support for Crazy Browser. Improved some functions.