The Wiert Corner – irregular stream of stuff

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

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

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

    Join 1,565 other followers

Archive for the ‘.NET’ Category

winforms – Where is the Tab Order Assignment dialog in Visual Studio 2012+? – via: Stack Overflow

Posted by jpluimers on 2016/01/27

Duh: same for VS2013

It is still available, you just need to add it back to the View menu. Tools + Customize, Commands tab, Menu bar = View. Select the menu item in Controls where you want to insert it, say the bottom one. Then Add Command, Category = View, Commands = Tab Order.

Source: winforms – Where is the Tab Order Assignment dialog in Visual Studio 2012? – Stack Overflow

–jeroen

Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 3.0, C# 4.0, C# 5.0, Development, Software Development, Visual Studio 2012, Visual Studio 2013, Visual Studio 2014, Visual Studio 2015, Visual Studio and tools | Leave a Comment »

c# – How can I create a temp file with a specific extension with .net? – Stack Overflow

Posted by jpluimers on 2016/01/27

You’d think this is a simple question.

Be amazed by the many ways leading into to creating a temporary file with a specific extension.

This list doesn’t even cover all of them:

  • Create a file name based on GetTempPath, a Guid and an extension.
  • Use the TempFileCollection from the Compiler in System.CodeDom.
  • Get a random file name, then change the extension. Loop until it is unique.
  • Use a timestamp to generate unique file names.

All via: c# – How can I create a temp file with a specific extension with .net? – Stack Overflow.

Which one would you choose?

–jeroen

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, RemObjects C#, Software Development | Leave a Comment »

.NET Regex Tester – Regex Storm

Posted by jpluimers on 2016/01/26

Greate stuff:

Online .NET regular expression tester with real-time highlighting and detailed results output.

Allowed me to quickly verify the pattern PWWWC\d\dFE\d\d_\d\d\d\d-\d\d-\d\d\.zip matches only one of these filenames:

PWWWC07RI01_2016-01-10.zip
PWWWC08FE03_2016-01-04.zip
PAPPC00BT01_2016-01-04.zip

–jeroen

Source: .NET Regex Tester – Regex Storm

Posted in .NET, Development, RegEx, Software Development | Leave a Comment »

Threading in C# – Free E-book

Posted by jpluimers on 2016/01/18

Still a great book. I love the chapter Threading in C# – Free E-book which you also can get as a PDF download.

It’s a chapter from C# 56/5/… in a Nutshell by Joseph Albahari. Great book!

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development, Visual Studio 2008, Visual Studio 2010, Visual Studio 2012, Visual Studio 2013, Visual Studio 2014, Visual Studio 2015, Visual Studio and tools | 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 | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 1,565 other followers

%d bloggers like this: