[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Automatically Gaining Focus

Hi,

I have some code that i got from EE. Here is it:
Dim IE
Set IE = createobject("internetexplorer.application")
     IE.navigate "http://www.google.com/search.htm"
     While IE.busy : Doevents : Wend
     RET = IE.document.documentelement.innertext

Set IE=nothing

' RET now contains the comma seperated info

It is meant to get everything out of the page 'search.htm  for example ' and display it in a label. It fulfills this job perfectly. However, there is a minor porblem with it. If you change your focus on your computer from the program to another program, e.g Internet Explorer, every minute, you will temperarily loose focus and then gain it again. It is because the above code is in a timer.


How can i stop the program from automatically gaining focus?

0
qwertykeyboard
Asked:
qwertykeyboard
1 Solution
 
___XXX_X_XXX___Commented:
Declare IE object in declarations section of form and dont set it to Nothing. Like this:

 ' In declarations section:
Dim IE

Private Sub Form_Load()
Set IE=createobject("internetexplorer.application")
End Sub

Private Sub Timer1_Timer()
Dim RET
IE.navigate "http://www.google.com/search.htm"
While IE.busy : Doevents : Wend
RET = IE.document.documentelement.innertext
End Sub

This solves this "focus" problem here.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now