In my STRINGTABLE I have the following:
In my code where I use TaskDialogIndirect
I can hover over AFX_IDS_APP_TITLE
:
I understand this much ... if the resource can't be found it defaults to the executable name. At the moment that is what I am getting:
Yet, when I use the CTaskDialog
constructor I get the correct caption:
For TaskDialogIndirect
I am using:
sConfig.hInstance = AfxGetInstanceHandle();
I have also tried:
sConfig.hInstance = AfxGetResourceHandle();
Why is this happening?
When you look at the definition of HINSTANCE
in the TASKDIALOGCONFIG
it says:
Handle to the module that contains the icon resource identified by the pszMainIcon or pszFooterIcon members, and the string resources identified by the pszWindowTitle, pszMainInstruction, pszContent, pszVerificationText, pszExpandedInformation, pszExpandedControlText, pszCollapsedControlText or pszFooter members.
The hinst was when it stated pszWindowTitle! Whilst I was loading the AFX_IDS_APP_TITLE
into a CString
I was not assigning it in the structure. I needed:
sConfig.pszWindowTitle = strTitle.GetString();
And now it is fine: