Archive for the ‘Windows’ Category.

Win32 EXE to service in Windows Server 2008

We had a server meltdown happen here earlier this week, and as part of the collateral damage, an automated order processing application that has been running since 2004 has been off-line. This application was written in VB6 with a minimal user interface, and as such, I have always remoted into the server, started the program up on the server and left it open, and then just closed my remote desktop application, which left the session open and running.

We wanted to change this to make it a bit more reliable, which means Windows service. Unfortunately, the application does not have the correct hooks in it that make it be able to be seen as a service. (I could create a service with the EXE name as the target, and the EXE would run when I started up the service, but it would soon crash as service manager could not find something it was looking for.)

After a little bit of digging, I found some suggestions on using the srvany.exe application as a shell to launch my application, and I must say it seems to work marvelously. Here is the link where I found the solution:

Application as a Service “srvany.exe” in Windows Server 2008

Here are the important steps from the article above (in case it relocates or disappears):

  1. At the time of this posting, there is no Windows Server 2008 Resource Kit Tools, so get the “srvany.exe ” from the “Windows Server 2003 Resource Kit Tools ” and copy it to a suitable location on your Win2008 server (e.g. C:\Windows\System32\ ).
  2. Use “sc ” to create a new service that launches “srvany ” (e.g. sc create MyService binPath= C:\Windows\System32\srvany.exe DisplayName= “My Custom Service” )
  3. Using RegEdit : create a “Parameters ” key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Parameters\ )
  4. Using RegEdit : within the newly created “Parameters ” key , create a string value called “Application ” and enter the full path to the application you are wanting to run as a service. (No quotes required.)

In the article linked above, keep in mind that Parameters is misspelled at the end of item #3, I have corrected it in my item #3 above. Other than that, it seems to be working great.

Code 39

Did you ever get the dreaded “Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. (Code 39)” message in your Device Manager for your DVD/CD-ROM drive?

This happened to a computer here at our office, and it did this for both the internal drive and for an external USB drive that we hooked up to it as well.

Well, to solve the problem, we found this link and ran a neat little automated program from Microsoft that went in and fixed up the drivers for both the internal and external drives.

Your CD or DVD drive can’t read or write media

Very cool. This was way easier than some of the other solutions that we were seeing.

Netbook resolution in Windows Virtual PC

A customer lets me know that they are having a problem with one of our software products. It was something specific to the 1024 by 576 pixel resolution of their Dell netbook, which was a problem since we did do not have a computer with that resolution.

So I decided to try to use the Windows XP Mode of Windows Virtual PC on my Windows 7 Ultimate dev box to simulate the netbook resolution and try the software in that virtual machine. Unfortunately, I fire up the Windows XP mode only to find that it is fixed to 1024 by 768 resolution in the display settings, with no way to change since the Advanced button is disabled and there are no other choices for the resolution slider.

After I investigated a bit, I found that I could edit the Windows XP Mode.vmc file (located in the folder C:\Users\My Name\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines, substitute your name for My Name in the path), which is an XML file. There is a ui_options section in the file, my file now contains the following 2 items:

<resolution_height type="integer">576</resolution_height>
<resolution_width type="integer">1024</resolution_width>