<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Syntax Edit : CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 23 May 2026 03:45:35 +0000</pubDate>
  <lastBuildDate>Mon, 21 Jun 2010 20:46:20 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=16846</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : Smucker and oleq very thanks....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59064&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59064</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6178">canyou</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 21 June 2010 at 8:46pm<br /><br />Smucker and oleq very thanks. Your answer is best solution. But, It may&nbsp;have some bug by side effect.<DIV>STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, wBufferSize-1 );&nbsp;&nbsp;&nbsp; &lt;== It's OK.<BR>STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, _TRUNCATE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;== It's OK.</DIV><DIV><BR>&nbsp;</DIV><DIV>And this comment from MSDN : </DIV><P>If truncation behavior is needed, use <SPAN =keyword>_TRUNCATE</SPAN> or (<SPAN =eter>size</SPAN> – 1):</P><P><SPAN =code>strncpy_s(dst, 5, "a long string", _TRUNCATE);</SPAN></P><P><SPAN =code>strncpy_s(dst, 5, "a long string", 4);</P><DIV></DIV><P>&nbsp;</P><DIV></DIV>Thanks. And&nbsp;i hope to fixed SyntaxEditor's bug.</SPAN>]]>
   </description>
   <pubDate>Mon, 21 Jun 2010 20:46:20 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59064&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59064</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : Thanks, agree.   Please replace...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59049&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59049</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 21 June 2010 at 9:21am<br /><br />Thanks, agree. <br /><br />Please replace to<br />STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, wBufferSize - 1);]]>
   </description>
   <pubDate>Mon, 21 Jun 2010 09:21:14 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59049&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59049</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : Setting wBufferSize to -1 will...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59048&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59048</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3717">Smucker</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 21 June 2010 at 9:21am<br /><br />Setting wBufferSize to -1 will overrun the buffer. I think this is better, it will keep you from overrunning buffer but return as much as possible:<br><br><b>STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, _TRUNCATE);</b><br><br>]]>
   </description>
   <pubDate>Mon, 21 Jun 2010 09:21:07 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59048&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59048</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : I tested this case using by MDITextEditor...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59043&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59043</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6178">canyou</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 21 June 2010 at 3:29am<br /><br /><P>I tested this case using by MDITextEditor Application.</P><DIV>First testcase........................</DIV><DIV>1. void CMDITextEditorView::OnReadOnly() {</DIV><DIV>&nbsp;TCHAR buffer&#091;255&#093;;<BR>&nbsp;GetEditCtrl().GetWindowText( buffer, 255 );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;== This code generated event, &#091;CXTPSyntaxEditCtrl, ON_MESSAGE(WM_GETTEXT, OnGetText)&#093;</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>2. Compile and App execution</DIV><DIV>&nbsp;</DIV><DIV>3. write text at editor( more than 256 Char )</DIV><DIV>&nbsp;</DIV><DIV>4. Execute Testing Code</DIV><DIV>&nbsp;&nbsp;&nbsp;=&gt; Application Menu &gt; Edit &gt; Read Only</DIV><DIV>&nbsp;</DIV><DIV>5. This case&nbsp;application died. </DIV><DIV><SPAN style="WORD-SPACING: 0px; FONT: medium Gulim; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-TRANS: n&#111;ne; orphans: 2; widows: 2; webkit-border-horiz&#111;ntal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorati&#111;ns-in-effect: n&#111;ne; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px" ="Apple-style-span"><SPAN style="FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; webkit-border-horiz&#111;ntal-spacing: 1px; webkit-border-vertical-spacing: 1px" ="Apple-style-span">LRESULT CXTPSyntaxEditCtrl::OnGetText(WPARAM wBufferSize, LPARAM lpBuffer)<SPAN ="Apple-c&#111;nverted-space">&nbsp;{</SPAN></SPAN></SPAN></DIV><DIV><SPAN style="WORD-SPACING: 0px; FONT: medium Gulim; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-TRANS: n&#111;ne; orphans: 2; widows: 2; webkit-border-horiz&#111;ntal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorati&#111;ns-in-effect: n&#111;ne; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px" ="Apple-style-span"><SPAN style="FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; webkit-border-horiz&#111;ntal-spacing: 1px; webkit-border-vertical-spacing: 1px" ="Apple-style-span"><SPAN ="Apple-c&#111;nverted-space">...</SPAN></SPAN></SPAN></DIV><DIV><SPAN style="WORD-SPACING: 0px; FONT: medium Gulim; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-TRANS: n&#111;ne; orphans: 2; widows: 2; webkit-border-horiz&#111;ntal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorati&#111;ns-in-effect: n&#111;ne; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px" ="Apple-style-span"><SPAN style="FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; webkit-border-horiz&#111;ntal-spacing: 1px; webkit-border-vertical-spacing: 1px" ="Apple-style-span"><SPAN ="Apple-c&#111;nverted-space"><SPAN style="WORD-SPACING: 0px; FONT: medium Gulim; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-TRANS: n&#111;ne; orphans: 2; widows: 2; webkit-border-horiz&#111;ntal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorati&#111;ns-in-effect: n&#111;ne; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px" ="Apple-style-span"><SPAN style="FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; webkit-border-horiz&#111;ntal-spacing: 1px; webkit-border-vertical-spacing: 1px" ="Apple-style-span"><strong>STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, wBufferSize);</strong><SPAN ="Apple-c&#111;nverted-space"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </strong><SPAN style="WORD-SPACING: 0px; FONT: medium Gulim; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-TRANS: n&#111;ne; orphans: 2; widows: 2; webkit-border-horiz&#111;ntal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorati&#111;ns-in-effect: n&#111;ne; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px" ="Apple-style-span"><SPAN style="FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; webkit-border-horiz&#111;ntal-spacing: 1px; webkit-border-vertical-spacing: 1px" ="Apple-style-span"><strong>died this code =&gt; _RETURN_BUFFER_TOO_SMALL(_DEST, _SizeInBytes);</strong><SPAN ="Apple-c&#111;nverted-space">&nbsp;</SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV><DIV>...</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>Is this case&nbsp;&nbsp; USER FAULT or Bad Code???</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Second testcase........................</DIV><DIV>I&nbsp;changed only first step.</DIV><DIV>&nbsp;</DIV><DIV><DIV>1. void CMDITextEditorView::OnReadOnly() {</DIV><DIV>&nbsp;TCHAR buffer&#091;<strong>255</strong>&#093;;<BR>&nbsp;GetEditCtrl().GetWindowText( buffer, <strong>200</strong>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;== This code generated event, &#091;CXTPSyntaxEditCtrl, ON_MESSAGE(WM_GETTEXT, OnGetText)&#093;</DIV><DIV>}</DIV></DIV><DIV>&nbsp;</DIV><DIV>Application died like first testcase.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>So, i'm finding solution.</DIV><DIV>&#091;1&#093; LRESULT CXTPSyntaxEditCtrl::OnGetText(WPARAM wBufferSize, LPARAM lpBuffer)</DIV><DIV>{</DIV><DIV>&nbsp;if (wBufferSize == 0)<BR>&nbsp;&nbsp;return OnGetTextLen(0, 0);</DIV><DIV><strong>&nbsp;&nbsp;wBufferSize = -1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;== add this code, so..application not died. very big size buffer</strong></DIV><DIV>&nbsp;</DIV><DIV>.............</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>&#091;2&#093; LRESULT CXTPSyntaxEditCtrl::OnGetText(WPARAM wBufferSize, LPARAM lpBuffer) <DIV>{</DIV><DIV>.............</DIV><DIV><strong>//</strong>STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, wBufferSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;== Not use this code.</DIV><DIV><strong>_tcsncpy(pDest, (LPCTSTR)pTextData, wBufferSize);</strong></DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>can be solution ?</DIV></DIV>]]>
   </description>
   <pubDate>Mon, 21 Jun 2010 03:29:35 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59043&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59043</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : This function is called when i...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59041&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59041</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6178">canyou</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 21 June 2010 at 1:33am<br /><br /><DIV>This function is called when i selected some string in editor. =&gt; ON_MESSAGE(WM_GETTEXT, OnGetText), CXTPSyntaxEditCtrl::OnGetText</DIV><DIV>That may be system call. </DIV><DIV>&nbsp;</DIV><DIV>So, i think..that function&nbsp;have some unstable code.</DIV><DIV>&nbsp;</DIV><DIV>For example, wBufferSize &gt; tcslen(lpBuffer)</DIV><DIV>&nbsp;</DIV><DIV><DIV>WPARAM wBufferSize = 255;</DIV><DIV>TCHAR lpBuffer= new TCHAR&#091;200&#093;;</DIV><DIV>SendMessage( WM_GETTEXT, wBufferSize, lpBuffer);</DIV><DIV>&nbsp;</DIV></DIV><DIV>LRESULT CXTPSyntaxEditCtrl::OnGetText(WPARAM wBufferSize, LPARAM lpBuffer) {</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LPTSTR pDest = (LPTSTR)lpBuffer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, wBufferSize);&nbsp;&nbsp; // &lt;== died 'Buffer Too Small'</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>How can i exception handling about this error?</DIV><DIV>Is this user fault ? I want to handling this error.</DIV>]]>
   </description>
   <pubDate>Mon, 21 Jun 2010 01:33:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59041&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59041</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : Hi, Try to pass larger buffer...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59022&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59022</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 18 June 2010 at 6:36am<br /><br />Hi,<br />Try to pass larger buffer and larger wBufferSize.]]>
   </description>
   <pubDate>Fri, 18 Jun 2010 06:36:29 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59022&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59022</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPSyntaxEditCtrl::OnGetText(WPARAM wBuff : What is this function??  LRESULT...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59015&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59015</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6178">canyou</a><br /><strong>Subject:</strong> 16846<br /><strong>Posted:</strong> 18 June 2010 at 5:42am<br /><br />What is this function??<br /><br />LRESULT CXTPSyntaxEditCtrl::OnGetText(WPARAM wBufferSize, LPARAM lpBuffer)<br /><br /><br />In my desktop, MDITextEditor.exe died in this code.<br />If i selected some string, died App.<br />In the callstack........<br /><br />STRNCPY_S(pDest, wBufferSize, (LPCTSTR)pTextData, wBufferSize);<br /><br />#if (_MSC_VER &gt; 1310) // VS2005<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tcsncpy_s(strDestination, sizeInWords, strSource, count);<br /><br /><br />died this code =&gt; _RETURN_BUFFER_TOO_SMALL(_DEST, _SizeInBytes);<br /><br /><br />Please help me.!!! Thanks.<br />]]>
   </description>
   <pubDate>Fri, 18 Jun 2010 05:42:03 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16846&amp;PID=59015&amp;title=cxtpsyntaxeditctrlongettextwparam-wbuff#59015</guid>
  </item> 
 </channel>
</rss>