我有一个很大的问题想问...... [英] i have a big question wanna ask......
本文介绍了我有一个很大的问题想问......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在,我遇到了一个与MFC的大问题
i想在编辑框中显示一条消息,但只能显示三条消息
,现在,我想在编辑框中显示256个单词...
我该怎么办...请帮助我
这是我的代码
now, i meet a big question with MFC
i wanna show a message at edit box, but only can show three message
, now , i want to show 256 word at editbox...
how can i do ... please help me
this is my code
void Cnew_test_06_04Dlg::OnBnClickedBt()
{
CString szFilter = L"*.exe|*.*||";
CFileDialog fd(TRUE,L"*", L"*.exe", OFN_HIDEREADONLY, szFilter, this);
if(fd.DoModal() == IDOK)
{
CString szFileName = fd.GetPathName();//取得開啟檔案全名(包含路徑)
// fopen(szFileName);
CFile File;
char *buf;
buf = new char [256];
DWORD dwFileLen=0;
if (File.Open(szFileName,CFile::modeRead |CFile::typeBinary)){
File.SeekToBegin();
File.Read(buf, 256);
}
CString csOutput;
while(csOutput.Format !=NULL)
{
IDC_EDIT1.AddString(IDC_EDIT1.GetItemText(IDC_EDIT1));
buf=IDC_EDIT.GetNext();
}
//csOutput.Format(L"0x%02x 0x%02x 0x%02x", buf[0], buf[1],buf[2]);
// int buf=0
// int i=0
//GetDlgItem(IDC_EDIT1)->SetWindowText(csOutput);
delete [] buf;
}
推荐答案
您需要在资源编辑器中更改编辑框的大小。
字符串问题已解决bei Mohibur Rsahid。
you need to change the size of the edit box in the resource editor.
the string issue is solved bei Mohibur Rsahid.
<pre lang="c++">CString csOutput;
//csOutput.Format(L"0x%02x 0x%02x 0x%02x 0x%02x", buf[0], buf[1],buf[2],buf[3]);
//GetDlgItem(IDC_EDIT1)->SetWindowText(csOutput);
buffcount=File.Read(buf, 256);
for(int i=0;i<buffcount;i++)>
{
cstring temp; temp.format(L"0x%02x",buf[i]); csoutput+=temp;
}
delete [] buf;
}
这篇关于我有一个很大的问题想问......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文