|
Read point 2 here[^]
In other words, were are you stuck ? What is your problem, what did you already do ?
|
|
|
|
|
for your information...i'm very new for VS C++ programming..
the program i want to try create program like this:
http://www.mediafire.com/?ymdzm2tjmdn[^]
i want to know either i can create program like this using MFC???
|
|
|
|
|
mr bard2 wrote: for your information...i'm very new for VS C++ programming..
Then I strongly suggest to buy a good book about the MFC and start to learn from the basics. You won't achieve a lot if you don't have at least a basic understanding of the MFC. And learning through a book is usually much faster than asking help from people.
|
|
|
|
|
mr bard2 wrote: i want to do a software to read text data and display the text...
This is a fairly basic question with many samples around, take a look here[^], as a starting point.
|
|
|
|
|
Have you looked at CStdioFile and its members?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi, see here[^]
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hello Everyone,
This is my 2nd Post regarding the Text extraction from the WebPages.
In my Previous post David Crow suggested me use IHTMLDocument2 interface,
In the code project depository I found this application
Parsing HTML using MSHTML [] by Philip Patrick ..Extracts all the links in the WebPages Using HREF Tag,
Can I use the same application to extract the Text from the Table from the WebPages ?
I searched for Table tag from which I can extract the text, I did not find any information. Can anyone please tell me is it possible to use MSHTML using IHTMLDocument2 interface can I extract the Text from the <table> Tag.
Thanking you,
Naveen HS.
void CTestDlg::OnBgo()
{
UpdateData();
CWaitCursor wait;
if(m_csFilename.IsEmpty()){
AfxMessageBox(_T("Please specify the file to parse"));
return;
}
CFile f;
if (f.Open(m_csFilename, CFile::modeRead|CFile::shareDenyNone)) {
m_wndLinksList.ResetContent();
CString csWholeFile;
f.Read(csWholeFile.GetBuffer(f.GetLength()), f.GetLength());
csWholeFile.ReleaseBuffer(f.GetLength());
f.Close();
MSHTML::IHTMLDocument2Ptr pDoc;
MSHTML::IHTMLDocument3Ptr pDoc3;
MSHTML::IHTMLElementCollectionPtr pCollection;
MSHTML::IHTMLElementPtr pElement;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2, (void**)&pDoc);
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
VARIANT *param;
bstr_t bsData = (LPCTSTR)csWholeFile;
hr = SafeArrayAccessData(psa, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = (BSTR)bsData;
hr = pDoc->write(psa);
hr = pDoc->close();
SafeArrayDestroy(psa);
pDoc3 = pDoc;
pCollection = pDoc3->getElementsByTagName(L"A");
for(long i=0; i<pCollection->length; i++){
pElement = pCollection->item(i, (long)0);
if(pElement != NULL){
m_wndLinksList.AddString((LPCTSTR)bstr_t(pElement->getAttribute("href", 2)));
}
}
}
}
modified on Thursday, October 15, 2009 8:30 AM
|
|
|
|
|
|
Hello Sir,
Thank you very much for the response.
I have added this lines to the above code.
MSHTML::IHTMLDocument2 *pDoc1 = NULL;
MSHTML::IHTMLElementCollection *pColl = NULL;
pColl = pDoc1->get_all(L"table");
int y = pColl->length;
for(int x = 0; x < y ; x++)
{
}
i am getting the following Error :-
error C2664: 'MSHTML::IHTMLDocument2::get_all' : cannot convert parameter 1 from 'const wchar_t [6]' to 'MSHTML::IHTMLElementCollection **'
|
|
|
|
|
NaveenHS wrote: pColl = pDoc1->get_all(L"table");
This is wrong.
get_all will give you all elements and not all tables.
get_all takes the IHTMLElementCollection pointer as the parameter.
As a general rule, all COM calls in C++ will return an HRESULT .
Except maybe AddRef and Release .
So you will have to check the tag name in a loop to see if they are tables.
So the get_all call would look like this -
pDoc1->get_all(&pColl);
I would recommend using ATL here.
Otherwise you will have to remember to call Release for all these pointers.
So my recommended way would look like this -
CComPtr<MSHTML::IHTMLElementCollection> pColl = NULL;
pDoc1->get_all(&pColl);
You can use the IHTMLElementCollection::item[^] method to get an IDispatch pointer to each element in the collection.
This can in turn be QIed to an IHTMLElement[^] or IHTMLDOMNode[^] interface.
Check the methods of the interfaces to identify the table tags that you need.
|
|
|
|
|
Hello Sir,
Thanks a lot for the reply.
I made changes as mentioned by you, but still i am not able to extract the data from the table. can u please tell what change i have to make.
MSHTML::IHTMLDocument2Ptr pDoc;
MSHTML::IHTMLDocument3Ptr pDoc3;
MSHTML::IHTMLElementCollectionPtr pCollection;
MSHTML::IHTMLElementPtr pElement;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2, (void**)&pDoc);
pDoc3 = pDoc;
pDoc->get_all(&pCollection);
pCollection = pDoc3->getElementsByTagName(L"table");
for(long i=0; i<pCollection->length; i++){
pElement = pCollection->item(i, (long)0);
if(pElement != NULL){
m_wndLinksList.AddString((LPCTSTR)bstr_t(pElement->getAttribute("table"),10));
}
}
Error :- error C2660: 'MSHTML::IHTMLElement::getAttribute' : function does not take 1 arguments
|
|
|
|
|
The syntax for getAttribute is not correct.
Do it this way -
CComBSTR name("table");
VARIANT result;
pElement->getAttribute(name, 0, &result);
|
|
|
|
|
Hello sir,
I added the code , still getting the error.
pDoc->get_all(&pCollection);
pCollection = pDoc3->getElementsByTagName("table");
CComBSTR name("table");
VARIANT result;
for(long i=0; i<pCollection->length; i++){
pElement = pCollection->item(i, (long)0);
if(pElement != NULL){
m_wndLinksList.AddString((LPCTSTR)bstr_t(pElement->getAttribute(name, 0, &result)));
}
}
I am getting the below error :-
error C2660: 'MSHTML::IHTMLElement::getAttribute' : function does not take 3 arguments
|
|
|
|
|
I'm getting an error message with this line of code, int _int tmain (int argc,_TCHAR* ARGV[]) ,the error E2303 says "Type name expected".
Can somebody advise me, please?
|
|
|
|
|
john curtin wrote: int _int tmain (int argc,_TCHAR* ARGV[])
should read int _tmain(int argc, _TCHAR* argv[])
|
|
|
|
|
john curtin wrote: int _int tmain (int argc,_TCHAR* ARGV[])
The bold _int is an alien, remove it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: The bold _int is an alien
Where do you think it came from? Maybe CSS knows ...
|
|
|
|
|
Richard MacCutchan wrote: Maybe CSS knows
Know and CSS in the same sentence, now that's alien.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hello to everyone.
I want to read line by line an input file (leer_datos).
In the input file (leer_datos): If the first character of each line is '|', then I copy the whole line and paste it in an output file (escribir_datos).
In the input file (leer_datos): If the first character isn´t '|' then I go to the next line in the input file (leer_datos).
My code:
#include <stdio.h>;
int main(void)
{
FILE *leer_datos, *escribir_datos;
char muestra[50];
leer_datos = fopen("input_file.txt", "rt");
escribir_datos = fopen("output_file.txt", "wt");
while ( (!feof(leer_datos)) && (!ferror(leer_datos)) )
{
muestra = getc(leer_datos) ;
if (muestra == '|')
{
fgets(muestra, sizeof(muestra), leer_datos);
fputs(muestra, escribir_datos);
fputs("\n", escribir_datos);
}
}
if (fclose(leer_datos) != 0)
printf ("Hay problemas al cerrar el fichero de lectura de datos\n");
if (fclose(escribir_datos) != 0)
printf ("Hay problemas al cerrar el fichero de escritura de datos\n");
}
...but it gives some errors and I don´t sure about it works fine.
Anyone could help me, please!?.
|
|
|
|
|
muestra = getc(leer_datos) ;
if (muestra == '|')
{
fgets(muestra, sizeof(muestra), leer_datos);
fputs(muestra, escribir_datos);
fputs("\n", escribir_datos);
}
In the above code if the first character is NOT '|' you still have the remainder of the line of text to read next time round the loop. It would be better to read each line into muestra and just test the first character if (muestra[0] == '|') ...
|
|
|
|
|
programmer202 wrote: ...but it gives some errors...
Really. Are you keeping those to yourself?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I want to know the maximum client count that a server can accepts (TCP/IP or socket).
Of couse, client count depends on server's hardware and software - this is my question:
Based on general good computer hardware and Windows, what are common and "best" software (OS and others) for supporting more TCP/IP clients? what is maximum possible client count related to the software?
BTW: please only post reply related to my question.
modified on Thursday, October 15, 2009 5:23 AM
|
|
|
|
|
includeh10 wrote: BTW: please only post reply related to my question.
BTW please only post questions related to the forum!
|
|
|
|
|
F u c k you if you still make nonsense.
|
|
|
|
|
includeh10 wrote: F * * k you if you still make nonsense.
Keep this sort of language at your home. May be people over there will like it very much. But, it won't be tolerated here.
Your query is a basic networking query and has nothing to do with C/C++. And you "demand" that people should give you an exact answer? So, Richard told you that this isn't the right forum.
I've reported your message as abusive.
“Follow your bliss.” – Joseph Campbell
|
|
|
|