English 中文(简体)
CEdit:GetLine(MFC,VC++6)
原标题:CEdit::GetLine (MFC, VC++6) returns extra characters in Windows 7

m_editText is of category CEdit (from MFC). 多年来,在WinXP(32bit)与数以百计的用户合作,但当同一可起诉的档案存放在Win7(64bit)时,一些用户正在(在斯特里特)获得超编(即延长,即停车场)的特性,附在它们在ed箱控制(m_editText)中。 我可以重复问题。 我证实,GetLine只复制了被打入ed箱的特性(至少在我的机器上)。

TCHAR atchBuffer[256] = {0};  // initialize to all nulls
int nChrCount = m_editText.GetLine(0, atchBuffer, 255);
CString strText;
if (nChrCount!=0)
    strText = CString(atchBuffer);

这在C++6“温XP”(32bit)的视觉C++中汇编成册(建造假装),MFC 5 静态链接。 所提供的任何见解都将受到高度赞赏。

最佳回答

修改你的法典如下:

if (nChrCount!=0)
    strText = CString(atchBuffer, nChrCount);

确保任何垃圾/未开销数据都不会被加到CString上,而只是控制中的果园。

问题回答

暂无回答




相关问题
Problem statically linking MFC libraries

I have a Visual Studio 6 workspace I m trying to convert to a Visual Studio 2008 solution. The output of said solution is a .dll. It has to be a .dll and it needs to statically link MFC as I can t ...

Switching to WPF. Is it time?

I m considering switching from MFC to WPF. My first concern is that there are too many users who don t have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration ...

Crash within CString

I am observing a crash within my application and the call stack shows below mfc42u!CString::AllocBeforeWrite+5 mfc42u!CString::operator=+22 No idea why this occuring. This does not occur ...

C# for UI, c++ for library

I have a numerical library coded in C++. I am going to make a UI for the library. I know some MFC. So one solution is to use MFC and make a native application. The alternative is C#. I know nothing ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

MFC List Control

In MFC, I can edit the text of items in the list control but only for the first column by setting the Edit Labels to true. Now when I click the first column item to change its text, I m able to change ...

热门标签