Solved

how to externally trigger browser event?

Posted on 2000-03-23
3
132 Views
Last Modified: 2011-08-18
Can anyone tell me how to trigger an event in an IE 5.0 document from an external application?  I would be happy to trigger an event of my own creation.  
I am writing an IE 5.0 application that needs to communicate with another (non-IE) application.  The non-IE app needs to be able to tell the IE app to update itself.
I had thought that I would use the on-focus event, but for very complicated reasons, I am not allowed to do so, so I would like to trigger an event in the browser that I can put some code behind so that it can update itself.
Can anyone tell me how to do this?
0
Comment
Question by:Jodi_k
3 Comments
 
LVL 27

Accepted Solution

by:
Ark earned 150 total points
ID: 2652072
Hi
Assume, you know IE window handle. In this case
Private Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_F5 = &H74
Private Const KEYEVENTF_KEYUP = &H2


Private Sub Command1_Click()
' or SetFiregroundWindow IEhWnd
  SetFocus IEhWnd
  keybd_event VK_F5, 0, 0, 0
  keybd_event VK_F5, 0, KEYEVENTF_KEYUP, 0
End Sub

Cheers
0
 
LVL 6

Expert Comment

by:VBGuru
ID: 2652619
'add reference to microsoft internet controls and open the explorer by running this application
'If you want to refresh the content. click on the form, it will refresh.
Option Explicit
Dim i As InternetExplorer

Private Sub Form_Click()
i.Navigate2 "www.microsoft.com"
End Sub

Private Sub Form_Load()
Set i = New InternetExplorer
i.Navigate2 "www.microsoft.com"
i.Visible = True
End Sub
0
 

Author Comment

by:Jodi_k
ID: 2655855
Thanks very much, this was exactly what I needed!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now