Posts
250
Comments
24
Trackbacks
13
November 2006 Entries
GDI+ Memory Leaks - When Dispose is not enough.

The CPU temperature monitor has been updated. 

http://www.cicoria.com/cs1/blogs/cedarlogic/archive/2006/11/29/404.aspx

I was seeing GDI exceptions and tracked it down to just not releasing GDI handles.

So, dispose is not enough.  Need to call DestroyIcon to ensure that any unused icons are actually destroyed.  I had a Dispose() being called on the Icon object, but it wasn't enough.  So, I put a little "swap" out the old and then call DestroyIcon in the Icon Handle.  That seems to solve it.  The GDI objects in Task manager are now constant and run around 50 or so with small variations.

The following is the PInvoke signature.

[System.Runtime.InteropServices.DllImport( "User32.dll" )]
private static extern int DestroyIcon( System.IntPtr hIcon );

I attempted to leverage some Code Profilers (ANTS and SciTech); the first didn't help.  SciTech might have been able to but I just couldn't get it running on Vista with VS 2005 etc.  So, went down the old comment out and watch path to see which code path was causing the issues.

posted @ Thursday, November 30, 2006 4:25 PM | Feedback (0)
Workflow Designer in Javascript.

This example, as stated, is not the designer re-hosted.  It's a JS implementation.  Nonetheless cool

http://blogs.msdn.com/ghenap/archive/2006/10/25/netfxlive-js-based-workflow-designer.aspx

http://www.netfxlive.com/

posted @ Wednesday, November 29, 2006 1:57 PM | Feedback (0)
Hibernate Command for Vista

With Vista, all efforts have been made that when you want to shutdown, the UX pushes you to a sleep state (S3).  That's evident by the single power button on the start menu that is wired to S3.

However, I'm a Hibernate kind of user.  I prefer to Hibernate whenever possible.

With the command line shutdown.exe command, they've added a new switch (along with a bunch of others) that allows a simple command to hibernate.

So, I've added to my desktop & quick launch a shortcut to the following command line:

shutdown /h

This puts the system into Hibernate with no questions asked.  No UAC, nothing.

posted @ Sunday, November 26, 2006 5:48 PM | Feedback (0)
Michael Crichton's "Next" - Viral marketing site.

Here's the associated site for Michael Crichton's new book Next.

http://www.nextgencode.com/

I've read just about every Michael Crichton book and been hooked on his writing since I first saw the Andromeda Strain back in the 70's.

His books have always weaved science into the fiction to make it believable and convincing. Always grabbing current science topics to make the plot ever more interesting and it's usually difficult to detect the real from the fiction.

My brother Ed, once told me a story, perhaps a tall tale, that his first wife lived in the same building with Michael Crichton and he had given her one of the Key's used in the Andromeda Strain film that was required to shut down the nuclear self destruct for the facility.  Not sure if that was a tall tale or not, but it sure had the "that's cool" aspect when your a kid, probably making me a Crichton fan ever since.

posted @ Sunday, November 26, 2006 9:14 AM | Feedback (0)
Converting DVD to Files for Zune and Mobile

Tool that captures DVD output to file for later playback...

http://www.pocketdvdwizard.com/

posted @ Wednesday, November 22, 2006 2:42 PM | Feedback (0)
Good overview of IIS7 and working with it on Vista for Development, Differences, and some Gotchas.

http://www.code-magazine.com/Article.aspx?quickid=060103

posted @ Wednesday, November 22, 2006 2:42 PM | Feedback (0)
CPU Temperature Monitor

Updated 12/18/2006 - fixed issue with not listening for Microsoft.Win32.SystemEvents.SessionEnded event - can't logoff/shutdown issue

Updated 11/24/2006 - added check if system implements the required WMI objects.

Updated 11/30/2006 - fixed GDI memory leak

Given the issues with Toshiba laptops running very hot with Vista Glass Aero enabled, and just in general with XP as well ( Hot enough to burnout motherboards that require replacements from the manufacturer)  I wrote this utility to give me system tray status on the current CPU temperature.  I'm currently adding GPU temperature but that requires distribution of licensed components (dynamic libraries).

Installation Files - a self extracting Exe file that contains the MSI installer - built with WinRar.

Solution Files - only contains projects with no private certificates - you'll need to change some things to get it working.

Basically, it just sits in your system tray showing the current CPU temperature with the following color schemes:

  • Green - Running at below 50% of critical temperature
  • Yellow - Running at > 50% but < 75% of critical temperature
  • Red - Running >= 75% of critical temperature.

These settings are configurable if you modify the TemperatureMonitor.exe.config file, along with the maximum readings.

The first reading shown is the current CPU temperature; the second is the Critical Temperature as reported by WMI. 

The WMI namespace and object is root\WMIMSAcpi_ThermalZoneTemperature

WMI unfortunately requires elevated permissions on Vista.

The task bar icon has 2 menu options;

  • Restore - restores the window as shown below
  • Exits the application

The main window is show below:

  • The first tab just shows a Line Plot of the history of readings
  • Second tab is a list of those readings
  • Third tab is used for diagnostics and has a list of any exceptions.  There's also a file written to the application directory but it only has the last exception
  • The last tab is the about box that also has the "Install Public Certification" action button on it.

The assembly is signed with my sample signing certificate.  If you click on the about box you can install the public certificate but it still requires user action to launch in Vista given UAC restrictions and Windows Defender doesn't recognize the program.

Use at your own risk!!!

 

Some users are reporting issues.  This is dependant upon specific WMI obects being present and implemented on your system.

To Test, put the following into a VBS file, then run the following script from an elevated command prompt as follows:
cscript CpuTemp.vbs
============
''''On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MSAcpi_ThermalZoneTemperature",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "MSAcpi_ThermalZoneTemperature instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "CurrentTemperature: " & objItem.CurrentTemperature
Wscript.Echo "CurrentTemperature: " & objItem.CriticalTripPoint
Wscript.Echo "CurrentTemperature: " & objItem.ThermalStamp
Next

posted @ Wednesday, November 22, 2006 2:42 PM | Feedback (3)
Targetting .NET 1.1 Runtime with Visual Studio 2005

Well, Vista is out. However, no official support for VS.NET 2003. So, what do you do if you need to build projects that target the 1.1 runtime? Well, MSBee is there to help. MSBee is a small tool from Microsoft that allows Visual Studio 2005 projects to target the v1.1 framework.

http://go.microsoft.com/fwlink/?LinkId=59384

http://www.codeplex.com/Wiki/View.aspx?ProjectName=MSBee

posted @ Wednesday, November 22, 2006 2:41 PM | Feedback (0)
Charting with .NET and NPlot

I'm building a simple utility that monitors CPU/GPU heat on Windows Systems.  Given that there are heat issues running Vista Glass Aero on Toshiba Tecra models (I'm using an M5) I wanted a simple System Tray utility that would monitor it and show status and temperature.  Eventually I'll add some alerting, but just needed something quick.

One feature that I added is showing the historical temperature in a graph.  I was writing something to convert the array of decimals into a line graph until I found NPlot.

NPlot is a small (160K) assembly that provides very nice Charting Capabilities.  It supports .NET 2.0, 1.1 and even mono (in fact it's built on Mono first).

http://netcontrols.org/nplot/wiki/

http://sourceforge.net/projects/nplot/

The heat issues that have been noted are impacting older systems to the point that it's burning out the GPU and ultimately requires a replacement motherboard in Tecra systems (M3, M4, M5, M7 models all seem impacted).

posted @ Wednesday, November 22, 2006 2:41 PM | Feedback (0)
PowerShell Analyzer - Great too for building and testing PowerShell scripts....

This tool does the trick with helping you navigate the complex namespaces of PowerShell and getting productivie immediately.

http://www.PowerShellAnalyzer.com/

posted @ Wednesday, November 22, 2006 2:40 PM | Feedback (0)
News





Tag Cloud