Calling GetFileInformationByHandleEx in Windows XP

February 2, 2010

GetFileInformationByHandleEx can provide some good information about a file from its handle, but it is only available for Window Vista and beyond.  If you still need to support Window XP, then you can try using a static library called fileextd.lib that will provide this function.

The only problem is there seems to be some incompatibility problems as described in this post.  One of the posters recommends creating a separate DLL as a way to get around the problem, but this seems like kind of a hassle.

I have created this function below called GetFileInfoByHandleEx that will work from Windows XP to Windows 7(and probably Windows 2000 as well). Read the rest of this entry »

Team Build IsA MSBuild?

March 24, 2009

I had one of those Aha! moments this weekend. You know, the ones that Oprah is always talking about (not that I watch, it just happens to be on sometimes when I’m in the room…) It turns that somehow in my dealings with Team Foundation Build (i.e. “Team Build”) I had always maintained this subconscious assumption that Team Build was really just MSBuild++, or rather, a proper superset of the functionality that MSBuild provides. I probably wouldn’t even have balked had someone shown me a UML diagram like this:


The assertion there being that Team Build is just a realization of MSBuild, extended to work in a broader, team environment. A follow-on assertion (that certainly I made) is that the team who created Team Build started with MSBuild as a basis and worked out. My “Aha! Moment” was realizing that in fact it is not an IsA relationship at all, but rather a pure HasA relationship:

Read the rest of this entry »

Could you be a Tranxcoder?

November 20, 2008

We’re hiring. No, really, we are. I realize you know three developers who either recently lost their jobs or are fairly confident it’s about to happen, but despite the downturn, we are hiring. Even more striking is that these are new positions – not replacements! That’s right, on the cusp of what some are predicting will be the worst U.S. economic slump since The Great Depression, we are growing our engineering team. Have I made this clear yet?

Why dwell on economic troubles in a job post? Because sometimes we hear that good developers hesitate to look at small companies because they want “stability”. Well I would just like to point out that while most of the major corporations in the country are gearing up for hiring freezes, pay cuts, lay offs, and who knows what else; our tiny little company is as strong as I’ve ever seen it and shows no signs of slowing. Come get your stability while it’s hot.

Read the rest of this entry »

Customizing “lookful” WPF controls – Take 2

October 12, 2008

Last week I posted a technique for customizing controls in WPF that don’t offer a replaceable ControlTemplate – I described them as “lookful” controls because their behavior and appearance are tied in with their functionality. My approach involved creating a custom control that derives from the one being targeted. That solution has some significant downsides, though, including that if the control is part of another (composition) then you have to modify the parent control to tell it to use your new custom control as a child – it works in most cases, it’s just not ideal. I figured someone might call me out on it eventually and, sure enough, the day I posted it fellow WPF’er “John” ruminated in a comment about using attached properties to accomplish the task instead. That got my wheels turning and I decided to put together a solution that, frankly, doesn’t stink

Read the rest of this entry »

Showing ToolTips on a trimmed TextBlock (WPF)

October 9, 2008

[UPDATE: This solution has been superceded by a much better implementation in this later post.]

I recently downloaded the WPF Toolkit for which Microsoft posted the first DataGrid CTP. That DataGrid is their attempt at responding to what is likely one of the most requested missing features in WPF. Many people have suggested that WPF doesn’t need a DataGrid and may be better off not to provide one, but I and others disagree – we do need a DataGrid, but it must be lookless! Anyway, I’m getting off topic.

While I really appreciate the work that went into building such a flexible and feature-packed control, I was quickly disheartened to learn that it has no mechanism built in to handle the scenario where column data (text) gets cut off due to size constraints. Actually there is one means, wrapping the text, but for the task I’m currently working on wrapping is really not an acceptable approach.

Read the rest of this entry »

Customizing “lookful” WPF controls

October 9, 2008

[UPDATE: This solution has been superceded by a much better implementation in this later post.]

If you’ve spent any time reading material about WPF, it’s inevitable that the term “lookless” has come up at least once. Ironically, that’s not actually a word, at least not according to Webster. However, the term has been drilled into the minds of WPF developers the world over and will likely be added to the Windows dictionary at some point. Microsoft even used the word several times in this patent application which describes in precise detail what it means. In case the practical meaning isn’t clear, in essence “lookless” equates to “has a flexible UI”. In other words, lookless controls are focused on functionality, not appearance or even visual behavior. Of course most controls do have a default appearance, but lookless controls are, by nature, almost completely customizable (limited mostly by imagination and time.)

Matt Duffin of the UK even suggested we all grab a pen and write “All controls in WPF should be lookless” over and over until it becomes ingrained. Not sure I would go that far, but clearly the overwhelming guidance for WPF designers is that most controls should have a stylable and/or templatable appearance which is independent of functionality. Being aware of that guidance just makes it even more frustrating when you run into a control built into the framework which violates that tenet.

The particular control I’m referring to in this case is the TextBlock. Recently I had a desire to enable ToolTips on a TextBlock when (and only when) its text is being trimmed. I’ve written a separate post which goes into the solution to that specific problem in more depth, but getting there required a lot of foundational work which can be applied to address any number of issues.

Read the rest of this entry »


Get every new post delivered to your Inbox.