Webbrowser, control, focus, detailed focus (1 Viewer)

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
Hi,

Can anyone tell me how to get the title of a file highlighted inside the web browser control

I can only do this:

trash = Screen.ActiveControl.Name (no further property available???)

I display trash as a label and it shows only the name of the

"Webbrowser669" control


I want to see the file inside the webbrowser that has the focus and is:

c:\directory1\1.10.jpg

All this to pump the name of a image into a hypertext field for a realestate catalog.
I believe the answer to this will be universally valuble for archieving image links in a database.

Thanks
 
Last edited:

the_net_2.0

Banned
Local time
Today, 04:21
Joined
Sep 6, 2010
Messages
812
are you familiar with the document object model?

if you want to use a web browser control's properties and methods, they are identical to an online DOM format. In addition, most, if not all of the syntax is identical.

for a link on a webpage, which is basically what you're looking at inside of a control like this, you would have to do something like you find here: http://www.access-programmers.co.uk/forums/showthread.php?t=176968
 

Banana

split with a cherry atop.
Local time
Today, 02:21
Joined
Sep 1, 2005
Messages
6,318
I should note that I wouldn't use Screen.ActiveControl - it only returns a generic control interface and there may be surprises (e.g. it may not be the object in the focus due to some other events). Instead, use explicit reference to the web browser control. It look like it's named "Webbrowser669", in which case, you'd use:

Code:
Me.Webbrowser669.<member name>

I can't remember and am not running 2010 to verify but if there's something like "Document" or "InnerHTML" or something like that, you can then apply the suggestion that the_net_2.0 gave you.
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
I think what you mean is to skip the control object/screen route and treat the file on my hard drive just like a URL to a outside web page. Then use the more advanced DOM commands to suck the information out just like the webbrowser is showing a web page??

Will research DOM and comment later.

Thanks.
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
Ok I got yah. open the hard drive in IE and look at the HTML code for clues to element name.

However the hard drive directory doesn't have an HTML code associatied with it so I don't know what to call the hook for the file name.

Additionally, if I use the webbrowser control the syntax of th access to the data is not so straight forward. (I have to figure it out without an example to go by)

Got any idea as how to make best headway?
 

the_net_2.0

Banned
Local time
Today, 04:21
Joined
Sep 6, 2010
Messages
812
I'm confused as hell here. HTML is NOT associated with a local hard drive. It's the language of the internet.

what exactly are you doing? you want to look at file through a web browser control, you say? umm...just based on the name, I doubt you can do that. why would they even provide that functionality?
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
Got a good reason,

I take pictures of realestate and put them in a directory.
I need to scroll thru the pictures and assign each image to an appropreate field in my database as proof that work needs to be done in that area ie., foundation, roofing. (later in a cool report)

All of the files have meaningless numeric names (As you have seen on your digital camera) and each image needs to be selected and then on an event pushed into the field for the table .

So I was using the webbrowser control to browse the images but after selecting the image I need to know the name of the path and image selected. All I have been able to get so far is the control name or the path from the control source.

So the DOM structure was suggested and it uses HTML codes so I tryied using IE instead of the webbrowser control to get to the file name of the image displayed and selected in the window of the control or, IE.
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
Basically, If user scrolls and selects an image I want to know which one got selected.

It's that simple.

Thanks for your input I do appreciate it.
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
I'm confused as hell here. HTML is NOT associated with a local hard drive. It's the language of the internet.

what exactly are you doing? you want to look at file through a web browser control, you say? umm...just based on the name, I doubt you can do that. why would they even provide that functionality?

Got a good reason,

I take pictures of realestate and put them in a directory.
I need to scroll thru the pictures and assign each image to an appropreate field in my database as proof that work needs to be done in that area ie., foundation, roofing. (later in a cool report)

All of the files have meaningless numeric names (As you have seen on your digital camera) and each image needs to be selected and then on an event pushed into the field for the table .

So I was using the webbrowser control to browse the images but after selecting the image I need to know the name of the path and image selected. All I have been able to get so far is the control name or the path from the control source.

So the DOM structure was suggested and it uses HTML codes so I tryied using IE instead of the webbrowser control to get to the file name of the image displayed and selected in the window of the control or, IE.
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
I'm confused as hell here. HTML is NOT associated with a local hard drive. It's the language of the internet.

what exactly are you doing? you want to look at file through a web browser control, you say? umm...just based on the name, I doubt you can do that. why would they even provide that functionality?

----------------------------------------------------------
Basically, If user scrolls and selects an image I want to know which one got selected.

It's that simple.

Thanks for your input I do appreciate it.

The protocal for this from the MicroSoft developers site is extremely confusing. I am sure there is an easy way to get the child focus inside the parent??
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
HA HA I GOT IT HOT DAMN.

There are TWO webbrowser controls. One is part of the controls menu and is not an active X. The other with more functionallity is listed under Microsoft WebBrowser under more and is an Active X.

Bloody hell its taken me a week to find out there are two "WebBrowser controls"

Glory Glory

Tah
 

Cosmo

Registered User.
Local time
Today, 05:21
Joined
Feb 3, 2011
Messages
19
Can anyone tell me why the Microsoft webbrowser ActiveX is not allowing these methods yet I get error 438 object doesn't support property or, method???

Text672 = Me.WebBrowser0.Document.activeelement.innertext

They were taken off code someone else is using in VBA in access.
I am using Access 2010 and latest greatest active X
 

Banana

split with a cherry atop.
Local time
Today, 02:21
Joined
Sep 1, 2005
Messages
6,318
I'm unclear why you want to use ActiveX instead of built-in? ActiveX is probably going to cause more grief in deployment. The built-in webbrowser has a document object, and using that code you posted works for the built-in control.
 

Users who are viewing this thread

Top Bottom