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,860 other subscribers

Archive for the ‘Delphi’ Category

Windows Vista/7/8/… hangs for Windows Common dialogs when your COM initialisation is wrong

Posted by jpluimers on 2016/02/03

A while ago I bumped into this: As of Windows 7 (and probably Vista), the standard Windows Common Item (Open and Save) Dialogs expect the main thread to be initialised with STA because it is easier to support apartment threading in single-threaded apartments because COM provides synchronization on a per-call basis and the Windows GUI APIs are not guaranteed to be thread safe.

Windows XP and Server 2003 didn’t enforce this for the classic Windows Open and Save Dialogs, so it only appeared when the software below got run on Windows 7 in a way too late time frame (but the market share of XP is still high).

The reason is that when using Delphi, the TOpenDialog and TSaveDialog will use the classic Open and Save Dialogs on Windows < Vista and fall-forward to the new Common Item Dialogs handled by TFileOpenDialog and TFileSaveDialog (both will not fall backward).

When you have your COM initialisation done wrong, your application appears to hang. Amidst the plethora of threads started by the COM subsystem, these two dead-lock:

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »

The forks of SynEdit (in case I need it in Unicode)

Posted by jpluimers on 2016/01/19

Just in case I need SynEdit in Unicode:

Old SVN versions are at

Newer Github repositories are at

The finaly one has a Demos folder and links to the original ANSI version. It seems the only version for which SynGen works in Unicode Delphi versions.

–jeroen

via Missed link? Anyone know what happens there? :) Once again: 1.SynEdit?  ….

Posted in Delphi, Delphi 10 Seattle, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

From my paper archives: early QuickReport materials and BDE network installation tips

Posted by jpluimers on 2016/01/01

[WayBack] While cleaning up my “attic”, I came across some old QuickReport 1.0 documents and BDE installation tips so I scanned them.

I think the first document is by this Lars Søndergaard.

The last is by Dave Robinson, then working at Amber Computer Systems Inc, but I could not find on-line activity of him If you know him, please let me know his on-line contact info.

–jeroen

Posted in Delphi, Delphi 1, Development, History, Software Development | 2 Comments »

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 »

Delphi 10 Seattle version numbers

Posted by jpluimers on 2015/12/22

The ones I know, hopefully they are the only ones as search results are inconclusive:

–jeroen

XE9

Posted in Delphi, Delphi 10 Seattle, Development, Software Development | 1 Comment »

Some links on DUnit test cases and test suites, XML and XSD

Posted by jpluimers on 2015/12/17

DUnit registration can mix TestSuites and TestCases.

Some links:

–jeroen

 

 

 

 

Posted in Agile, Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development, Unit Testing | Leave a Comment »

delphi – RAD Studio 2009 Persistent Selection Issue: Bug or Feature? – Stack Overflow

Posted by jpluimers on 2015/12/15

Bug, also in Delphi 2007:

Just hit Insert twice (which changes the text entry mode between Insert and Overwrite and then back) and your text selection will be back to working normally.

Source: delphi – RAD Studio 2009 Persistent Selection Issue: Bug or Feature? – Stack Overflow

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

The coding love – When I read and refactor code of another developer

Posted by jpluimers on 2015/12/09

Thanks Stefan Glienke for this picture:

When I read and refactor code of another developer

When I read and refactor code of another developer

–jeroen

via: The coding love – When I read and refactor code of another developer.

Posted in .NET, About, Delphi, Development, Software Development | 1 Comment »

DUnit with a twist: Delphi: GUI-testing. Table of contents

Posted by jpluimers on 2015/12/08

Interesting reads despite the level of English:

GUI-testing. Table of contents

GUI-testing 1. About tests and specially fitted “checkpoints”
GUI-testing 2. Thinking of testing
GUI-testing 3. Thinking of testing №2
GUI-testing 4. Thinking of testing №3
GUI-testing 5. Thinking of testing №4
GUI-testing 6. Thinking of testing №5
GUI-testing 7. Briefly. About GUI-testing “in the spoken style”
GUI-testing 8. About GUI-testing “in spoken style”. The follow-up
GUI-testing 9. GUI-testing “in spoken style”. Introducing of the alphanumeric characters to the current control
GUI-testing 10. GUI-testing “in the spoken style”. Note about “how this thing is organized”
GUI-testing 11. GUI-testing “in the spoken style”. How this thing is organised №2
GUI-testing 12. GUI-testing “in the spoken style”. Back to the basics
GUI-testing 13. GUI-testing “in spoken style”. Back to the basics. Example of pressing the button of the form through the script
GUI-testing 14. GUI-testing “in the Russian style”. Adding DUnit to our “scripts”
–jeroen

via: 18-ть лет с Delphi: GUI-testing. Table of contents

Posted in Delphi, Development, Software Development | Leave a Comment »

The curse of nested DataSet fields in ClientDataSets: naming conventions

Posted by jpluimers on 2015/12/03

Nested DataSet fields assume identical naming of fields and parameters as Richard Stevens did comment in   So I’m in total n00b mode here. I’m trying to set up a master/detail….

Of course the documentation for that is easy to find. Not.

Even this article by Cary Jensen doesn’t reveal the issue: Nesting DataSets in ClientDataSets.

So thanks Richard for clearing that up!

–jeroen

Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »