Solved

how to externally trigger browser event?

Posted on 2000-03-23
3
134 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

770 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