2025-04-27 07:49:33 -04:00

79 lines
3.9 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>RCML</title>
<link rel="stylesheet" type="text/css" href="rcml.css">
</head>
<body>
<p><a class="logo" href="http://RCML">RCML</a>&nbsp; <span class="logodot">.</span>&nbsp;&nbsp;
<span class="logohead">Examples</span></p>
<hr>
<h1 class="section">Examples</h1>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0">
<span class="logohead"><font size="3">Currently to set a string at Init Time, e.g.
&quot;Account %s, has balance %d&quot; you need to write something like this:</font></span></p>
<font SIZE="1">
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0">&nbsp;</p>
</font>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">case
WM_INITDIALOG:</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">int
intLen=SendDlgItemMessage( ID_STATIC, WM_GETTEXTLENGTH, 0, 0 );</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">int
newLen=intLen + lstrlen(name)+10;</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">LPTSTR
pszCurrent=new TCHAR[intLen+1];<br>
SendDlgItemMessage( ID_STATIC, WM_GETTEXT, newLen, (LPARAM) pszCurent);</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">LPTSTR
pszNew=new TCHAR[newLen+1];</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">wsprintf(pszNew,
pszCurrent, name, value );</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">SendDlgItemMessage(
ID_STATIC, WM_SETTEST, 0, (LPARAM)pszNew);</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">delete
pszCurrent;</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">delete
pszNew;</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">....</font></p>
<p style="line-height: 100%; word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">break;</font></p>
<p>
<span class="logohead"><font size="3">Using RCML this is all you have to do.</font></span></p>
<p>
<span class="logohead"><font size="3">Set the Text in the static control to:&nbsp; Account
&amp;s1 has a balance of &amp;s2</font></span></p>
<p>
<span class="logohead"><font size="3">Before you call the RCMLDialogBox, do this.</font></span></p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">LPTSTR
pszStrings[2];</font></p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">TCHAR szValue[10];</font></p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">wsprintf(szValue,&quot;%d&quot;,value);</font></p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">pszStrings[0]=name;</font></p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">pszStrings[1]=szValue;</font></p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font size="3">RCMLDialogBox<u>Table</u>(
..., DlgProc, LParam, &amp; pszStrings );</font></p>
<font SIZE="1">
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0">&nbsp;</p>
</font>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0">Then all you need to
do is remove all the code from your WM_INITDIALOG</p>
</body>
</html>