Re: Dialog resource with parameters.
- From: Norman Bullen <norm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 06 Feb 2006 14:31:26 GMT
Max wrote:
In the resources of some microsoft DLLs I have seen format specifiers in dialog resources.
For example, "Windows is searching for %s. To locate the file yourself, click Browse."
What is the common technique to perform a "printf" and substitute format specifiers with their values before showing the dialog box?
If the format string is actually _in_ a dialog, i.e. the caption of a control in the dialog, you could do the following:
case WM_INITDIALOG:
...
TCHAR strBuffer[512], strFormat[256];
GetDlgItemText(hDlg, ID_CONTROL, strFormat,
sizeof strFormat*sizeof (TCHAR)
);
wsprintf(strBuffer, strFormat, strFileName);
SetDlgItemText(hDlg, ID_CONTROL, strBuffer);
The format might also be in a string table; in that case substitute LoadString() for GetDlgItemText().
Or it might be in a message resource; in that case substrate FormatMessgae() for GetDlgItemText() and wsprintf().\
Norm
--
--
To reply, change domain to an adult feline.
.
- References:
- Dialog resource with parameters.
- From: Max
- Dialog resource with parameters.
- Prev by Date: Re: Problem with ShowWindow/SW_HIDE on XP
- Next by Date: Refresh a popup menu
- Previous by thread: Dialog resource with parameters.
- Next by thread: Refresh a popup menu
- Index(es):
Relevant Pages
|