Solved

mfc: CDHtmlDialog question

Posted on 2011-02-14
8
798 Views
Last Modified: 2012-05-11
Dear expert,

I am working on an application that needs a functionality to compare two files content. I found code for an application that does it. That application renders the results in html format. But I need to be able to select random lines and process the content. So I was going to just redo the application to render the results in e.g. multiline Edit control. But I bumped into CDHtmlDialog. I have never used it, but it seems that it could allow me to render my html in it. Could you please tell me if that dialog will allow me to select lines and get the selected content etc.? Maybe you could give me even an exampe?
Thanks.
0
Comment
Question by:tantormedia
  • 4
  • 4
8 Comments
 
LVL 33

Expert Comment

by:sarabande
ID: 34895524
what is the connection between files to compare and html dialog? are the files html code? are the lines to compare lines of the (text) files or visible text of a web page or web control?

Sara
0
 

Author Comment

by:tantormedia
ID: 34896479
I wrote about comparing texts only to give the general context of my work. The files are not html code, but the result is rendered as html in a browser. Instead, it should be rendered somehow in a dialog box so that the user could select lines and accept or reject changes of random lines.
I guess I would have to use just two listboxes...
0
 
LVL 33

Accepted Solution

by:
sarabande earned 500 total points
ID: 34896654
there is not much to 'render' when displaying lines in a listbox. read the lines from textfile by calling

     getline(file, strline);

where file is an opened std::ifstream and strline is a std::string. then you can add the strings to a listbox by

   m_listbox1.AddString(strline.c_str());

you also could think of a list control what would allow to add line numbers or a checkbox for each row.

Sara
0
 

Author Comment

by:tantormedia
ID: 34897319
Sara, I was thinking about CListCtrl, but not sure if it could handle very long lines. With CListBox, I know how to add horizontal scroll.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:tantormedia
ID: 34897334
Also, I need to have lines of either text or backrgound of different colors based of kind of change detected, if any, e.g. Green for added, Red for deleted, Yellow for modified.
0
 
LVL 33

Expert Comment

by:sarabande
ID: 34898101
you can resize the list control column widths by mouse  and have a horizontal scroll as well. however that is only practical if you not really need to see all text in most cases.

another thought is to have two static text controls with horizontal scrollbar  and no verical scrollbar on them. then add a separate vertical scrollbar as an own control where you would do the vertical scrolling for both textboxes yourself.

Sara
0
 

Author Comment

by:tantormedia
ID: 34898132
Two static text controls will not let me select randorm records... Or add line numbers, as you said...
0
 
LVL 33

Expert Comment

by:sarabande
ID: 34898855
i once made a own tree control and base class was owner-draw CListBox if i remember correctly. i mean to remember that i added ON_WM_VSCROLL to message map of the control which would need an override of the

   afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );

you might try whether you get this message handler being called.

Sara
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SendMessage fails while PostMessage works 2 107
Need some help with listview limit text 20 98
What does std::atomic give me? 7 113
White board coding practice 3 79
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now