Introduction

There is one problem if you have designed a dialog and you want to share it
with other people. For example: I thinking about creating a typical "Tip of the
Day" dialog able to read in a xml file. I wanted to share it with anyone who
needs it. The problem was: How can I distribute the code without messing around
with multiple resource scripts. I searched the Internet for a while and found
some information about the Windows API. It was rather easy, but it had some
nasty things you needed to look out for. Example all data had to be aligned at
DWORD boundaries. I found out is was really hard to create a dialog
without the dialog editor, so I wrote a small tool capable of parsing a resource
script and export a dialog from it. I packet those two things together and the
Resourceless Dialog Toolkit was born.

Using the code

I have spent a few hours to create documentation and a tutorial, so I'm
giving you a small class showing you how the code works.

As you see it is really easy to use the code. More information can be
found in the documentation and tutorial inside the toolkit.

If you want to know more about the underlaying technique. Look one of the
following items up in the MSDN: DLGTEMPLATE,
DLGITEMTEMPLATE, CreateDialogIndirectParam and
DialogBoxIndirectParam. If there are enough request, I will write a
article about the Windows dialog API.

The Tip of the Day dialog

The dialog I told you about earlier in this article is not ready yet. At the
end of the next week it probably will be ready.

History

The code is version 1.0. The tool is version 1.1, there were some bugs found.

Share

About the Author

I am Bert Willems a 24 year old developer living in Drachten, The Netherlands. I was born on 4 July 1985 in Drachten. My great passion is development of software, I simply love doing it. Since I was young I have been fascinated by technique and constructing things, first with Lego and later on things for the computer. I started with simple websites and some scripting of games, and then I decided I would make a career out of it and started with the development of business software. I am not sure why I love programming so much, but I know it has something to do with expressing my creativity in it.

Some bugs were found in this tool. The bugs are fixed, this article will be updated soon. The fixed toolkit can be downloaded from my website. If you have Dialog Extractor v1.1 you have the newest version.

Basically this method enables you to reuse your dialogs without having to manually copy/paste and defining id's in the rc and resource.h files in each project you want to use the dialog.

So no, it is not needed, but it can be a great timesaver and really helps in writing code fit for distribution.

If you write international programs, this method can also help in writing dialogs for different languages, as the text of the controls can be set in the language you desire, without having to maintain multiple resource files and using satellite dlls for each language.
The drawback is ofcourse that the layout of the controls must possibly be changed to allow for a translated text that doesn't fit in the control or overlaps other controls.
In combination with a layout manager, this can be solved.

Another possible use would be a general purpose static library that needs to call a dialog. Normally, you would need to not only link to the library, but also include the .rc and matching .h file -- which of course would pull in the resource whether you needed it in the current application or not. By using this, the static library is self contained, and the data for the dialog is only pulled into the application that links to the function that puts up a dialog.

If you write international programs, this method can also help in writing dialogs for different languages, as the text of the controls can be set in the language you desire, without having to maintain multiple resource files and using satellite dlls for each language.

You write that like it's a bad thing to have multiple resource files and satellite DLLs...

Just wait until you're on a large project with external localization, and you tell them that to update the dialogs they need Visual Studio licenses.

I am working on a large project which must support over 10 languages.
Currently we are using satellite dll's.
Our resource file is translated by an external translation company, which has the tools to read and modify them.

So, in that respect I agree with you, for large projects with several languages, separate resource files and satellite dll's have their uses.

However, my point was not to critisize the use of satellite dll's, but to comment on the alternative presented here, namely, a way of creating dialogs without the need for a resource file.
For example, combine this with an external text file which has a key-value pair of resource id and text string (one file for each language you want to support), together with a flexible layout manager for the controls on your dialogs, and you have a nice alternative to satellite dll's.