.   Examples


Examples

 

Currently to set a string at Init Time, e.g. "Account %s, has balance %d" you need to write something like this:

 

case WM_INITDIALOG:

int intLen=SendDlgItemMessage( ID_STATIC, WM_GETTEXTLENGTH, 0, 0 );

int newLen=intLen + lstrlen(name)+10;

LPTSTR pszCurrent=new TCHAR[intLen+1];
SendDlgItemMessage( ID_STATIC, WM_GETTEXT, newLen, (LPARAM) pszCurent);

LPTSTR pszNew=new TCHAR[newLen+1];

wsprintf(pszNew, pszCurrent, name, value );

SendDlgItemMessage( ID_STATIC, WM_SETTEST, 0, (LPARAM)pszNew);

delete pszCurrent;

delete pszNew;

....

break;

Using RCML this is all you have to do.

Set the Text in the static control to:  Account &s1 has a balance of &s2

Before you call the RCMLDialogBox, do this.

LPTSTR pszStrings[2];

TCHAR szValue[10];

wsprintf(szValue,"%d",value);

pszStrings[0]=name;

pszStrings[1]=szValue;

RCMLDialogBoxTable( ..., DlgProc, LParam, & pszStrings );

 

 

Then all you need to do is remove all the code from your WM_INITDIALOG