Logo
September 26, 2006

A look into Vista

Ever wondered how they do things inside of Microsoft? As a developer that makes extensive uses of Microsoft technologies and tools, I’m always interested in an insight into their development process. Well, if you’re like me, then I may have a real treat for you.

Vinny Pasceri, the AERO Program Manager for Microsoft has posted an great insight on the (fairly new) Windows Client Team Blog. This is a great peak into what the design process looks like, and even includes what may be the first publicly released feature spec. This makes for a great read, I highly recommend taking a close look at this article and the included spec.

September 24, 2006

EventArgs: No need to pass a new Instance

If you look at the code I write, seeing a line similar to the following would be fairly common:

RaiseEvent LoadComplete(Me, New EventArgs)

Yesterday, I wouldn't have given this a second thought, but today, the story is a bit different. A friend of mine pointed me to an interesting comment by David Kean (from Microsoft) on the MSDN Wiki indicating that the line above is actually wrong!

So, based on his comment, I should be using EventArgs.Empty instead of creating a new instance, something like this:

RaiseEvent LoadComplete(Me, EventArgs.Empty)

So using EventArgs.Empty must be better somehow, so I decided to take a look and see if I could figure out just what the difference would be. The MSDN states that "The value of Empty is a read-only instance of EventArgs equivalent to the result of calling the EventArgs constructor" – so what's the difference? Time for a trip into the Reflector.

The Reflector shows two constructors:

Public Sub New()
End Sub

Shared Sub New()
  EventArgs.Empty = New EventArgs
End Sub

So, EventArgs.Empty just calls New EventArgs and returns that. Right.

Anybody see something there that I'm missing? Seems to me that the somewhat more verbose, but more clear (as to what is actually happening) syntax would be better, and no less efficient. If anybody has an opinion about why you would do one instead of the other, I'd like to hear it.

September 23, 2006

Make XP Pretty

While going through my (long) list of RSS-feeds that I monitor, I found this gem of an article: Vista Transformation Pack: Vista-ize your XP. The Vista Transformation Pack is a clever little application that moves your XP desktop several steps closer to the beauty that is Vista. While the ‘transformation’ doesn’t give you all of the new UI goodies that come with Vista, it does add a fair bit of eye candy.

I’m not typically one to promote UI tweaks like this, but after playing with the settings, I’ve now have a great looking setup without the instability that still goes with Vista.

September 20, 2006

VB.NET 2005 Interop Toolkit

The VB Team has just announced the release of a VB.NET / VB6 Interop toolkit, complete with source. For those of us that work in shops that still maintain a fair number of legacy applications, this could be quite useful. Here’s the description straight from Microsoft:

The Interop Forms Toolkit 1.0 is a free add-in that simplifies the process of displaying .NET WinForms in a Visual Basic 6 application. Instead of upgrading the entire code base, these applications can now be extended one form at a time. The goal is a phased upgrade, with production releases at the end of each iteration containing both Visual Basic 6 and Visual Basic .NET forms running in the same Visual Basic 6 process. 

My favorite thing about this release is the inclusion of the source code* – I always love taking a peak at how MS writes code. As a side note to all this, this is just one part of the new Visual Basic 2005 Power Pack, a collection of controls, components and add-ins – all free. This is one worth looking at.

* Note: You’ll find the source if you take a look in the “X:\Program Files\Microsoft Visual Basic 2005 Power Packs\Interop Forms Toolkit 1.0\SDK\Source” folder.

September 17, 2006

Running RegEdit as SYSTEM

While facing an interesting research challenge, digging into the inner working of Windows, I realized that I needed to change a registry value. That’s simple enough, I fire up RegEdit, make the change, then politely as RegEdit knows how, it told me that I couldn’t change the value! Being one that hates when my computer tells me I can’t do something, I had to find another option.

So after some research, I found my answer: sc. This is a great little utility (included with Windows), and made the task of running an application as SYSTEM* much easier. At this point some of you may be wondering why I didn’t just use RunAs instead, as it’s designed to allow execution as another user. Well, from all that I’ve found, there is no way to get RunAs to spawn a process as SYSTEM, one of the downsides of SYSTEM not being a true user.

Another option that I found (somewhat) attractive initially is RunAsEx, an open source, GUI based version of RunAs. This could be useful, but I found it to be more hassle than it was worth. Still might be useful for somethings, but with all the bugs I found in it, I knew there was a better way.

Now, back to the solution I chose: Using sc to create a service that will execute the application I’m after. This works because by default all services execute under the SYSTEM user context, so all we have to do is create a service to call the application we need. Surprisingly simple, and it works quite well.

Creating the service looks something like this:

SC CREATE AcDebugSvc binPath= "regedit.exe" type= own type= interact **

This creates the service, so that now all you have to do is start the service (SC START AcDebugSvc ***) and you’ll see your copy of RegEdit. If you check in Task Manager, you’ll be able to confirm that it is actually running as SYSTEM. This is an extremely powerful debugging tool, as it allows you to instantly execute any application as the most powerful user that Windows offers.

Once you are done with your work, just delete the service (SC DELETE AcDebugSvc) and call it a day, that simple. This can also easily be scripted if you tire of typing the commands so often, and it can also be used with most applications. Using this for the Command Prompt (binPath= "cmd.exe /K start") and for Task Manager (binPath= "taskmgr.exe") both strike me as being quite useful.

* WARNING: As I hope most of you know, System is a very powerful account, it’s almost limitless in what it can do. If you aren’t careful while working under this user context; you may end up with a rather expensive paperweight instead of a computer. You have been warned.

** Note: As odd as it is, the spaces after the equals and before the value of the parameters is quite important, the call will fail if you omit them.

*** Note: You’ll get an error message (“The service did not respond to the start or control request in a timely fashion.“) when you call this, it’s nothing to worry about. The reason that it occurs is that to respond to the message it receives the target application must be designed to operate as a service. Since we are using this for other purposes we, we don’t really care.

FireFox Toys: ErrorZilla

While my favorite browser will always be Opera, I’m a big fan of Firefox; its amazing selection of add-ons (a feature that Opera sadly lacks) adds much to its value for me. With the addition of plug-ins like the excellent Web Developer add-on, Firefox becomes a powerful development and browsing platform.

ErrorZilla I just learned of a new add-on released by Eric of roachfiend.com called ErrorZilla, this is a great idea. It’s a replacement for the default Firefox error pages, new error pages with additional features. Here’s the quick run-down of the new options presented:

  • Try again (refresh)
  • Google Cache
  • Wayback
  • Ping
  • Trace
  • Whois

Now, when faced with a dreaded “Server not found” error, it’s much easier to find some useful information. When researching a topic, there’s nothing worse than having to go in circles trying to find a page that will load, this add-on is certainly a step in the right direction. I really hope that the Firefox developers see this add-on and consider adding this or similar functionality to the distribution.

Next Page »