Today I reused a unit I wrote a long time ago for TSAdminEx that shows Resource Dialogs from DLL’s or Executables. I wrote it for a couple of reasons:

  • Reusing existing dialogs is conventient since the user already knows it.
  • Windows takes care of translating it into the user’s language.
  • I am too lazy to recreate them 😉

The code is hardly rocket science and could probably be improved and made more sophisticated but it works for me. I decided to share it since you may find it usefull.

Here is a small usage example that shows the Reset Password dialog from Active Directory Users & Computers. This dialog is in dsadmin.dll (on Windows Vista/7 you will find it in ds.admin.dll.mui in the language subfolder eg %systemroot%\system32\en-US but you can load it using just the dll name).

It looks like this:

The code to display it in Delphi looks like this:

The Constructor takes the following parameters:

  • Parent Window Handle
  • DLL or Exe name
  • Dialog Resource Id
  • Optional: A procedure that is called before displaying the dialog where you can init the controls.

My init procedure looks like this:

ResetPassword

Have fun with it and if you improve something please let me know!

ResDialogs (2445 downloads )