GOG.com

If you like to play old games you may want to check GOG.com site. That site gives you possibility of purchasing old games for very cheap price (5.99 or 9.99 at the moment). Not only that will give you a game but you will get to own the game within few seconds and all that without any DRM. Once you purchase game there, you do really own it.

They do not have big library currently although you can see it expanding every month but there are some gems like Fallout or Freespace serial. Even Unreal is available. For more of them, just go to site and browse around - you will be amazed how many “good old games” made it to list.

QText

After quite a long time there is beta version of QText out. [2009-03-19: Beta is closed, final is out.]

Most of improvements had to do with interface changes in order to make it look and behave nicer on Windows Vista. One of areas which improved greatly is support for high dpi modes.

64-bit systems are now supported fully (this may have some connection with me getting 64-bit laptop :)) and you can now use Rich text format if you cannot live without bolds, italics and similar decorations.

There are few more changes but I will leave you to check them yourself.

You can download installer here. [2009-03-19: Beta is closed, final is out.]

Case of Missing Font

Once upon a time I was Visual Basic 6 programmer. These days one of those applications needed small update. I did change within five minutes, compiled it (in P-code because it doesn’t work when compiled as Native - but that is another story) and deployed it on network. Of course next day I got a call about a bug.

Barcode fonts

In those days it was hard to put barcode (Code 128 to be exact) on Data Report. Easiest path you could take was to use barcode font (or create it as I did) and store some textual representation of that code in database. When report is created, it would use that font to display text and by accident it would printout barcode. It wasn’t elegant solution but it worked.

The Bug

Since I don’t use same “barcode style” these days I hadn’t had that font installed on my system. For one reason or another something happened during compile that caused application to forget about my barcode font defined in Data Report. It just used same font as for rest of page which caused big numbers (my encoding of barcode used quite few of them) to appear where barcode should be.

Solution was quite simple. I installed that font on my Vista (yes I know, bug may as well be because VB6 is not supported on Vista officially) and recompiled application. Everything was ok this time.

It left me wondering however. Are there any other bugs that I introduced by simple fact of recompiling application?

Living in High DPI

What’s the problem?

Most of applications are pretty ignorant regarding DPI settings (including here a majority of mine applications also). Developers tend to optimize for 96 dpi and leave it at that. With more and more high DPI LCDs it is very hard for users to stay at that setting so lot of them are working on 120%.

On Windows XP this would look very bad if application is not high DPI aware but on Vista they decided to stretch client area of those misbehaving applications to match user selected dpi settings. Form is little bit blurry but it is better than element misplacement and text clippings. Old misbehaving applications look almost decent there.

Problem is that on Vista even applications that took effort to look good on higher DPI settings are affected with that scaling. All that work was done for nothing since Vista makes your application think it is working at 96 dpi.

Telling Vista that I am smart guy

There is a way to let Vista know that we took that additional effort. One just needs to call SetProcessDPIAware API (Vista only!) and Windows will leave us alone to manage our own interface. Since P/Invoke is not my favorite way of doing things from .NET I am happy that there is possibility of embedding it in manifest also.

If you have Visual Studio 2008 embedding this manifest is easy as creating new file but in older versions you will have some more work to do.

Some time later I will lead you through actual creation of well behaving application.

Default System Font

.NET Framework 1.0 and above

By Microsoft’s design guidelines you should be using system defined font for displaying user interface elements in your program. Of course, Microsoft found it very helpful to ignore that and assign Microsoft Sans Serif at 8.25 points as default font for all new .NET applications. Since both XP and Vista brought us new font (Tahoma at 8.25 points and Segoe UI at 9 points, respectively) most of .NET applications are just looking slightly out of place.

Solution is quite simple - you should only manually assign new font to form and all elements will pick up that setting (if you left them at default). Only problem is retrieving a font to use.

Proper way

Microsoft states that we should use GetThemeFont API to get this information. Problem is that this function does not exist in managed world and you don’t always have option to make P/Invoke calls (i.e. because of security settings) and portability also comes into question (Windows older than XP and mono).

SystemFonts.???

One would think that SystemFonts.DefaultFont would return what we need but for some reason known only to guy who made that function it returns Microsoft Sans Serif in almost all cases. Why does it ignore real windows default font is unknown to me. Some reflecting is probably needed but I tend to be on lazy side when there is no actual possibility to change anything.

Good choice is strangely SystemFonts.MessageBoxFont since this return proper font on all platforms I have used it. It is not official source for that information but should be good enough if you really want (or need) to stay in managed world.

If one wants to see example of it, I am happy to provide.