|
-
May 1st, 2007, 11:23 AM
#1
Thread Starter
Junior Member
Browser Windows
I am having difficulty in sending code to a specific browser window. The user will have several browser windows opened. One for example will be labeled as "HOME" and the other as "EARLY". I need to be able to identify the browser window names and than direct a URL address. I can write the URL address but not to the correct browser. Seems my code is writing to the last active window. A sample of my code is shown below:
vb Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
'Magellan DDE application information
Private Const DDEApplication = "Magellan"
Private Const DDETopic1 = "LocalVariable"
Private Const DDEItem1 = "EARLY"
Private Sub Form_Load()
Dim lActiveHwnd As Long, lMinimized As Long, lForeGround As Long, iCounter As Integer, lhwnd As Long
Dim lpclass As String * 256, lnkTopic As String, TermCode As String, ConvertedCode As String
Dim nlength As Integer, vk As Integer, scan As Integer, oemchar As String, dl As Long, nCheckBox As Integer
On Error GoTo errMe
lActiveHwnd = GetDesktopWindow 'first gets the desktop handle
lActiveHwnd = GetWindow(lActiveHwnd, GW_CHILD) 'look for the first child
Do Until lActiveHwnd = 0
'' now get the window text and match against the Const AppName. If a match is found then exit do. If not the do will exit.
lpclass = Space(256)
lhwnd = GetWindowText(lActiveHwnd, lpclass, 255)
If Trim(Left(lpclass, Len(SendKeyAppName))) = SendKeyAppName Then
Exit Do
End If
lActiveHwnd = GetWindow(lActiveHwnd, GW_HWNDNEXT)
Loop
' 'If a window is found
If lActiveHwnd <> 0 Then
'Get the @ACCOUNT information from Magellan
txtacct.LinkMode = vbLinkNone
txtacct.LinkTopic = DDEApplication & "|" & DDETopic1
txtacct.LinkItem = DDEItem1
txtacct.LinkMode = vbLinkManual
txtacct.LinkRequest
Dim strURL As String
strURL = "https://uat.earlyresolution.net/EarlyResolution/jsp/Main.jsp?SESS_NBR_MRTG=" & txtacct.Text & "&SESS_CURR_EVENT=0&SESS_CURR_SCR_ID=13456&SESS_CURR_SCR_ID_IMMUTABLE=13456"
ShellExecute Me.hwnd, "Open", strURL, vbNullString, "C:\", SW_SHOWNORMAL
End
Else
MsgBox "No window named that starts with" & SendKeyAppName
End
End If
errMe:
MsgBox "The Following error has occurred, Please advise system administrator" & Err.Description, vbInformation, "ACCTLKUP"
End
End Sub
Last edited by Hack; May 1st, 2007 at 11:32 AM.
Reason: Added VB Highlight Tags
-
May 1st, 2007, 11:45 AM
#2
Re: Browser Windows
Dont use "End" in your code it bad to abruptle terminate the app without unloading its objects first.
To send information to a browser window you may have allot more sucess using a webbrowser control or using automation of IE.
See this one thread on the control:
http://www.vbforums.com/showthread.php?t=330341
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 12:20 PM
#3
Thread Starter
Junior Member
Re: Browser Windows
I never used Microsoft Internet Controls....can you point me in the right direction?
-
May 1st, 2007, 12:23 PM
#4
Re: Browser Windows
MIC is a different control then the browser control. Do you need to be using a browser window natively or can you host a browser control on a form? Not sure what your needs are but can you tell me more of what you are trying to do?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 01:23 PM
#5
Thread Starter
Junior Member
Re: Browser Windows
What I need to do is send a URL string:
Dim strURL As String
strURL = "https://uat.earlyresolution.net/EarlyResolution/jsp/Main.jsp?SESS_NBR_MRTG=" & txtacct.Text & "&SESS_CURR_EVENT=0&SESS_CURR_SCR_ID=13456&SESS_CURR_SCR_ID_IMMUTABLE=13456"
ShellExecute Me.hwnd, "Open", strURL, vbNullString, "C:\", SW_SHOWNORMAL
The URL string needs to be sent to a browser window running on the desktop titled as ENTER LOAN NUMBER. My problem is if there are more than 1 browser up and running my string is sent to other browser windows.
-
May 1st, 2007, 02:03 PM
#6
Re: Browser Windows
If you use your app to launch the IE window via automation then you will have no issues identifying the window.
Then sending or navigating urls and submists are easier too.
Code:
Private Sub Command1_Click()
Dim oIE As Object
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate2 "http://www.vbforums.com"
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 02:18 PM
#7
Thread Starter
Junior Member
Re: Browser Windows
Can't do...the Browser window has to be up on the desktop running. My code can not launch the application as the application requires manual log in data from the user for secrity reasons. Once the user logs into the browser application I can than send data to the browser application labeled ENTER LOAN NUMBER..
-
May 1st, 2007, 02:24 PM
#8
Re: Browser Windows
But didnt you say there are multiple windows with "ENTER LOAN NUMER"?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 02:43 PM
#9
Thread Starter
Junior Member
Re: Browser Windows
No there is only 1 browser window reflecting a title "Enter Loan Number" on the desktop. What happens is I open up a second browser window lets say ESPN and another Browser window lets say the Weather Channel. My code will try to write to ESPN or the Weather Channel which will fail. I need my code to look for the browser window titled as "Enter Loan Number" and send the URL to that specific browser window only. Sorry if I was unclear.
-
May 1st, 2007, 03:06 PM
#10
Re: Browser Windows
Ok then we can use the FindWindow API to get the handle of that window but its really hard to do much with it without automation of some kind.
We may be able to use GetObject but Im working on the syntax right now.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 03:14 PM
#11
Re: Browser Windows
Hey PG, I got this far but still not returning the Object. I changed the return as I was getting a typemismatch error.
Im getting the handle ok but the sendmessage part is whats throwing up. 
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As Any) As Object
Private Const WM_GETOBJECT As Long = &H3D
Private Sub Command1_Click()
Dim oIE As Object
Dim lHwnd As Long
lHwnd = FindWindow("IEFrame", "Browser Windows - VBForums - Windows Internet Explorer")
Set oIE = SendMessage(lHwnd, WM_GETOBJECT, 0&, 0&)
oIE.Navigate2 "http://www.vbforums.com"
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 03:23 PM
#12
Re: Browser Windows
As far as I can tell from the documentation, you need to use AccessibleObjectFromWindow() to retrieve a pointer to a COM automation object from a window handle.
Code:
' Declarations
Declare Function FindWindow Lib "user32" ( _
ByVal lpClassName As Long, _
ByVal lpCaption As Long _
) As Long
Declare Sub AccessibleObjectFromWindow Lib "oleacc" ( _
ByVal hWnd As Long, _
ByVal dwId As Long, _
ByVal riid As Long, _
ByRef ppvObject As Any _
)
Const OBJID_NATIVEOM = -16
Const IID_IDispatch = "{00020400-0000-0000-C000-000000000046}"
' Usage
Dim hWndIE As Long: hWndIE = FindWindow("IEFrame", 0)
Dim ie As Object
AccessibleObjectFromWindow(hWndIE, OBJID_NATIVEOM, StrPtr(IID_IDispatch), ie)
This is completely untested, and will probably crash VB. But it's a start.
-
May 1st, 2007, 03:41 PM
#13
Re: Browser Windows
Bah, that doesnt work. It just gets the pointer to the object, not attaches the object to it. 
This looks promissing but its C++
http://msdn2.microsoft.com/en-us/library/ms695733.aspx
Most of those functions are not available in VB without converting them to VB and then if they will be supported
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2007, 06:25 AM
#14
Thread Starter
Junior Member
Re: Browser Windows
I need a solution in VB. So it seems what I want to achieve in VB is not obtainable?
-
May 2nd, 2007, 12:29 PM
#15
Thread Starter
Junior Member
-
May 2nd, 2007, 12:31 PM
#16
Re: Browser Windows
No, it probably is acheivable but Im not experienced with C++ to convert the functions. Or even if they are the ones you need but thereshould be something out there for it.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2007, 12:36 PM
#17
Thread Starter
Junior Member
Re: Browser Windows
It just seems that using VB one should be able to search the browser windows that are opened on the desktop and locate the only browser titled as "Enter Loan Number" we should thanbe able to set focus on that browser ansd send the URL string to that browser.
-
May 2nd, 2007, 12:40 PM
#18
Re: Browser Windows
Yes, the first part is easy and done. but the second part is why we cant use the first part. In trying to send the info to the window after we have the handle is that you can not control where its being sent to in the window. So it will go to the wrong location.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2007, 12:50 PM
#19
Thread Starter
Junior Member
Re: Browser Windows
The strange part is if the last browser window open is reflecting "Enter Loan Number" the code works everytime. As soon as an additional browser window is opened the code attempts to write to the newest browser window, which results in failure. If you close out the newest browser window the code works again. I can have 20 browser windows open, as long as the last one, the 20th in this case is open my code works. I can delete any browser window except the 20th and the code still works fine. Failure will only occur in my code if a new browser is opened, the 21st browser window in this example than the code fails again.
-
May 2nd, 2007, 01:20 PM
#20
Re: Browser Windows
Well we are getting the handle of the window with no problems so you could try to activate each browser window as needed to send information to it.
Code:
Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 9th, 2007, 09:47 AM
#21
Thread Starter
Junior Member
Re: Browser Windows
Sorry for not getting back sooner. The number of browser windows varies. I really want to activate or set focus on the window titled as "Enter Loan Number" and send the strURL to that browser.
-
May 9th, 2007, 09:52 AM
#22
Re: Browser Windows
Here is some code that could help you get a reference to the DOM object from a window handle.
http://www.mvps.org/emorcillo/en/code/vb6/iedom.shtml
-
May 9th, 2007, 10:08 AM
#23
Thread Starter
Junior Member
Re: Browser Windows
I get the handle to the browser window. Where my code fails is sending the URL to the browser window title showing as "Enter Loan Number" unless this is the last browser window my code fails as the strURL is ALWAYS sent to the last browser window. I need to direct the strURL to the browser window title showing as "Enter Loan Number". I think part of my issue is I should not be using ShellExecute Me.hwnd command....what other choices do I have?
Dim strURL As String
strURL = "https://uat.earlyresolution.net/EarlyResolution/jsp/Main.jsp?SESS_NBR_MRTG=" & txtacct.Text & "&SESS_CURR_EVENT=0&SESS_CURR_SCR_ID=13456&SESS_CURR_SCR_ID_IMMUTABLE=13456"
ShellExecute Me.hwnd, "Open", strURL, vbNullString, "C:\", SW_SHOWNORMAL
-
May 9th, 2007, 10:28 AM
#24
Re: Browser Windows
Did you even try looking at the link penagate posted? You are still saying the same thing.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 9th, 2007, 10:34 AM
#25
Thread Starter
Junior Member
Re: Browser Windows
Yes I did look at the link but I don't see how the link assists me further.
-
May 9th, 2007, 10:39 AM
#26
Re: Browser Windows
It helps you get the IHTMLDocument2 interface from a HWND for automation purposes.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 9th, 2007, 12:34 PM
#27
Thread Starter
Junior Member
Re: Browser Windows
Thanks for the input but I'm now lost......Again thank you.
-
May 9th, 2007, 01:32 PM
#28
Thread Starter
Junior Member
Re: Browser Windows
Lets try again, I know the handle and the DOM but what would be the code to write the url to the specific browser window titled "Enter Loan Number". I just cant figure how to send this:
Dim strURL As String
strURL = "https://uat.earlyresolution.net/EarlyResolution/jsp/Main.jsp?SESS_NBR_MRTG=" & txtacct.Text & "&SESS_CURR_EVENT=0&SESS_CURR_SCR_ID=13456&SESS_CURR_SCR_ID_IMMUTABLE=13456"
ShellExecute Me.hwnd, "Open", strURL, vbNullString, "C:\", SW_SHOWNORMAL
I need to know how to finish off the code.
-
May 10th, 2007, 07:39 AM
#29
Thread Starter
Junior Member
Re: Browser Windows
Just as a FYI in case somone experiences a issue similar to mine. I was finally able to locate the specific browser and send the strURL to that browser. Attached is my code.
Option Explicit
Private Sub cmdTest_Click()
Dim eWBShellWindow As New SHDocVw.ShellWindows
Dim eWB As SHDocVw.WebBrowser
Dim blnFoundIt As Boolean
Dim strURL As String
blnFoundIt = False
For Each eWB In eWBShellWindow
If UCase(eWB.LocationName) = "ENTER LOAN NUMBER" Then
blnFoundIt = True
Exit For
End If
Next
If blnFoundIt Then
strURL = "https://uat.earlyresolution.net/EarlyResolution/jsp/Main.jsp?SESS_NBR_MRTG=" & txtacct.Text & "&SESS_CURR_EVENT=0&SESS_CURR_SCR_ID=13456&SESS_CURR_SCR_ID_IMMUTABLE=13456"
eWB.Navigate strURL
Else
MsgBox "Could not find Early Resolution's Enter Loan Number page!!!"
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
CloseApp
End Sub
Private Sub CloseApp()
Set frmMain = Nothing
Unload Me
End Sub
The link http://www.mvps.org/emorcillo/en/code/vb6/iedom.shtml provided in a response to my inquiry previously was of no use. Pursing to get the IHTMLDocument2 interface from a HWND for automation purposes serve no purpose. The trick was:
Dim eWBShellWindow As New SHDocVw.ShellWindows
Dim eWB As SHDocVw.WebBrowser
Dim blnFoundIt As Boolean
Dim strURL As String
-
May 10th, 2007, 12:53 PM
#30
Re: Browser Windows
If you consider this resolved, you could help us out by pulling down the Thread Tools menu and click the Mark Thread Resolved menu item. That will let everyone know that you have your answer.
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|