Full Version: Mouse_event Error
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
CallMeAndy
Hi guys,
not sure if this post belongs here or not but it is concerning windows API calls.

Anyway I am trying to leverage the mouse_event of user32 however I keep gettting an error message pop up.

"Visual Basic for Applications (VBA) encountered a problem while attempting to access a property or method. The problem may be one of the following: " etc
It trips when the form first loads


Here is what I have in the form module:


CODE
Option Compare Database
Option Explicit

'**Win32 API Declarations MOUSEMOVE
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10

Private Sub Form_Load()
    loadHTML ("http://www.yahoo.com")
End Sub

Public Sub loadHTML(strURL As String)
    'Dim strURL As String
    Dim objIE As Object
    Set objIE = Me.WebBrowser1.Object
    objIE.Navigate strURL
End Sub


Private Sub WebBrowser1_Updated(Code As Integer)
    WebBrowser1.SetFocus
    'Hold left down
    mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub


Your thoughts would be appreciated.

CyberCow
Can you provide a detailed descriptive of what you are attempting to do?

And, usually, API definitions are housed in a stand alone module and called from a form. At least, thast's how I do it.

hope this helps
CallMeAndy
Yes and I should have done so prior - appologies.

Its quite simple realy. I am looking to load a file system directory into the web browser control ( I have just noticed that I copied across with yahoo in the code- this is an error in terms of illustrating the problem) ordinarily it would be something like "C:\Archives\TheAuthor\research\images" now this displays the file system (windows explorer style) as it should and is working but the default view is tiles - I need it to be thumbnails.

This does not appear to be based on the context as set within windows explorer, although as I saw other aspects infact are so. For instance I removed the left task pane from that view and it was reflected in the web browser control. This does not appear to apply with the view style.

Web browser control does not appear to have a method or property to provide the desired results so I was looking to see if it could be done by programmatically simulating mouse actions.

I will look into whether or not an independent module makes a difference shortly, but I wasnt aware that there was any functional difference between putting the code in a module, although it may be convention. I stand to be corrected on this of course.

Not sure if I said or not now but I am using Windows XP and Access 2003.

Andy
CyberCow
I've never seen Internet Explorer display a file directory as thumbnails. Is that even doable? (I'm not at my desktop, so I'll check later.) Inorder for the file explorer to display thumbnails, a "thumbs.db" must exist in the directory being viewed. (See: A Wikipedia Page - Thumbnail Cache) And I don't know if Internet Explorer is capable of trigging the internal workings of File Explorer to generate that thumbs.db file if one does not already exist.

I'm wonderng if another approach might worth looking into. Perhaps checking the directory for an updated thumbs.db; if its not there or out dates, generate one, then use that thumbs.db file to somehow display in a different control other than activex control for the web browser. I'm goona dig around on my desktop when I get back home. (I'm on my iPad write now and I'm trying assist in an issue approach I've not before encountered.) For superior image management in Access, I've used and recommend DBPix.

Ther is also this activex control to assess: Advance Picture Control for Access.

More later . . .
CallMeAndy
Wow there cowboy! Not internet explorer, "web browser control" exhibits a Windows Explorer style when looking at local directories. Even if it is based on IE about which I dont know, it does display thumbnails of file system held images, exactly as per Windows Explorer. Thumbs.db already exists.

As for DBPix I cant afford it. Long term health problem and unable to work.

I will give the Advance Picture Control for Access a look as soon as possible.
Next couple of days I hope.


Either way thanks for coming back to us.

Now I need to get back to my other pressing issues: Analysing and comparing Greek and Roman Government Types fronm the Archaic period onward.

Its all such fun!!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.