Having recently converted my last machine to Vista, I bid farewell to some interesting quirks that were visible in XP (the last of which still works on Vista sometimes). Find yourself an XP machine and give them a try if you're bored sometime.
Sticky Buttons
This one is first because it has been around for ages.
1. Find a regular toolbar (WordPad, Address Book, HyperTerminal, etc.)
2. Move your mouse over a button
3. Press down the right mouse button
4. Press down the left mouse button
5. Release both buttons (in any order)
The toolbar button will now stick down, and any other buttons you click (using just the left mouse button will do) will also stick down. If the toolbar can be reordered (e.g. in WordPad), clicking the menu while buttons are stuck down usually does bad things as well.
Speed Up Your Computer
With this handy tip, you can make your computer complete some tasks at high-speed! (or at least make it look that way).
1. Find a "marquee" progress bar (e.g. the one shown while clearing the cache in IE 7).
2. While it's moving, drag another window overtop of part of it.
As long as a window is moving overtop of it, the bar will run at high-speed. Dragging overlapped windows doesn't trigger redraws in Vista, so this behavior can't be seen anymore. If you are curious whether it has actually been fixed or not, feel free to write some code to trigger repaints.
If you don't have IE 7 (or don't have enough cache built up to make clearing take a while), you can grab a little application to make a progress bar here. If you don't trust random applications from some guy's blog, you can use the following code (be sure you update the manifest to use common controls version 6, as the marquee style isn't available in previous versions):
#include <windows.h>
#include <commctrl.h>
LRESULT __stdcall MessageHandler(HWND window, unsigned int message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CLOSE:
DestroyWindow(window);
break;
case WM_DESTROY:
PostQuitMessage(69);
break;
}
return DefWindowProc(window, message, wParam, lParam);
}
int main()
{
HINSTANCE instance = GetModuleHandle(NULL);
INITCOMMONCONTROLSEX commonControls;
commonControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
commonControls.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&commonControls);
WNDCLASSEX windowClass;
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.lpszMenuName = NULL;
windowClass.style = NULL;
windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW
+ 1);
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
windowClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
windowClass.hInstance = instance;
windowClass.lpfnWndProc = MessageHandler;
windowClass.lpszClassName = L"MainWindow";
RegisterClassEx(&windowClass);
HWND window = CreateWindowEx(NULL, L"MainWindow", L"violus.com",
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 300, 100, NULL, NULL, instance, NULL);
HWND progressBar = CreateWindowEx(NULL, L"msctls_progress32",
L"ProgressBar", WS_CHILD | WS_VISIBLE | PBS_MARQUEE, 5, 5, 250, 25, window, NULL, instance, NULL);
SendMessage(progressBar, PBM_SETMARQUEE, 1, 100);
MSG message = { 0 };
while (GetMessage(&message, NULL, 0, 0) != 0)
{
TranslateMessage(&message);
DispatchMessage(&message);
}
return 0;
}
JMP In Your IDE
This last one is only available to people with the Visual Studio IDE (be it Visual Studio, Visual C# Express, whatever).
1. In Visual Studio 2005 or 2008, open a text file long enough to be able to scroll vertically
2. Using the mousewheel, scroll down as far as you can
3. Open Internet Explorer 7 (maybe others work?) infront of Visual Studio so you can still see your text file
4. Select Tools -> Delete Browsing History -> Delete All
And there you have it (if it worked). The first two behaviors have fairly obvious explanations (not handling interleaved button presses, and changing progress state in the redraw code), but this one is a bit stranger. Evidently, clearing the cache in IE gets a message to Visual Studio (possibly because newer versions of Visual Studio host the webbrowser control), and that message triggers the text editor to scroll. Some debugging (or maybe even just Spy++'ing) would likely reveal the source of this behaviour, so go ahead and try it if you care enough. I don't.



















