473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Displaying text file into a dialog

Hello,

I am using VS C++ to make a gui that displays a text file contents from
main dialog. So I created main dialog and another dialog for text file
viewer. From the main dialog, I call text file viewer
dialog(ViewDialog) when button is pressed.
I added edit control(called IDC_EDIT1) and its control
variable(my_edit). How do I display the text file contents in this?

In ViewDialog::ViewDialog, I get the contents of the text file

FILE *f=fopen(LOG_FILE,"rb");

fseek(f,0,SEEK_END);
int ltext=ftell(f);
fseek(f,0,SEEK_SET);

text = (char *)malloc(ltext+1);
fread(text,ltext,1,f);
fclose(f);
text[ltext]='\0';
And to display, I tried all four but it doesn't seem to work.

SetWindowText(text);
::SetWindowText(GetSafeHwnd(),text);
GetDlgItem(IDC_EDIT1)->SetWindowText(text);
m_edit.SetWindowText(text);

Thanks,

Seung

Jul 23 '05 #1
1 1835
semi wrote:
I am using VS C++ to make a gui [...]


Please go to comp.os.ms-windows.programmer.win32. Here your
issues are off-topic. Another place is microsoft.public.vc.*

V
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
3
by: Gretjns | last post by:
I'm trying to figure out this script doesn't display any text in the child window and why I'm getting the null or not an object error. It's taken directly from the Javascript and DHTML cookbook...
3
by: Kidus Yared | last post by:
I am having a problem displaying Unicode characters on my Forms labels and buttons. After coding Button1.Text = unicode; where the unicode is a Unicode character or string (‘\u1234’ or...
3
by: Jan E Andersen | last post by:
Is there an option for this It woul certainly make debugging much easier JE
8
by: Bryan Glennon | last post by:
I have an aspx page. If I set the Response.ContentType = "application/voicexml+xml" then when I load browse to the page it downloads the file and opens .Net Studio to allow me to edit it. It...
3
by: sonic | last post by:
Hi, displaying information on a page as MS Word document seems to be as simple as: //OnLoad Response.ContentType = "application/msword"; Response.Write ( MyContentString ); (this assuming...
5
by: shakthi | last post by:
Hi all, Am new to MFC appilcation programming.Plese tell me how to display a file with its path that is chosen from a file dialog.Am trying to create a dialog box displaying a list of...
7
by: alwayssmiling | last post by:
Hi frends, In my application, a class supports backend processing. In this class im creating a new excel sheet and im inserting some data into this excel sheet, and im trying to save the file...
1
by: NBKMNDN | last post by:
Hi frends, In my C# application im creating a new excel sheet and im inserting some data into this excel sheet, and im trying to save the file with the help of method SAVE AS. But it doesnot...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.