The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
When people ask to disable drag and drop, they often are trying to disable accidental drag and drop
We occasionally get customers who ask, "How do I disable drag and drop?" This is an odd request, so we ask the frequent follow-up question, "What are you really trying to do?" For many of these customers, the answer goes something like this: We've found that our employees often accidentally move or copy items around on the desktop and in Explorer windows because the act of pressing the mouse button causes the mouse itself to slide slightly across the table, resulting in a drag operation instead of a single click. We then have to spend a good amount of time searching for where those files ended up and trying to ...
Being able to call a function without using GetProcAddress is not a security vulnerability
Another genre in the sporadic category of dubious security vulnerability is people who find an unusual way of accomplishing something perfectly normal but declare it a security vulnerability because they found an unusual way of doing it. Security is important to all computers users, from families at home to employees of government agencies, and people who use Microsoft Windows are no exception. Trojans, backdoors, and spyware (collectively known as malware) have taken many forms, most recently those of so-called rootkits, which modify the operating system itself in order to prevent their detection. Firewalls a...
Let GDI do your RLE compression for you
This is another trick along the lines of using DIB sections to perform bulk color mapping. GDI will do it for you; you just have to know how to ask. Today's mission is to take a 4bpp bitmap and compress it in BI_RLE4 format. Now, sure, there are programs out there which already do this conversion, but the lesson is in the journey, not in the destination. The secret is the GetDIBits function. You give this function a bitmap and a bitmap format, and out come the bits in the format you requested; GDI will convert as necessary. Note: I'm going to take a risk and write "sloppy" code. This is code that is not pro...
Clap and the filter graph claps with you
One of my colleagues was a fount of ideas, some of them crazy, some of them clever, and some of them both. I think this one counts as both. To render multimedia content with DirectShow, you build a so-called filter graph. A filter graph represents a series of transformations that are applied to data as it travels through the graph. For example, bytes from a video file may go through a splitter filter which separates the audio from the video data, then the two data streams each go through a respective audio and video decoder, which converts the compressed data into uncompressed sound or video data, and then to a...
There’s nothing wrong with making bold treeview items
Commenter Frans Bouma asks, Why is the text of a treenode chopped off when you switch the font from normal to bold? It apparently is for backwards compatibility but I fail to see why this is necessary for backward compatibility... Actually, bold treeview items work just fine. Watch: Start with our scratch program and make these changes: BOOL OnCreate(HWND hwnd, LPCREATESTRUCT lpcs) { g_hwndChild = CreateWindow( WC_TREEVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT, 0, 0, 0, 0, hwnd, (HMENU)1, g_hinst, 0); TVINSERTSTRUCT tvis; ...
On the almost-feature of floppy insertion detection in Windows 95
Gosh, that floppy insertion article generated a lot of comments. First, to clarify the table: The table is trying to say that if you had a Style A floppy drive, then issuing the magic series of commands would return 1 if a floppy was present, or 0 if the floppy was not present. On the other hand, if you had a Style B floppy drive, then issuing the magic series of commands would return 0 if a floppy was present, or 1 if the floppy was not present. That's what I was trying to say in the table. The answer was consistent within a floppy style, but you first had to know what style you had. The downsid...
Windows 95 almost had floppy insertion detection but the training cost was prohibitive
One feature which Windows 95 almost had was floppy disk insertion detection. In other words, Windows 95 almost had the ability to detect when a floppy disk was present in the drive without spinning up the drive. The person responsible for Windows 95's 32-bit floppy driver studied the floppy drive hardware specification and spotted an opportunity. Working through the details of the specification revealed that, yes, if you issued just the right extremely clever sequence of commands, you could determine whether a disk was in the floppy drive without spinning up the drive. But there was a catch. T...
Office redecoration: The classic Microsoft prank
Tim Sneath reminds us that it is a long-standing tradition Microsoft tradition to prank someone's office while they are out (here's a video of Larry Osterman's tales of prankdom). When I went to see a Thunderbirds hockey game a few years back, I avoided mentioning at the time that seeing the game served a secondary purpose. I attended the game with a couple of friends, one of whom had never seen a live hockey game before. It so happened that his fiancée wanted to prank his office, so our little hockey outing was a way to keep him occupied for a while, giving his fiancée the opportunity to sneak...
2009 Q1 link clearance: Microsoft blogger edition
It's that time again: Sending some link love to my colleagues. Updates: Fixed name of product Microsoft Expression (no "s"). Also, I think Arvin's blog is still up—it's just being masked by a doppelganger. Will update as information becomes available.