Re: Dialog resource with parameters.



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.

.



Relevant Pages

  • Re: English versus German
    ... world and are unable to read documents in .doc format, ... Of course it does (use less disk space). ... from .doc to .docx and they occupy less than half the disk space. ... resources are included in the file. ...
    (sci.lang)
  • Article : Resource File Generator (Resgen.exe .Net FrameWork Tools Series)
    ... ==> .resources files from text or .resx files. ... In order to convert from one type to another we must ensure that the data written in them is in the correct format. ... .Resources file is a binary file which is used by the assemblies ...
    (microsoft.public.dotnet.faqs)
  • Article : Resource File Generator (Resgen.exe .Net FrameWork Tools Series)
    ... ==> .resources files from text or .resx files. ... In order to convert from one type to another we must ensure that the data written in them is in the correct format. ... .Resources file is a binary file which is used by the assemblies ...
    (microsoft.public.dotnet.languages.vc)
  • Article : Resource File Generator (Resgen.exe .Net FrameWork Tools Series)
    ... ==> .resources files from text or .resx files. ... In order to convert from one type to another we must ensure that the data written in them is in the correct format. ... .Resources file is a binary file which is used by the assemblies ...
    (microsoft.public.dotnet.framework)
  • Article : Resource File Generator (Resgen.exe .Net FrameWork Tools Series)
    ... ==> .resources files from text or .resx files. ... In order to convert from one type to another we must ensure that the data written in them is in the correct format. ... .Resources file is a binary file which is used by the assemblies ...
    (microsoft.public.dotnet.distributed_apps)