Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Difference between messagebox & sleep when using System.Windows.Forms.WebBrowser calls ActiveX

$
0
0

I'm making some simple web crawler for specific website. (that site is not mine.)

It's behavior is navigate page by using System.Windows.Forms.WebBrowser. and documentcompleted event listener 

find button that calls activex program and click that button.

after click, navigate next page, loops above.

that's all. so simple.

but problem is it doesn't work well. 


doc.InvokeScript(m_config.ValueByName(nPickConfig.DEF_NAME_CLICK_BUTTON));  // invoke javascript for find & click button 

Thread.Sleep(1000);

when this code click button, it should be run ActiveX program. but it doesn't. 

if I add code shows messagebox after click, ActiveX program runs well.

doc.InvokeScript(m_config.ValueByName(nPickConfig.DEF_NAME_CLICK_BUTTON));  // invoke javascript for find & click button 

MessageBox.Show(this, "button clicked", Properties.Resources.IDS_PGM_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);

using Thread.sleep or monitor.wait instead of MessageBox.Show doesn't work.

I don't know what's the difference between messagebox and sleep.

(comparing messagebox and sleep...... so ridiculous.)




Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>