Solved

how to externally trigger browser event?

Posted on 2000-03-23
3
135 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

726 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