The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘The Old New Thing’ Category

Trying to recover from enhancement software that generates fake input incorrectly – The Old New Thing

Posted by jpluimers on 2017/02/08

Be sure to read the details in Trying to recover from enhancement software that generates fake input incorrectly – The Old New Thing [WayBack] (much more Old New Think stuff below):

The most insightful part for me was this diagram listing where various methods enter the message pipeline (I added the GetMessage/PeekMessage entry):

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi-Tage.de, Development, Event, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Where can I get the glossary of Microsoft’s standard translations for computer terms? – The Old New Thing

Posted by jpluimers on 2016/12/22

A while ago I bumped into [WayBackWhere can I get the glossary of Microsoft’s standard translations for computer terms? – The Old New Thing

Since I’m a non-digital pack-rat as well, I love [WayBack] this comment by [WayBack] Ian Boyd:

We have an *old* copy of the Microsoft Style Guide – an actual book. From that book i’ll always remember that e-mail has a hyphen in it.

I’ve that book too and write e-mail the same way.

But books are often hard to search through, so I love this list that [WayBack] Raymond Chen made:

I especially like the [WayBackinteractive search, but with any outcome, please remember that the context of your translation is very important.

For instance, I vividly remember a project some 20+ years ago where we had to translate the words “Close” and “Cancel” in the realm of the insurance business.

All guides indicated “Close” should become “Sluiten” which in that realm is colloquial for “Afsluiten” which means “to take out an insurance” implying a totally wrong action. Similarly “Cancel” translated to “Annuleren” which in the same realm would mean “to cancel an insurance”.

So we went for very specific translations narrowing down what exactly would happen in those screens, like:

  • “Verlaten” (English “Exit”)
  • “Bewaren” or “Opslaan” (English “Save”)
  • “Terug” (English “Back”)

–jeroen

Posted in Development, internatiolanization (i18n) and localization (l10), Software Development, The Old New Thing, Windows Development | Leave a Comment »

Why does the Windows calculator generate tiny errors when calculating the square root of a perfect square? – The Old New Thing

Posted by jpluimers on 2016/12/07

In the continued “floating point code is hard for most software developers” series:

[WayBack] Why does the Windows calculator generate tiny errors when calculating the square root of a perfect square? – The Old New Thing

Because it doesn’t know that it’s a perfect square.

–jeroen

Posted in Algorithms, Conference Topics, Conferences, Development, Event, Floating point handling, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Blast from the past Windows 2003 Service Pack 1..2 era hotpatching

Posted by jpluimers on 2016/02/12

For a short while (from Windows 2003 Service Pack 1 till Windows 2003 service pack 2) some updates used Windows Hotpatching.

Some links on the how/why and how to abuse it:

All because of this little post:

Hier ein Einblick in die Denkweise von Leuten, die Software auf CD-ROM verteilen und bei denen Release Zyklen in Monaten und nicht Minuten gemessen werd… – Kristian Köhntopp – Google+

–jeroen

 

Posted in C, Development, History, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Windows applications: Icons and the Shell; names, sizes, etc.

Posted by jpluimers on 2015/12/23

When adding Icons to your Windows applications a few things matter.

Selecting the icon resource

The icon selected by the Windows Shell (for modern Windows versions usually Windows Explorer), is the one with the lowest ID. When there is no icon with an ID, it selects the icon with the lowest name.

Icons in Windows can have both IDs and names. Even though API calls like LoadIcon have an lpIconName parameter, you can convert the ID to a name using MAKEINTRESOURCE.

There is a difference between the format of an ICO file and the icon resource (technically two things: RT_GROUP_ICON resource directory and an RT_ICON resource for each image) contains a list of icon images.

The selection process is on the RT_GROUP_ICON, and then within the group on the ICON itself.

For the RT_GROUP_ICON process, modern Windows versions still use the algorithm used by Windows 95 (not that by Windows NT):

Windows NT simply chooses the first resource listed in the application’s RC script. On the other hand, Windows 95’s algorithm is to choose the alphabetically first named group icon if one exists. If one such group resource does not exist, Windows chooses the icon with the numerically lowest identifier.

For a Delphi application the icon shown must be named MAINICON, since the below source fragment has been in TApplication.Create(…) like forever:

FIcon.Handle := LoadIcon(MainInstance, 'MAINICON');

Which means that if you want the Windows Shell (usually Explorer) to select that one, all other icon resources in your executable must have names that sort after MAINICON.

Selecting the icon within a resource

For the individual icon, the process is more complex. Even the summary is. To summarise the summary to select an icon for the requested size:

  1. Prefer the image closest in size.
  2. When more images of that size are present, match on the best color depth for the display.
  3. When no color depth matches, prefer the image with the greatest color depth not exceeding the color depth of the display.
  4. When all exceed the color depth, prefer the lowest color depth.

For color depth, treat 8 or more bits per pixel as equal. So there is no advantage of including a 16×16 256-color image and a 16×16 16-color image in the same resource — the system will simply choose the first one it encounters. When the display is in 8-bpp mode, the system will choose a 16-color icon over a 256-color icon, and will display all icons using the system default palette.

I’m not completely confident how 32-bit precisely fits in this scheme. If someone knows, please let me know and I’ll include the information.

I usually take 32-bit color images here which are actually True Color 24-bit + alpha channel RGBA images.

What about requested size?

Actually there are a lot of sizes that Windows can request, and there are many articles about it, some of which contradict each other.

From what I assembled, these are the sizes you need to run on Windows XP / Server 2003 and up:

  • 16×16
  • 20×20
  • 24×24
  • 32×32
  • 40×40
  • 48×48
  • 64×64
  • 96×96
  • 128×128
  • 256×256 (for Windows XP / Server 2003: do not compress this size)

I might be wrong, so here are some links:

–jeroen

via:

Posted in .NET, Delphi, Development, Software Development, The Old New Thing, Windows Development | Leave a Comment »

.NET/C#: PasteText command line tool as reverse of Clip.exe

Posted by jpluimers on 2015/12/15

Quite a while ago I learned about the clip.exe tool.

clip.exe is a nifty tool that allows you to copy console text output to the clipboard. Though shipping with Windows Server 2003, it wasn’t part of Windows XP, but as of Windows Vista it shipped on desktop versions of Windows.

Digging a bit deeper, I found out it was already part of the Windows NT 4 Resource Kit.

So I wrote PasteText:

PasteText: the reverse of clip.exe; pastes Clipboard.GetText() or Clipboard.GetFileDropList() to the standard output.

The full source code is below and in my repository.

There are many examples on the internet about Clipboard.GetText, but there is very little about Clipboard.GetFileDropList. Read the rest of this entry »

Posted in .NET, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 3.0, C# 4.0, C# 5.0, Development, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Windows Kernel object names are optional. Don’t give them a name unless you intend them to be shared. (via: The Old New Thing)

Posted by jpluimers on 2015/07/01

Very interesting:

Kernel object names are optional. Don’t give them a name unless you intend them to be shared.

–jeroen

via: [WayBackYou can name your car, and you can name your kernel objects, but there is a qualitative difference between the two – The Old New Thing – Site Home – MSDN Blogs.

Posted in .NET, C, C++, Delphi, Development, Software Development, The Old New Thing, Windows Development | Leave a Comment »

StUF – receiving data from a provider where UTF-8 is in fact ISO-8859

Posted by jpluimers on 2009/05/08

Recently when receiving information from a StUF webservice created by a large Dutch provider of government IT systems, we had an issue with characters having their high bit set.

Although the web-service pretended to send their information as UTF-8, in fact they were encoding using a form of ISO_8859.

The most likely character set they used is ISO-8859-1 (since that is the default encoding for the HTTP protocol), but it might also be ISO-8859-15 which is an adaption of ISO-8859-1 trading some typographic characters for the euro-sign and some characters from French and some characters used for transliteration of  Russian, Finnish and Estonian.
(note that the printable characters of both ISO-8859-1 and ISO-8859-15 can be displayed by the Windows-1252 code page)

Since it is not possible to reliably “guess” the right encoding (there are way to many possibilities, even IsTextUnicode that is used by Notepad fails, see below), the only way is to use a fixed reencoding that depends on the StUF data provider. Read the rest of this entry »

Posted in Development, Encoding, ISO-8859, ISO8859, Mojibake, Software Development, The Old New Thing, Unicode, UTF-8, UTF8, Windows Development, XML, XML/XSD | 5 Comments »