A few days ago I wrote about Using Windows Dialogs in your own programs, wouldn’t it be nice to be able to use Windows Resource Strings for the same reasons?

Loading a resource string is not difficult, let’s look at some examples:

This uses the LoadString api to load a Resource String from an Executable or Dll by it’s resource Id. An Example might call might be:

This loads the string with ResourceId 226 from dsadmin.dll(.mui):

As you can see in this example, some resource strings have identifiers such as %1 and %2 which are used in the FormatMessage Api. How can we use that from Delphi?

I wrote a very simple wrapper for it:

And here is a usage example:

The Result of this is:

Windows cannot complete the password change for John Doe because:
the password doesn’t meet complexity requirements