|
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
|
|
|
|
|
Thanks for your support
|
|
|
|
|
You are a Gold member of Code Project and you think this is a good attitude to display?
|
|
|
|
|
Well if you use the definition that Merriam Webster[^] has inexplicably placed at the first only the gold part doesn't fit.
The latest nation. Procrastination.
|
|
|
|
|
Sounds about right
|
|
|
|
|
Once again, great show of your stupidity.
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]
|
|
|
|
|
As important as server hardware and software abilities is your internet connection ability. More important than either is the nature of the protocol - how long does a connection last, how much bandwidth does a connection require, is the data transfer bursty or continuous, is a request processor intensive, ... .
The following is a bit out of date but should give some idea on max _possible_ connections.
http://tangentsoft.net/wskfaq/advanced.html#maxsockets[^]
The current best practice for optimal server programming uses IOCP to manage sparse requests from a large number of connections with a relatively few number of threads. Windows implements this in the kernel. UNIX variants used to implement this in user space, not sure if this is still true.
It could be 100's, or it could be 10-15+ thousand, regardless of the OS.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
|
includeh10 wrote: what is maximum possible client count related to the software?
I think that it would be practically unlimited (limited only by the availability of resources); but I may be wrong.
[Mod] OK, I've removed the portions that aren't directly related to your query.
“Follow your bliss.” – Joseph Campbell
modified on Thursday, October 15, 2009 5:41 AM
|
|
|
|
|