Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to extract data from webbrowser controle in visual c++ 6?

How to extract data from webbrowser controle in visual c++ 6?

Scheduled Pinned Locked Moved C / C++ / MFC
c++htmlcomtutorialquestion
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    method007
    wrote on last edited by
    #1

    Hi all could any one show me how to collect the bold part data from a webbrowser controle . I want to collect those data and place them in a listview and use the color code to color the name in listview. I be happy if some one show me how this can be done. The nubmer of rows in the table are dynamic.Thanks Note: i want to extract the name and color1 and color2 data from webbrowsser controle as shown in pic [IMG]http://i5.photobucket.com/albums/y180/method007/extractData.jpg\[/IMG\] webbrowser html code:

    Name color color2 **tony** **32768** **0800** **cindy** **16711935** **FF0FF** **sarah** **16711808** **800FF**

    D 1 Reply Last reply
    0
    • M method007

      Hi all could any one show me how to collect the bold part data from a webbrowser controle . I want to collect those data and place them in a listview and use the color code to color the name in listview. I be happy if some one show me how this can be done. The nubmer of rows in the table are dynamic.Thanks Note: i want to extract the name and color1 and color2 data from webbrowsser controle as shown in pic [IMG]http://i5.photobucket.com/albums/y180/method007/extractData.jpg\[/IMG\] webbrowser html code:

      Name color color2 **tony** **32768** **0800** **cindy** **16711935** **FF0FF** **sarah** **16711808** **800FF**

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      See here. Use "TD" instead of "FONT" for pcVal.


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      M 1 Reply Last reply
      0
      • D David Crow

        See here. Use "TD" instead of "FONT" for pcVal.


        "The largest fire starts but with the smallest spark." - David Crow

        "Judge not by the eye but by the heart." - Native American Proverb

        M Offline
        M Offline
        method007
        wrote on last edited by
        #3

        david i am new to visual c++ 6 . i came from visual basic 6 and it is hard for me to use that code. could u tell me step by step how to use that code. I do not know how to implement it. i already have an mfc form with webbrowser on it that loads a specific webpage . I do not know how use your code to extract that data i want. could u tell me how to use u code ? where to place and how to feed it with my html ....

        D 1 Reply Last reply
        0
        • M method007

          david i am new to visual c++ 6 . i came from visual basic 6 and it is hard for me to use that code. could u tell me step by step how to use that code. I do not know how to implement it. i already have an mfc form with webbrowser on it that loads a specific webpage . I do not know how use your code to extract that data i want. could u tell me how to use u code ? where to place and how to feed it with my html ....

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          method007 wrote:

          could u tell me step by step how to use that code.

          You'll need this in your CDialog-derived class:

          BEGIN_EVENTSINK_MAP(CMyDialog, CDialog)
          //{{AFX_EVENTSINK_MAP(CMyDialog)
          ON_EVENT(CMyDialog, IDC_EXPLORER, 259 /* DocumentComplete */, OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT)
          //}}AFX_EVENTSINK_MAP
          END_EVENTSINK_MAP()

          Then put that other code into:

          void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL);

          After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data.


          "The largest fire starts but with the smallest spark." - David Crow

          "Judge not by the eye but by the heart." - Native American Proverb

          M 1 Reply Last reply
          0
          • D David Crow

            method007 wrote:

            could u tell me step by step how to use that code.

            You'll need this in your CDialog-derived class:

            BEGIN_EVENTSINK_MAP(CMyDialog, CDialog)
            //{{AFX_EVENTSINK_MAP(CMyDialog)
            ON_EVENT(CMyDialog, IDC_EXPLORER, 259 /* DocumentComplete */, OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT)
            //}}AFX_EVENTSINK_MAP
            END_EVENTSINK_MAP()

            Then put that other code into:

            void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL);

            After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data.


            "The largest fire starts but with the smallest spark." - David Crow

            "Judge not by the eye but by the heart." - Native American Proverb

            M Offline
            M Offline
            method007
            wrote on last edited by
            #5

            david i am lost here. i do not know what class u are talking about !! I have no idea where to place u code!!! what does this code do. I even do know how to add a listview to my project so it place the extracted data into it!!

            D 1 Reply Last reply
            0
            • M method007

              david i am lost here. i do not know what class u are talking about !! I have no idea where to place u code!!! what does this code do. I even do know how to add a listview to my project so it place the extracted data into it!!

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              method007 wrote:

              i do not know what class u are talking about !! I have no idea where to place u code!!!

              Isn't your project a dialog-based application? Put the code in your CDialog-derived class (i.e., CFindUserDlg).


              "The largest fire starts but with the smallest spark." - David Crow

              "Judge not by the eye but by the heart." - Native American Proverb

              M 1 Reply Last reply
              0
              • D David Crow

                method007 wrote:

                i do not know what class u are talking about !! I have no idea where to place u code!!!

                Isn't your project a dialog-based application? Put the code in your CDialog-derived class (i.e., CFindUserDlg).


                "The largest fire starts but with the smallest spark." - David Crow

                "Judge not by the eye but by the heart." - Native American Proverb

                M Offline
                M Offline
                method007
                wrote on last edited by
                #7

                My project is MFC as u see in the pic . I have no idea where i have to put your code!!! what part should i put your code and what your does without listview !!!! see the pic and tell me wha should i do ? i am dong this in visual c++ 6. unfortuney the way u explain is like i am 10 years experienced c++ prorammer which i am not ,i just started!! [IMG]http://i5.photobucket.com/albums/y180/method007/project.jpg\[/IMG\] could u just make a project and add a webbrowser with a html code that i gave u and show me hwo to extract that data and place it in listview.That way i do not have to explain over and over what i have in mind!! -- modified at 17:05 Tuesday 11th July, 2006

                M D 2 Replies Last reply
                0
                • M method007

                  My project is MFC as u see in the pic . I have no idea where i have to put your code!!! what part should i put your code and what your does without listview !!!! see the pic and tell me wha should i do ? i am dong this in visual c++ 6. unfortuney the way u explain is like i am 10 years experienced c++ prorammer which i am not ,i just started!! [IMG]http://i5.photobucket.com/albums/y180/method007/project.jpg\[/IMG\] could u just make a project and add a webbrowser with a html code that i gave u and show me hwo to extract that data and place it in listview.That way i do not have to explain over and over what i have in mind!! -- modified at 17:05 Tuesday 11th July, 2006

                  M Offline
                  M Offline
                  Maximilien
                  wrote on last edited by
                  #8

                  method007 wrote:

                  unfortuney the way u explain is like i am 10 years experienced c++ prorammer which i am not ,i just started!!

                  I think you need to get more experience in general C++/MFC before doing this, Adding and Extracting HTML from a web browser is not a really complex task, but it needs to have some more knowledge. have a look at those articles : http://www.codeproject.com/miscctrl/#HTML+Browser+Controls[^] it should help you a lot. M.


                  Maximilien Lincourt Your Head A Splode - Strong Bad

                  1 Reply Last reply
                  0
                  • M method007

                    My project is MFC as u see in the pic . I have no idea where i have to put your code!!! what part should i put your code and what your does without listview !!!! see the pic and tell me wha should i do ? i am dong this in visual c++ 6. unfortuney the way u explain is like i am 10 years experienced c++ prorammer which i am not ,i just started!! [IMG]http://i5.photobucket.com/albums/y180/method007/project.jpg\[/IMG\] could u just make a project and add a webbrowser with a html code that i gave u and show me hwo to extract that data and place it in listview.That way i do not have to explain over and over what i have in mind!! -- modified at 17:05 Tuesday 11th July, 2006

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    method007 wrote:

                    I have no idea where i have to put your code!!!

                    As I mentioned already, put the code in your CDialog-derived class (i.e., CFindUserDlg). If this is troubling for you, perhaps you need to start with a less ambitious project. It makes no sense to dive into a project such as this when even the basics of VC++ are new to you. Start with something simple so that you can get comfortable with the IDE. Otherwise you'll just frustrate yourself (and others).


                    "The largest fire starts but with the smallest spark." - David Crow

                    "Judge not by the eye but by the heart." - Native American Proverb

                    M 1 Reply Last reply
                    0
                    • D David Crow

                      method007 wrote:

                      I have no idea where i have to put your code!!!

                      As I mentioned already, put the code in your CDialog-derived class (i.e., CFindUserDlg). If this is troubling for you, perhaps you need to start with a less ambitious project. It makes no sense to dive into a project such as this when even the basics of VC++ are new to you. Start with something simple so that you can get comfortable with the IDE. Otherwise you'll just frustrate yourself (and others).


                      "The largest fire starts but with the smallest spark." - David Crow

                      "Judge not by the eye but by the heart." - Native American Proverb

                      M Offline
                      M Offline
                      method007
                      wrote on last edited by
                      #10

                      David i do not have CFindUserDlg !!! as u see in that pic i have FindUserDlg.h and FindUserDlg.cpp . Which one and what part ? Furthermore, i do not see any part of this code refrencing a url . How it will do the work if it does not access a url !!! You'll need this in your CDialog-derived class: BEGIN_EVENTSINK_MAP(CMyDialog, CDialog) //{{AFX_EVENTSINK_MAP(CMyDialog) ON_EVENT(CMyDialog, IDC_EXPLORER, 259 /* DocumentComplete */, OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT) //}}AFX_EVENTSINK_MAPEND_EVENTSINK_MAP() Then put that other code into: void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL); After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data. -- modified at 9:38 Wednesday 12th July, 2006

                      D 1 Reply Last reply
                      0
                      • M method007

                        David i do not have CFindUserDlg !!! as u see in that pic i have FindUserDlg.h and FindUserDlg.cpp . Which one and what part ? Furthermore, i do not see any part of this code refrencing a url . How it will do the work if it does not access a url !!! You'll need this in your CDialog-derived class: BEGIN_EVENTSINK_MAP(CMyDialog, CDialog) //{{AFX_EVENTSINK_MAP(CMyDialog) ON_EVENT(CMyDialog, IDC_EXPLORER, 259 /* DocumentComplete */, OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT) //}}AFX_EVENTSINK_MAPEND_EVENTSINK_MAP() Then put that other code into: void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL); After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data. -- modified at 9:38 Wednesday 12th July, 2006

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #11

                        method007 wrote:

                        David i do not have CFindUserDlg !!! as u see in that pic i have FindUserDlg.h and FindUserDlg.cpp .

                        The files (FindUserDlg.h and FindUserDlg.cpp) contain the class (CFindUserDlg). Open the files to verify.


                        "The largest fire starts but with the smallest spark." - David Crow

                        "Judge not by the eye but by the heart." - Native American Proverb

                        M 1 Reply Last reply
                        0
                        • D David Crow

                          method007 wrote:

                          David i do not have CFindUserDlg !!! as u see in that pic i have FindUserDlg.h and FindUserDlg.cpp .

                          The files (FindUserDlg.h and FindUserDlg.cpp) contain the class (CFindUserDlg). Open the files to verify.


                          "The largest fire starts but with the smallest spark." - David Crow

                          "Judge not by the eye but by the heart." - Native American Proverb

                          M Offline
                          M Offline
                          method007
                          wrote on last edited by
                          #12

                          ok here is the content of FindUserDlg.cpp . What should i put there and where? ///////////////////////////////////////////////////////////////////////////// // CFindUserDlg dialog class CFindUserDlg : public CDialog { // Construction public: CFindUserDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CFindUserDlg) enum { IDD = IDD_FINDUSER_DIALOG }; CString m_nick; CWebBrowser2 m_wbrow; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CFindUserDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CFindUserDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnButton1(); //}}AFX_MSG DECLARE_MESSAGE_MAP() public: int GetPosByNick(CString szNick); //CString szNick; //CString m_nick };

                          D 1 Reply Last reply
                          0
                          • M method007

                            ok here is the content of FindUserDlg.cpp . What should i put there and where? ///////////////////////////////////////////////////////////////////////////// // CFindUserDlg dialog class CFindUserDlg : public CDialog { // Construction public: CFindUserDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CFindUserDlg) enum { IDD = IDD_FINDUSER_DIALOG }; CString m_nick; CWebBrowser2 m_wbrow; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CFindUserDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CFindUserDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnButton1(); //}}AFX_MSG DECLARE_MESSAGE_MAP() public: int GetPosByNick(CString szNick); //CString szNick; //CString m_nick };

                            D Offline
                            D Offline
                            David Crow
                            wrote on last edited by
                            #13

                            // Generated message map functions
                            //{{AFX_MSG(CFindUserDlg)
                            virtual BOOL OnInitDialog();
                            afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
                            afx_msg void OnPaint();
                            afx_msg HCURSOR OnQueryDragIcon();
                            afx_msg void OnButton1();
                            afx_msg void OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL);
                            DECLARE_EVENTSINK_MAP()

                            //}}AFX_MSG
                            DECLARE_MESSAGE_MAP()


                            "The largest fire starts but with the smallest spark." - David Crow

                            "Judge not by the eye but by the heart." - Native American Proverb

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups