Solved

Internet Explorer  component - get click event?

Posted on 2002-03-14
11
151 Views
Last Modified: 2010-05-02
Hi!

Is it possible to get the "click" event from the embedded Interet Explorer component?

Falke
0
Comment
Question by:Falke
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 27

Expert Comment

by:Ark
ID: 6867600
Add reference to Microsoft HTML Object Library (MSHTML.tlb)

Dim WithEvents doc As HTMLDocument

Set doc = ie.Document

Private Sub doc_onclick()
   MsgBox "Click occure!"
End Sub
0
 

Author Comment

by:Falke
ID: 6867693
i am talking about the component .. i want to place it on a form and show html code within and if he clicks in the html code i want to get the event ...

Falke
0
 
LVL 5

Expert Comment

by:aminerd
ID: 6867925
Falke,

That's what Ark was talking about...

Andrew
0
 

Author Comment

by:Falke
ID: 6868073
no ... that's a "reference" no component ;) there are differences ... and btw its made with "withevents" ;)

no object on the form ;)

Falke
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6868949
No man!
You are using a webbrowser control, right?
Then, as Ark saids, set a reference to Microsoft HTML object library.
On declarations section of form put
dim withevents ieDoc  as htmldocument


'in documentcomplete event of webbrowser control, paste this code:
if (pdisp is webbrowser.object) then
   set ieDoc =webbrowser1.document
end if

and use the code provided by Ark:
Private Sub doc_onclick()
  MsgBox "Click occure!"
End Sub
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Falke
ID: 6871771
yes it works fine

but i have an array of this "objects" any possibilities?

Falke
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6872069
That's not in your first question.
Where do you have that "array"?, from where they come from?
0
 

Author Comment

by:Falke
ID: 6873551
maybe i should specify my questions at "first time" ;)

i thought it's the same as a "single" one.

The Array consist of the internet explorer component. Why? I want to show in each a picture some are gif's etc ...

Falke
0
 
LVL 27

Accepted Solution

by:
Ark earned 100 total points
ID: 6873612
Just reset document on every WebBroser_GotFocus event:

Dim WithEvents doc As HTMLDocument
Dim CurrentIndex As Integer

Private Sub WebBrowser1_GotFocus(Index As Integer)
   Set doc = WebBrowser1(Index).Document
   CurrentIndex = Index
End Sub

Private Sub doc_onclick()
  MsgBox "Click occure on WebBrowser No." & CurrentIndex
End Sub
0
 
LVL 27

Expert Comment

by:Ark
ID: 6873614
BTW, take a look on my code to show animated GIFs in pictureboxes: http://www.freevbcode.com/ShowCode.Asp?ID=758

Cheers
0
 

Author Comment

by:Falke
ID: 6873629
i have already take a look at this and made a gif OCX but:

if i use it ... the GDI Resources are going down and down ... and after 24 gif's (i am using 44) the resources are at zero :(

Have tried it with IPictureDisp but it doesn't improve my gdi resources.

Falke
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

895 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

18 Experts available now in Live!

Get 1:1 Help Now