🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.mfc
Article #37

Re: HELP - CString conversion?

#37
From: Adler
Date: Fri, 26 Jan 1996 07:40
27 lines
1473 bytes
iti@Jerusalem.netvision.net.il wrote:
>
>When I try to read the text from a Edit Control (IDC_EDIT1) with the
>following code:
>
>--------------------------------------------------------------
>CString callBuf;
>int msgLen = GetDlgItemText(IDC_EDIT1, callBuf, sizeof(callBuf));
>--------------------------------------------------------------
>
>I get the following error:
>
>--------------------------------------------------------------
>error C2664: 'GetDlgItemText' : cannot convert parameter 2 from 'class >::CString ' to 'char __far *'
>--------------------------------------------------------------

try:
 #define MAXLEN 256 
 CString callBuf;
 LPTSTR p;
 int msgLen;

 p=callBuf.GetBuffer(MAXLEN);
 msgLen = GetDlgItemText(IDC_EDIT1, p, MAXLEN);
 callBuf.ReleaseBuffer();

Andreas Adler
Technical Details
Message-ID: <4ea0gm$eka@basfigw.basf-corp.com>
Path: arc1-ca.pugleaf.net!nntp.basf-corp.com!news
References: <NEWTNews.16531.822443361.Postmaster@Jerusalem.netvision.net.il>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntp.basf-corp.com!news
From: Adler <Andreas.Adler@zxa.x400.basf-ag.de>
Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.os.ms-windows.apps.compatibility.win95,comp.lang.c++
Subject: Re: HELP - CString conversion?
Date: 26 Jan 1996 07:40:06 GMT
Organization: BASF Aktiengesellschaft
Message-ID: <4ea0gm$eka@basfigw.basf-corp.com>
References: <NEWTNews.16531.822443361.Postmaster@Jerusalem.netvision.net.il>
NNTP-Posting-Host: pc-adler1.zxa.basf-ag.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
To: iti@Jerusalem.netvision.net.il