You've reached the internet home of Chris Sells, who has a long history as a contributing member of the Windows developer community. He enjoys long walks on the beach and various computer technologies.
Tuesday, Nov 16, 2004, 3:55 AM in The Spout
Art Tips for Programmers
As I think I've said before, as the capabilities of our UI platform expands, programmers are going to need to know a lot more about user experience and graphic art. Towards that goal, I offer a recent post on Slashdot that provides advise on how programmers can bone up for the latter. Anyone got any ideas about the former?
Saturday, Nov 13, 2004, 6:07 AM in The Spout
Outsourcing to Arkansas
I love the idea of outsourcing to rural parts of the country because a) I like keeping jobs in the US if possible (although I'm not a protectionist by any stretch of the imagination), b) it gives the under-employed more choices and c) it's another step toward my dream employment environment.
I see a future where people are listed like books on Amazon with ratings, reviews, descriptions (aka resumes), prices and availability, to be placed into a shopping cart to form ad hoc project teams based on the needs of the project and not on the locale of the participant or something as restrictive as "employer." I admit that I this article is only a small step and may not even be in the direction I'm hoping for, but as I'd like to live in a rural area (central Oregon) and still get to do interesting work at reasonable pay, I'm more than happy to read into things.
Thursday, Nov 11, 2004, 10:38 PM in The Spout
ATOM is to RSS as XML is to SGML
Tim Bray finally provides a technical reason for ATOM to exist that I can get behind. Once every RSS consumer in the world (which really isn't that many) also supports ATOM, we can move forward to a saner world.
Thursday, Nov 11, 2004, 11:45 AM in The Spout
A Guy Worth Hiring
This guy deserves a flood of job offers. Make yours good!
Sunday, Nov 7, 2004, 7:53 AM in The Spout
Concrete Examples of Software Factories?!?
I've been reading each of the Software Factories articles with great interest. Part 1 and part 2 did a particularly good job describing the elements of the problem space, I thought. However, when I get to part 3, I was ready to see a solution. Instead what I got was a long abstract piece defining the bits of what makes up a software factory. This is the kind of thing I'd be ready to read after I was shown a concrete example or two of working, running software factories. Do other people like reading these long, abstract articles? I find them tedious unless they're filling in and generalizing the details of something that I've already got a handle on.
Thursday, Nov 4, 2004, 3:15 PM in The Spout
It's The Thoughts That Count...
Here. The one where I lead you through my thought processes to chase down the answer to a problem that doesn't need solving in the slightest...
Thursday, Nov 4, 2004, 3:13 PM in The Spout
The Importance of Reputation
Here. The one where my boy is falsely accused of pantsing a kid and avoids suspension because he's known as a "good kid."
Thursday, Nov 4, 2004, 2:51 PM in The Spout
Getting My Hopes Up On Episode 3
Dammit. The trailer for Star Wars 3: The Revenge of the Sith, actually looks good! I just know I'm going to get my heart broken again...
Thursday, Nov 4, 2004, 11:08 AM in The Spout
The Country Has Spoken
This map of physical area that Bush won over Kerry (3.28M vs. 741K square miles) paints a pretty stark picture of just who the country wants to be their president. The choice they made makes me want to emigrate to Ireland with Robert Redford, but that's another story...
[both links from Rick Childress]
Thursday, Nov 4, 2004, 12:00 AM in The Spout
It's The Thoughts That Count...
On an internal mailing list the other day, there was a question asking for how to make a tray notification icon come back up on the try after explorer.exe died and came back to life. Good notification icons do this and the asker wanted to know how to do it for Windows Forms. I had had a dearth of technical work at the time, so decided to dig into the problem and see if I could answer it.
I started with a dim memory of a piece in MSJ by Paul Dilascia on the subject. Searching on msdn.com, I found Paul DiLascia's 2/99 MSJ C++ Q&A (http://www.microsoft.com/msj/0299/c/c0299.aspx) (emphasis added by me):
"provided you have Windows 98 or the Microsoft Internet Explorer 4.0 desktop installed. Whenever Internet Explorer 4.0 starts the taskbar, it broadcasts a registered message TaskbarCreated to all top-level parent windows. This is your cue to recreate the icons. If you're using MFC, all you have to do is define a global variable to hold the registered message and implement an ON_REGISTERED_MESSAGE handler for it."
From there, I dug through the SDK docs on ON_REGISTERED_MESSAGE (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_on_registered_message.asp) and found:
// example for ON_REGISTERED_MESSAGE
const UINT wm_Find = RegisterWindowMessage( FINDMSGSTRING )BEGIN_MESSAGE_MAP( CMyWnd, CMyParentWndClass )
//{{AFX_MSG_MAP( CMyWnd )
ON_REGISTERED_MESSAGE( wm_Find, OnFind )
// ... Possibly more entries to handle additional messages
//}}AFX_MSG_MAP
END_MESSAGE_MAP( )
Figuring I'd have to be able to call RegisterWindowsMessage from managed code, I surfed to pinvoke.net and found RegisterWindowMessage (http://pinvoke.net/default.aspx/user32.RegisterWindowMessage):
[DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern uint RegisterWindowMessage(string lpString);
Now that I knew how to figure out the Window message value for which to watch, I looked back into the MSDN documentation on System.Windows.Forms.Control, the base class of Form and all other HWND-based classes in Windows Forms (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasswndproctopic.asp) and the WndProc method I would have to override to catch the message, finding:
protected virtual void WndProc(
ref Message m
);
and:
"All messages are sent to the WndProc method after getting filtered through the PreProcessMessage method.
"The WndProc method corresponds exactly to the Windows WindowProc function. For more information about processing Windows messages, see the WindowProc function documentation in the Windows Platform SDK reference located in the MSDN Library.
"Notes to Inheritors: Inheriting controls should call the base class's WndProc method to process any messages that they do not handle."
Putting this together, I figured you could add "re-awakening" to notification icons in the following way (some compiler errors left in to keep readers on their toes : ):
using System.Windows.Forms;
using System.Runtime.InteropServices;
class MyMainForm : Form {
[DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern uint RegisterWindowMessage(string lpString);
static uint taskbarCreatedMessage = RegisterWindowMessage("TaskbarCreated");
protected override void WndProc(ref Message m) {
if( (uint)m.Msg == taskbarCreatedMessage ) {
// re-show your notify icon
}
base.WndProc(ref m);
}
}
After posting this answer to the list, I couldn't help but crank up a quick app to test it (after fixing the compiler errors of course : ). To my satisfaction, it worked immediately. I put up a notify icon in Windows Forms, killed explorer.exe and was pleased to see my icon show back up again when explorer.exe was restarted.
However, just to make sure, I commented out my code to see my icon not be restored. Those of you familiar with the internals of Windows Forms know what happened next, of course, because my notify icon was restored properly to the tray even without my code, as illustrated by Reflector against the .NET 1.1 Windows Forms implementation:
public sealed class NotifyIcon : Component {
...
static NotifyIcon() {
NotifyIcon.WM_TASKBARCREATED =
SafeNativeMethods.RegisterWindowMessage("TaskbarCreated");
}
private void WmTaskbarCreated(ref Message m) {
this.added = false;
this.UpdateIcon(this.visible);
}
private void WndProc(ref Message msg) {
...
if (msg.Msg == NotifyIcon.WM_TASKBARCREATED) {
this.WmTaskbarCreated(ref msg);
}
...
}
...
private static int WM_TASKBARCREATED;
...
}
What? Why would someone post a question about how to make something work that already worked? I figured that the questioner was referring to .NET 1.0 and I was digging through .NET 1.1 code.
However, reading through the 1.0 code showed the same support, meaning that neither the questioner nor I had bothered to check for this support before running off to add it. So, the lesson? Write your tests first!
Still, I learned a bit along the way and that was fun. : )
Thursday, Nov 4, 2004, 12:00 AM in The Spout
The Importance of Reputation
My youngest son was called into the office today for pantsing a kid on the school playground. That is not at all like my son (he's the sweetest kid you'd ever want to meet), but the principal was new, so she was talking about suspension. Luckily, the secretaries knew my boy, so they were able to point out the inconsistency of that behavior with the reputation he had built in 4 years at the school. It turns out that the pantsed boy was cutting in line in front of my son, who didn't like it, so pushed him right back out of line again. The "cutter" took a swing, my boy swung back and in the process (they're only 9) they both fell. My son reached out to grab the boy's shirt to catch himself, not knowing that the other boy was also falling and got the pants instead, causing the aforementioned "pantsing."
The moral of this story is an old saying I heard when I was a kid and have lived by since: "If you rise at dawn, you can sleep 'til noon." In other words, if you build yourself a reputation for good things, when occasionally you stray, folks will cut you some slack. The converse of this rule is that if build yourself a reputation for bad things, that could well stick with you for a long, long time...
Monday, Oct 25, 2004, 9:10 AM in The Spout
Here's Some Marketing I Can Get Behind
I just got an email from Netflix letting me know that they're lowering my monthly fee from $22 to $18. The only thing vaguely "marketing" about is that they used $21.99 and $17.99. There was no upsell. There was no limitation of service at that new lower price. There nothing additional I had to do to get the savings. When's the last time you got that kind of service from a vendor? I love Netflix.
Thursday, Oct 14, 2004, 11:56 PM in The Spout
Consider Yourself An Artist
d.code has a lot of great stuff to say in his post, but hands down my favorite is this:
"How many software developers at Microsoft consider themselves artists first, and software developers second?"
This is the thing that separates today's Windows software from tomorrow's. IMO, this is the line between Windows Forms and Avalon. The former is hands down the best way for software engineers to build professional UIs that we're familiar with under Windows today. The latter is for artists to build things we've never seen before. I know this is scary for software engineers who don't know how to be artists (lord knows I don't) and for companies that don't have artists (better get some), but crossing this line is necessary to get from the best of today to the promise of tomorrow for Windows.
Thursday, Oct 14, 2004, 3:35 PM in The Spout
Randy Jackson on Pleasing the Gods
Randy Jackson enjoyed my recent .NET Rocks appearance because of my discussion of how I like to learn things. I only remember talking about two strategies: "ignoring the docs" and "hyperventilating" but his take on it was so beautifully worded, I had to share it with you:
"I’m referring to flying in that strata called by some of my PhD'ed friends as the 'Shirley McLean' possession experience, where the actual act of jumping in to the unknown pleases the Gods in some twisted way and the outcome is usually beyond our expectations."
I don't get the Shirley McLean reference, but I love the bit about pleasing the Gods by jumping into the unknown.
And yes: today I'm going to read you my email because today, clever people insist on emailing me. : P
Thursday, Oct 14, 2004, 2:58 PM in The Spout
A Quote To Live By
I watched the first few episodes of the award-winning HBO series "Angels in America" and hated it (but I still love NetFlix for making is so darn available to me).
However, while I didn't identify with any of the characters (except, potentially, the hot nurse/angel), I did really resonate with one of the quotes, which went something like this (and feel free to correct me if you recognize the quote and I got it wrong):
"Don't run your life by what you want. That changes with a whim. Run your life on what you believe."
That really struck the Midwestern Eagle Scout idealist engineer in me.