Many developers find it annoying to debug the built-in Windows Service projects in Visual Studio. You can’t simply create a new project and click the “Run” button in Visual Studio and expect it to run with a debugger attached, like you can with most other project types. Normally you would install the service, start it, and attach a debugger to the process, but this is a hassle and doesn’t help much if you need to debug issues in the OnStart method.
To solve this problem and help with diagnostics, I typically add some boilerplate logic to my Windows Service projects. By passing in command line args to my service .exe, I can either have it launch in a light-weight debug console or make it wait to call the OnStart method until a debugger is attached.
Continue reading “Debugging Windows Service Projects (C#)”
I’ve finished the functionality for my Quest for Glory character editor web application. I have the source code checked in to my github page, and the app is hosted over at: qfg.bitcollectors.com.
This currently only supports QFG1 (aka Hero’s Quest) characters, but I still plan on getting QFG2 characters implemented someday – hopefully soon. Please let me know if you find any issues.
Please note, I renamed the GitHub repository to BitCollectors.QfgCharacterEditor and I will be renaming the solution and projects soon.
Click here for the code
Click here to run the web app
Update (11.19.2013): there is now an official project page for this application. To keep up to date on the latest releases, please check out
An important part of my job is to be able to interface our product with third party UI’s. Typically, I know virtually nothing about the UI before I begin the project, only that I will need to enter data into different fields.
Over the years, I’ve accumulated a list of my “goto tools” to help me assess each application. Behold:
Continue reading “Resources for UI Automation and simulating user input”
I created a new repository on GitHub called BitCollectors.UIAutomationLib which contains an XML driven .NET library for automating keystrokes and mouse clicks on just about any UI. I’ve used this on several applications, including apps running through Terminal Services and Citrix. It’s quite powerful, but I’m not claiming it’s the best solution for native Win32 apps (although it might be the easiest to use). If you’re interfacing with a native Win32 app and you don’t mind writing a little code, you might want to look in to using Microsoft’s UI Automation framework. Their framework lets you get a handle on a control and populate a text box or simulate a button press directly on the control. My library simulates key strokes and mouse clicks, so it doesn’t really work at the control level.
Continue reading “UIAutomationLib on GitHub”
If anyone has a suggestion for a better name than “Hide Welcome Screen Users” please feel free to drop me a line :).
Basically it’s just a very small tool written in C#/.NET that allows you to hide users from the Welcome Screen in Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2. I needed to create several users that performed system tasks, and it was annoying to see them on my Welcome Screen every time I booted up. There’s an easy way in the registry to prevent specific users from showing up there, so this tool is basically just a small tool that edits those registry keys.
It’s checked in at: https://github.com/aplocher/Welcome-Screen-Hide-Users. Please let me know if you find any issues with it.
I’ve uploaded the C# source code for my Quest for Glory Character Editor. Currently it only supports editing or creating characters from QFG1, but I’m very close to finishing up support for QFG2. It took some work to reverse engineer some of the checksums that are generated, but the support for QFG1 is pretty solid and I’m very happy with the progress I’m making with QFG2 (QFG2 code isn’t yet checked in).
Please let me know if you find any issues or wish to contribute to the code. In particular, I could definitely use some help with support for QFG3 and 4.
I will package up a setup file for it eventually, but for now the code and compiled exe are available at: https://github.com/aplocher/BitCollectors.QfgCharacterEditor. If you plan on downloading the exe, I believe I’m targeting .NET4 (Client Profile should work).
I will also be providing an ASP.NET version eventually, so you can make edits or create a new character without ever needing to install anything.
Update (02-14-2013): Updated GitHub URL to new repository name.
Update (05-17-2013): QFG character editor web app is online at: qfg.bitcollectors.com. See blog post about it: here. Also, watch for an update very soon with QFG2 support. The code is checked in to GitHub and works but I’m trying to wrap up a couple other features, such as the ability to edit your gold inventory. I will update the web app and have a setup file available when it’s ready. I will keep you posted!
Update (06.14.2013): QFG2 character support has been added and the setup file is available now. Please see my latest post at: HERE.
Update (11.19.2013): there is now an official project page for this application. To keep up to date on the latest releases, please check out www.bitcollectors.com/Project/QfgCharacterEditor
The following snippet of code can be used to determine whether a Windows Mobile ComboBox (in .NET Compact Framework) is currently dropped down or not:
private const int CB_GETDROPPEDSTATE = 0x0157;
private bool IsComboBoxDroppedDown(ComboBox comboBox)
Message comboBoxMessage = Message.Create(comboBox.Handle, CB_GETDROPPEDSTATE, IntPtr.Zero, IntPtr.Zero);
return (comboBoxMessage.Result != IntPtr.Zero);