Archive for the ‘Windows XP’ Category

Implementing IEPNGFix as a Reusable Control

January 30, 2009 4 comments

Even with IE 8.0 on the horizon, a great deal of our internal users are still using IE 5.5 and 6.0.  While, for the most part, our current coding techniques are unaffected, we did move to using PNG files quite a while ago and are faced with rendering issues as the target audience for a few of our produces expands.

To solve those issues, I’ve been using TwinHelix’s IE PNG Fix behavior with a great deal of success; however, I dislike keeping track of multiple files and references between projects.  It made more sense to make it a reusable control and include it in our shared architecture library.  When Angus releases a new implementation, then I only need to update the control and push out the updated libraries rather than touching HTML in each project.

Here’s how:

1. Download the latest version of IE PNG Fix from here.

2. Add the, blank.gif, and IEPngFix_tilebg.js (if using 2.0 Alpha 3) into your project.  Mark all three files as Embedded Content.

3. Create a basic CSS file that can be added to pages and call the IEPngFix behavior.  Use the full path to the Web Resource (we’ll add those in the next step).  It’s sensitive to the namespace of your project.

img, div, .pngfix, input {

    behavior: url(‘<%=WebResource(“”)%>’);


3. Modify the Properties/AssemblyInfo.cs file and add the approprate Web References.

[assembly: WebResource(“Resources.IEPngFix.css”, “text/css”,

       PerformSubstitution = true)]

[assembly: WebResource(“”, “text/x-component”,

       PerformSubstitution = true)]

[assembly: WebResource(“Resources.IEPngFix_blank.gif”, “image/gif”)]

[assembly: WebResource(“Resources.IEPngFix_tilebg.js”, “text/javascript”)]

Notice that the HTC behavior file is an “x-component”.  For a full list of MIME references, check out the  Also, perform substitution allows us to use dynamic calls of resources—within resources, such as in our CSS file.

4. Create a new class that inherits from CompositeControl.  This control will add the javascript and CSS references into our projects.  Override the OnPreRender method and populate the calling Page’s header with the links to our two files.

protected override void OnPreRender(EventArgs e)


       // Base Code:

       // Include JavaScript for tiled background support.

       string javascriptInclude =




       var jsLink = new HtmlLink


                     Href = javascriptInclude


       jsLink.Attributes.Add(“type”, “text/javascript”);



       // Include Css file that calls HTC.

       string cssInclude =




       var cssLink = new HtmlLink


                     Href = cssInclude


       cssLink.Attributes.Add(“rel”, “stylesheet”);

       cssLink.Attributes.Add(“type”, “text/css”);





That’s it.  Build and add the new control to your project.  You can then add a new forms page and drop the control into the page.  I prefer, however, to keep a “DefaultPage” and inherit my pages from it—add once, apply to all. :)

protected void Page_Load(object sender, EventArgs e)


       Page.Controls.Add(new IEPngFix());


Here we can see the rendered control. The PNG has a transparent background and without IEPngFix shows up as a white box rather than seeing the black background of the page.  Works like a champ!

IEPngFix in Action

Thanks again to Angus Turnbull for this excellent behavior!

Tags: , , , ,

Changing where RDP Windows Open On The Screen

November 5, 2008 1 comment

Have you ever created a saved RDP session and found that it wants to open on the wrong screen or in a half-scrolling window?  It’s annoying, right?

After a random opening one in NotePad2, I realized the RDP files were simply text files of properties.  Easy enough; however, the values are absolutely painful to read through.

Here’s a snippet of the windowing properties:

screen mode id:i:1
session bpp:i:16

I’m assuming that the properties are in order of


“screen mode id” takes an “i” or integer and has a value of 1 (for windowed mode).
“winposstr” takes an “s” or string and has a value of 0,1,400,92,2500,992

“winposstr” sounds a lot like Window Position String, right?

After a bit of Googling, I found KB886187 which discusses each of the attributes; however, forwards you on to another article on MSDN regarding the WINDOWPOS (for winposstr).

Roughly, winposstr follows the following order:

0,[maximized = 0, windows = 1], [left], [top], [window width aka right], [window height aka bottom]

So, I prefer an 1152×864 window (as it fits nicely on my side 1280×1024 monitor), I’d set the desktopwidth and desktopheight to:


Now, my “main screen” is 1920×1200, so to get things on the right-side screen (which is 1280×1024), I need to move on the left PAST 1920.


  • 1970 is 50 (px) from the left side of my second monitor (1920 + 50)
  • 50 (px) from the top of the screen
  • 3138 (px) is 1970 (starting position) + 1152 (width of the window) + 16 for the window padding (thanks Randy!)
  • 960 (px) is 50 (starting position) + 864 (height of the window) + 46 for horizontal padding and the title bar

Now my RDP window always opens on my second monitor—just about in the center and looks good. :)

AnkhSVN 2.0 Released – How’s it look?

When I first started using Subversion full time for all of my personal projects, I stuck with the VisualSVN server and AnkhSVN as a Visual Studio client.  Both were free, easy to install, and easy to use.

However, after a few weeks, the AnkhSVN client could almost be called “annoying.”  It trampled over the existing SCC plugins for SourceSafe (for work) and made a mess out of several of my project uploads.  I ended up going back to using TortioiseSVN and doing everything through Explorer.

When AnkhSVN 2.0 was released, I figured I’d give it another shot.

The site claims quite a bit—including several unique additions:

  • Pending changes window; subversion status and commands available in one place
  • Full support for Visual Studio 2005 and 2008; AnkhSVN is now a SCC package instead of just an addin
  • Better log viewer
  • Merge support
  • Property editor
  • AnkhSVN now supports most project types previously unsupported via the SCC api
  • All solution explorer actions (rename, copy&paste, drag&drop) keep subversion history now
  • Enhanced build process and setup
  • Automatic check for updates
  • And last but certainly not least end user documentation

All of those look great—especially the SCC package and changes window.  But how does it compare once installed?

After installation and starting up VS2008, everything looks normal.

Brief Look

Pending Changes Window

The new pending changes window is FANTASTIC—much improved over the old 1.x versions.  I did run into a snafu when trying to resize the window where the scrollbars didn’t update on the screen; however, I’m not sure if it’s a VSS or AnkhSVN issue.

SCC Package

Under Options > Source Control, AnkhSVN shows up just like it should.

What does boggle me is that all of the Subversion commands and menus are available no matter what—even when the VSS SCC is enabled.  It still has the stink of VSS and SVN trying to step on one another (“pick me! control your project with me! no, I’m better! pick me!”).

Log/History Viewer

I really like the new history viewer.  It’s clean and easy to read; however, if you change the options at the top—there doesn’t appear to be a way to “change it back” and see the history again, close the view and review.


  • Opening a project from Subversion (File > Subversion > Open from Subversion) will open a project just fine, copy it down, but never opens it.  You have to go back and open the solution after it’s created the local structure.  Not huge, but annoying.
  • When viewing history; you cannot view the history of a single file (that I’ve found) in the Repository Explorer. 

I’m still planning to give it a whirl for the next couple of weeks and see what happens.  Hopefully over a couple weeks I’ll have more time to code—it’s been a busy July so far!

FIX: Printing ANYTHING Locks Up Windows Server 2003

June 12, 2008 Comments off

A few days ago, I installed Visual Studio 2008 SP1 Beta and all the goodies that came along with that.  Since then, printing just didn’t work.  If I tried to print, it’d hang up the application for a few minutes (felt like hours) until it’d error out that the printer was not operational.  I could print DIRECTLY from the printer (the test page).  Meh.

Trust me, while trying to prototype a reporting application and print examples there is no happiness when you can’t print.

After several hours of hunting, testing drivers, trying fixes, etc… I finally came across a TOTALLY unrelated MS KB article, #948046.

The article is for Windows Server 2003 with SP2 and XP with SP2–-both x64 and x86 editions.  It focuses on Microsoft Word and not being able to print if the EU Font pack is installed.  The scenario of “Word document is not printed as expected” is pretty vague.

Now, I’ve been using the same HP printer drivers (an 8150 DN and 5550 DTN Color) for ages without any problems, so I can’t fathom that caused the problem, but who knows.  The problem started after installing VS2008 SP1 Beta (I haven’t combed the install logs to see if it reinstalled Unidrv.dll).

Anyway, the fix to this problem, so far (after testing in several applications including Adobe Acrobat, Word, Excel, Visual Studio, and SQL Management Studio), is to download the hotfix in the #948046 article

Install, reboot, and things work perfect.

Adding Multiple System Monitors ala Perfmon

May 22, 2008 Comments off

I use Perfmon a LOT. 

The logging and diagnostic software provided to us is, well, it’s just not that great.  Very slow to use and get around and every time I want a specific counter, I have to go ask for it because it’s someone’s “job” to add those. Ugh.  That’s no way to live.

Until now, I typically have a Perfmon console for each of my major application and SQL servers.  Why?  Because I was never smart enough to figure out how to add additional System Monitor controls into a single performance console.

Well, now I figured it out!

  • File > Add/Remove Snap-in
  • Click Add…
  • Select the ActiveX Control

ActiveX Control

  • A Wizard will start; scroll down and select System Monitor Control

System Monitor ActiveX Control

  • Give your new counter a name!
  • Repeat this until you’ve added your servers.  From there, configure each System Monitor control as needed.

Perfmon with all the servers!

From here, you can either add counters manually or use this brilliant PowerShell script.

FireFox 3.0 Release Candidate 1 Hits the Wire

May 16, 2008 Comments off

I’ve moved from the last beta up to release candidate 1 of FireFox 3 and am quite impressed.  You can read all about the latest version here.  FireFox opens up just as quick (if not quicker) on first run than IE 7 (on Vista). 

NoScript, the latest, IETab, and Adblock Plus all work like a champ. 

I also like the very compact theme that they’ve packaged with RC1–-Strata.

The coolest “tip” that I’ve found is the “Undo Close Tab”—did FireFox 2 have this?  I need to look sometime.  In the tab bar (when tabs are open or if you have it visible all the time), the “Undo Close Tab” reopens and rebrowses to wherever the last … well, closed tab was… brilliant for those times you accidently close the wrong tab!

I’ve browsed around a few dozen sights, dinked with some of the AJAX idea sides, and so far so good regarding rendering.  I’m pleased with this release so far. :)

TIP : Extracting Files from an MSI File

May 13, 2008 Comments off

Ever had an MSI file that you needed a library or something out of, but didn’t want to install it?  Amazingly enough, you CAN get to those files.

The Windows Installer (msiexec.exe) can be ran at the command line to extract files directly using an administrative install.


msiexec /a “YourMSIPackage.msi” /qb TARGETDIR=”DRIVE:\YourTargetPath”

Switches used:

/a – Administrative installation
/qb – Basic UI (simple GUI progress bar)

This is a lot easier than hacking it using WinRAR. :)


Get every new post delivered to your Inbox.