|
Mathefreak wrote: 2. load the page into a browser control to build the content, copy the content text (into clipboard) and extract information
Try using IWebBrowser2, IHTMLDocument, IHTMLElement , and related interfaces.
Regards,
Paresh.
|
|
|
|
|
Mathefreak wrote: If the sources are plain html, everything is fine.
Now I've got a website which shows the quotes dynamically (http://www.forexpf.ru/quote_show.php[^]).
But the tables are still HTML. Unless I am not understanding, isn't row #3 of the upper-left table always "NASD Comp?" Or are you saying that the first column in each table continually changes?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
By "dynamically", I assume you mean you can't rely on the order of information? If so, you could scrape tuples (eg: "NASD100=1888.08") instead of assuming the location of specific entries in the table.
Btw, I wrote this[^] in order to build this[^].
/ravi
|
|
|
|
|
The only things which changes in the resulting webpage are the quote.
My aim is to get the quote for DAX (7th row in upper left table).
Are there any example to use the IWebBrowser2 interface to get the information.
TIA M.
|
|
|
|
|
Mathefreak wrote: My aim is to get the quote for DAX (7th row in upper left table).
That's plain HTML and trivial to scrape. There's no need to use IWebBrowser2 to do that.
/ravi
|
|
|
|
|
Hi Ravi,
it's not only plain html, unfortunately. There are some java functions embedded to grab the actual quotes.
Nevertheless, after searching around the net a bit, I'm proudly present the solution, which works for me
Sample application:
- simple MFC-Dialog
- one Webbrowser control (m_WebBrowserCtrl)
- website is loaded and refreshed by button click
- by clicking on a button the content of the site (plain text, not the html source) is copied into a CString variable to parse the data.
<br />
void CWebbrowser_TestDlg::OnCopy() <br />
{<br />
IHTMLDocument2* m_pHTMLDocument2;<br />
LPDISPATCH lpDispatch;<br />
lpDispatch = m_WebBrowserCtrl.GetDocument();<br />
HRESULT hr;<br />
if (lpDispatch)<br />
{<br />
hr =<br />
lpDispatch->QueryInterface(IID_IHTMLDocument2,<br />
(LPVOID*)&m_pHTMLDocument2);<br />
lpDispatch->Release();<br />
ASSERT(SUCCEEDED(hr));<br />
}<br />
<br />
<br />
CString sText;<br />
IHTMLElement *iSource;<br />
BSTR bstrSource;<br />
<br />
m_pHTMLDocument2->get_body(&iSource);<br />
iSource->get_outerText(&bstrSource);<br />
sText = bstrSource;<br />
<br />
MessageBox(sText);<br />
<br />
}<br />
Comments are welcome.
Next step is to use the code in my application, but that seems to be easy.
Greets M.
|
|
|
|
|
How can i import .jpg or jpeg images into resources off workspace instead of .bmp
|
|
|
|
|
Right click on your project on the solution explorer and select Add Resource and click on Import button and your file(jpg),and if you want to load them of resource see Loading JPG & PNG resources using GDI+ [^]
|
|
|
|
|
I have a MFC/C++ SDI application that reads data from a file and does a bunch of processing. I'd like to add a button to my GUI that when pressed opens up MS Excel with a varying number of sheets and does something (display table, chart, etc) in each sheet. Any ideas how/where to get started? Is there an example out there that calls MS Excel and does this sort of thing so I can get some idea of how it might work.
|
|
|
|
|
HiFive wrote: ...opens up MS Excel with a varying number of sheets and does something (display table, chart, etc) in each sheet.
It sounds like you need to use Excel's COM interface. Search for "Excel Automation."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi, I'm rewriting a small utility myself in plain API code and the utility needs to know when there are any maximized Windows.
The original utility, an AutoHotKey script, simply polled all top-level windows about once every second, I'm convinced there must be a more efficient solution.
System hooks seemed like the obvious method to use but in the end the only hooks which would reliably detect a window being maximized from any previous state was a WH_CALLWNDPROC or WH_CALLWNDPROCRET hook. Currently I use a CALLWNDPROCRET hook to detect a window being maximized and then poll that window with an IsZoomed() call until it is 'un-maximized'. This feels quite far from the elegant solution I was sure I could come up with An alternative to the IsZoomed() poll would be to have the hook check on subsequent WM_SIZE messages to catch when the window is un-maximized but I'm not sure if that is actually better or worse.
Would anyone have some thoughts on the efficiency of these methods or even some other techniques altogether?
Kind regards, Eóin.
|
|
|
|
|
I am facing problem in reading data from clipboard with 16-bit settings. I able to read and save image in 32 bit settings. I want to convert 16-bit clipboard image to 24-bit or 32-bit BMP file.
Sethuraman.K
|
|
|
|
|
If you want to do the conversion yourself, the docs for the BITMAPINFOHEADER[^]
struct explains the various ways 16-bit pixel data is formatted.
You can also use GDI or GDI+ to convert the format by drawing the bitmap to a new bitmap.
It's a shame the GDI+ Bitmap::ConvertFormat() method isn't available except on Vista+.
With that, you could do the conversion in a couple lines of code
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hai,
I am Calling a Dialog from a main Dialog & I want to get the text typed in that dialog to the main dialog
Thanks In Advance
-- modified at 7:43 Tuesday 15th May, 2007
|
|
|
|
|
Maybe this code will be helpful for you
CMain* m_Main=(CMain*)GetParent();
m_Main->variables(on the another dialog)
|
|
|
|
|
Hi,
U can access the child dialog variable from main dialog.
eg:
CChildDlg cdlg;
cdlg.DoModal();
var_MainDlg=dclg.var=//var should declare in CChildDlg as public
-- modified at 7:59 Tuesday 15th May, 2007
If U Have Interest, U Can...
Sherin Iranimose
|
|
|
|
|
IS it possible in the reverse manner . . .
child to access parents variables
Proud To Be an Indian
|
|
|
|
|
Keep the text in a string variable [inside the child dialog]. Then inside the main dialog, get the string value when the child is closed. It might be smth like this;
CMySecondDlg dlg;
if (dlg.DoModal() == IDOK)
{
CString text = dlg.m_strText;
}
If your second dialog is modeless, you should get the main dialog handler (GetParent or pass it directly) and do PostMessage inside the child dialog.
--
=====
Arman
|
|
|
|
|
Use a memory mapped file.
|
|
|
|
|
What are function pointers?
i have heard about the chat *ptr.
But what is function pointer.
i read it in the vb.net article based on the delegates.
the line that article included is
"A delegate is a reference type that refers to a Shared method of a type or to an instance method of an object. The closest equivalent of a delegate in other languages is a function pointer, but whereas a function pointer can only reference Shared functions, a delegate can reference both Shared and instance methods."
|
|
|
|
|
|
I give you an example:
int mySqr(int i){ return i*i;}
int myAbs(int i){ return i < 0 ? -i : i;}
int main(int argc, char* argv[])
{
int (*pFun)(int);
int i=-5;
pFun = mySqr;
printf( "pFun=mySqr\n");
printf( "pFun(%d)=%d\n", i, pFun(i));
pFun = myAbs;
printf( "pFun=myAbs\n");
printf( "pFun(%d)=%d\n", i, pFun(i));
getchar();
return 0;
}
in the code above, pFun is a function pointer, i.e. a variable that can hold the address of a function, allowing to make calls to different functions dynamically.
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.
|
|
|
|
|
I'm working on a fatal error which make our application crash! I can not reproduce it in my environment, so I tried to get the Dr.Watson's dump log and it indicate such error:
380861d0 da742430 fidiv dword ptr [esp+0x30] ss:00c0977f=a0b900c1
FAULT ->380861d4 d95e58 fstp dword ptr [esi+0x58] ds:00c0983a=c1eed825
I have found the code corresponding to the asm instruction:
i = float (m_rect.Width()) / float(m_rect.Height());
Just two floats' division!
I'm sure denominator is not Zero! I can not understand why the fstp give such a fatal message:
Exception code: c0000090 (FLT_INVALID_OPERATION)
Who can give me advices? Thanks a lot, a lot...
|
|
|
|
|
Are you using VC7.1 or VC8 release canditate. As far as I remember, this is a bug on those IDEs.
--
=====
Arman
|
|
|
|
|
Im tryin to write a VC++ application to encrypt any file the user selects.
I have done it for a binary file. But have no idea about how to do it if its a video or picture file.
What do i do?
Jesus Loves Us Just the way we are! Invite Him into your life today!
|
|
|
|