How to extract data from webbrowser controle in visual c++ 6?
-
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**
-
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**
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
-
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
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 ....
-
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 ....
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, theOnDocumentCompleteExplorer()
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
-
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, theOnDocumentCompleteExplorer()
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
-
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!!
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
-
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
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
-
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
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
-
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
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
-
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
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 -
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, 2006method007 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
-
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
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 };
-
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 };
// 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