Can use some help w/ Internet / Object Close

  • Thread starter Thread starter Spero
  • Start date Start date
S

Spero

I am using a form to direct users of my db to a website with the code
below. I want to hide the form when they go to the internet and unhide
when they close it. How can this be done, detect when the object is
closed?

Set Newsite = CreateObject("InternetExplorer.application")
Newsite.Visible = True
Newsite.FullScreen = True
‘hide the form here
Newsite.AddressBar = False
Newsite.Navigate https://url


Unhide form here when object is closed/on fire quit

Thank You...
 
hi Spero,
I am using a form to direct users of my db to a website with the code
below. I want to hide the form when they go to the internet and unhide
when they close it. How can this be done, detect when the object is
closed?

Set Newsite = CreateObject("InternetExplorer.application")
Newsite.Visible = True
Newsite.FullScreen = True
‘hide the form here
Newsite.AddressBar = False
Newsite.Navigate https://url
I'm quite sure that you can't do it this way. The problem is the normal
code control flow.

You may try using

http://www.mvps.org/access/api/api0004.htm

Start an IE with CreateProcess() and before the WaitForSingleObject()
line use instead of CreateObject() the GetObject() method to hook into
your newly created process. Set your IE properties, hide your form and
then call the WaitForSingleObject(). Clean up aftwards.

btw, I'm not sure if "hiding" is the correct method. I would prefer a
modal dialog saying "Please close your IE to continue...".


mfG
--> stefan <--
 
Why not simply use the Application.FollowHyperlink Method

Application.FollowHyperlink "https://url"

It will open the url in the user's default web browser (very useful
considering more and more people are not using IE). When they are done, they
simply close their app and your db will regain the focus.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
On Nov 28, 11:22 am, Daniel Pineault

I honestly do not like the hyperlink look. But there has to be a way
to do a loop based on the object being set, once the object closes I
would get an error and put my coding in the error trap. Just do not
know what it is! While doing some debuging I know I can check and see
is explorer is busy or not (IE object.Busy) but the object is not
always busy!
 
Stefan thank you I like that idea of the message? Think of the form
with several buttons, one says yahoo, the other says google, so I
direct the user where they can go.
 
I tested it based on a shell, but I am lost with the comment of
"instead of CreateObject() the GetObject() method to hook into
your newly created process"
 
Stefan:

Sorry not sure if I pressed the right reply button! But the part I am
confused about is how can I get the object if it has already been
created? Where in the code do I get it?

Set Newsite = CreateObject("InternetExplorer.application")
Newsite.Visible = True
Newsite.StatusBar = False
Newsite.AddressBar = False
Newsite.Navigate "http://www.yahoo.com"

ShellWait ()
MsgBox "I am over here now!"
 
hi Spero,
I tested it based on a shell, but I am lost with the comment of
"instead of CreateObject() the GetObject() method to hook into
your newly created process"
You need to extract the necessary parts from the ShellAndWait() and use
the GetObject() function:

http://msdn.microsoft.com/en-us/library/aa164798(office.10).aspx

E.g. something like this:

Dim Newsite As Object ' InternetExplorer.Application

Dim pathname As String
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Long

' Your path to IE
pathname = """C:\Program Files (x86)\Internet Explorer\iexplore.exe"""

' Initialize the STARTUPINFO structure:
start.cb = Len(start)

' Start the shelled application:
ret& = CreateProcessA(0&, pathname, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)

' Get the IE instance
Set Newsite = GetObject(, "InternetExplorer.application")
If Not Newsite Is Nothing Then
Newsite.Visible = True
Newsite.FullScreen = True
Newsite.AddressBar = False
Newsite.Navigate "https://url"
' NOW hide your form here...
' Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Else
MsgBox "Error while getting IE instance.", vbError
End If

ret& = CloseHandle(proc.hProcess)


mfG
--> stefan <--
 
Back
Top