March 30th, 2011

How do I get the title of a dialog from a dialog resource?

A customer submitted the following question:

We are developing automated tests for our application. Among other things, our application uses property sheets, which means that the name of the tab is stored as the title of the dialog template resource. Since we want our automated tests to run on all language versions of our application, we don’t want to hard-code the tab names in our automated test. I have not been able to find any information on how to programmatically extract the dialog titles from the dialog resources. Any pointers would be appreciated.

I replied with some pointers:

The customer was grateful for the pointers, then asked:

Then the only way to do this is to load the dialog resource and parse the data looking for the string I want? Is it even possible to do this in C#?

Well it depends on what your definition of “the only way” is. At the end of the day, somebody has to load the dialog resource and parse it, because after all that is what you said you want to do: “I want to get the title of the dialog from the dialog resource.” The alternative is, what, psychic powers?

There is no dialog template parsing library that comes with Win32. If you don’t want to do the parsing, then maybe you can find somebody else who will. And if you’re lucky, that other person may even have provided a C# interface.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.