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:
- Classic dialog templates use DLGTEMPLATE.
- Extended dialog templates use DLGTEMPLATEEX.
- Walkthrough of a classic dialog template.
- Walkthrough of an extended dialog template.
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.