Help me please

This is a discussion on Help me please within the C# Programming forums, part of the General Programming Boards category; Hello, I'm from Russia. I am writing my diploma and I've got some questions. It'll be very cool if you'll ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    4

    Help me please

    Hello, I'm from Russia.
    I am writing my diploma and I've got some questions.
    It'll be very cool if you'll help me.
    So let me to explain the problem:

    I've written the web browser, now i need to make some things that i don't know how to do(

    1)I need to select the text on the web page by mouse and determinate it's place in the web document.

    2)I need to select some links on the web page and then go through them

    3) I need to save the text in .txt document in my hard disk.

    So for example I go to the web page with any book. This book have its chapters in the different pages. On the first page I see only links. So I need to go to the any of this links, then I select the text on this pages(my program determinate the position of the text ), then i go to the first page and select all the links, and my program goes through all links and collects the texts in one txt document.

    can you help me?

    Sorry for my bad English (((

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    i don't know how you write the web browser are you using any open source to develop it like webkit or something like that.....

    For mouse, and selection and all. You need to the pixel position when the mouse is started to drag, then make it selection.

    this is in general can't talk so much technical until you tell me how you wrote your browser.

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    4

  4. #4
    Registered User
    Join Date
    Dec 2009
    Posts
    4
    Download and look, please. I need in help very much

  5. #5
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Generally you should give people information of what they are downloading cause they won't do it otherwise. For example if this is a project file someone would need the appropriate program. You get my point.

    1) You should generally be able to select text, shouldn't you? I believe there is a method Copy() for textBoxes. There should be one for whateve you are using.
    2) You mean to make them a hyperlink so when you press on them they realod the appropriate page? Or select multiple ones and open multiple tabs?
    3) When you say the text, what exactly do you mean? You want to save the html page displayed in your hard disk as an .txt document?

    But, how did you make your web page? I guess Visual Studio? If yo haven't tried already google. It is the source for these answers.

  6. #6
    Registered User
    Join Date
    Dec 2009
    Posts
    4
    I am not making any web pages. I want to make program that when I select some links on the page it will get the text from selected place in one of the links and put this text to one text file.

    For example I go to This link and select links:

    роман Острая мексиканская кухня. Часть пятая
    Многоточие отсчета. часть 1, гл. 1-19
    Многоточие отсчета. Часть 1. Глава 19
    Севастопольские страдания. Глава 3
    Кампания 1941 года. Глава 74
    Кампания 1941 года. Глава 73
    Кампания 1941 года. Глава 72
    Кампания 1941 года. Глава 71
    Кампания 1941 года. Глава 70
    for example I select one link then press the button that I've made and this link goes to any stack, then another.... after what I go to the first link and select only text article from the whole this text and then press another button and the programm gets the text position in this web page.
    Then I press the download button and my program gets from all links in the stack all articles and puts them in one document in hard disk or in few documents separately.

    I've been in the google.com, but i can't find any information that can help me, but I not exclude that it is mine mistake, because I am not good in programming at all.

    Help me please.
    Thanks.

  7. #7
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    You need to use the Microsoft.mshtml wrapper included with VS2008.

    Here's a quick demo I've thrown together which should get you started.

    Web Text Grabber.zip

    This is the important code:

    Code:
    private void button1_Click(object sender, EventArgs e)
    {
        IHTMLDocument2 doc = (IHTMLDocument2)webBrowser1.Document.DomDocument;
        IHTMLSelectionObject selection = doc.selection;
    
        if (selection != null)
        {
            IHTMLTxtRange range = (IHTMLTxtRange)selection.createRange();
    
            if (range != null)
                this.outputbox.GrabbedText = range.text;
        }
    }
    As you can see, the mshtml namespace includes some sweet little objects and helpers which allows you to retreive text from a .net WebBrowser control.

    Hope this helps.

    PS. If you can't fine mshtml.dll on your own computer, then try here: http://www.mediafire.com/?jzz2ijjlm4i
    Last edited by theoobe; 12-09-2009 at 07:24 AM.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21