Results 1 to 30 of 30

Thread: Browser Windows

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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:
    1. Option Explicit
    2.  
    3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
    4.                 ByVal hwnd As Long, _
    5.                 ByVal lpOperation As String, _
    6.                 ByVal lpFile As String, _
    7.                 ByVal lpParameters As String, _
    8.                 ByVal lpDirectory As String, _
    9.                 ByVal nShowCmd As Long) As Long
    10.  
    11. Private Const SW_SHOWNORMAL As Long = 1
    12.  
    13. 'Magellan DDE application information
    14.  
    15. Private Const DDEApplication = "Magellan"
    16.  
    17. Private Const DDETopic1 = "LocalVariable"
    18.  
    19. Private Const DDEItem1 = "EARLY"
    20.  
    21. Private Sub Form_Load()
    22.  
    23.  Dim lActiveHwnd As Long, lMinimized As Long, lForeGround As Long, iCounter As Integer, lhwnd As Long
    24. Dim lpclass As String * 256, lnkTopic As String, TermCode As String, ConvertedCode As String
    25. Dim nlength As Integer, vk As Integer, scan As Integer, oemchar As String, dl As Long, nCheckBox As Integer
    26.      
    27. On Error GoTo errMe      
    28.        
    29.           lActiveHwnd = GetDesktopWindow        'first gets the desktop handle
    30.  
    31.  
    32.             lActiveHwnd = GetWindow(lActiveHwnd, GW_CHILD)        'look for the first child
    33.  
    34.             Do Until lActiveHwnd = 0
    35.  
    36.             '' 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.
    37.             lpclass = Space(256)
    38.             lhwnd = GetWindowText(lActiveHwnd, lpclass, 255)
    39.            
    40.                 If Trim(Left(lpclass, Len(SendKeyAppName))) = SendKeyAppName Then
    41.  
    42.                     Exit Do
    43.                 End If
    44.  
    45.                 lActiveHwnd = GetWindow(lActiveHwnd, GW_HWNDNEXT)
    46.             Loop
    47.  
    48.  
    49. '            'If a window is found
    50.        
    51.             If lActiveHwnd <> 0 Then
    52.        
    53.                 'Get the @ACCOUNT information from Magellan
    54.  
    55.                
    56.                 txtacct.LinkMode = vbLinkNone
    57.                 txtacct.LinkTopic = DDEApplication & "|" & DDETopic1
    58.                 txtacct.LinkItem = DDEItem1
    59.                 txtacct.LinkMode = vbLinkManual
    60.                 txtacct.LinkRequest
    61.  
    62.  
    63.                 Dim strURL As String
    64.                 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"
    65.                 ShellExecute Me.hwnd, "Open", strURL, vbNullString, "C:\", SW_SHOWNORMAL
    66.                
    67.                 End
    68.    
    69.        
    70.  
    71.                         Else
    72.                             MsgBox "No window named that starts with" & SendKeyAppName
    73.                             End
    74.                         End If
    75.                        
    76.  
    77.        
    78. errMe:
    79.        
    80.             MsgBox "The Following error has occurred, Please advise system administrator" & Err.Description, vbInformation, "ACCTLKUP"
    81.             End
    82.          
    83.      
    84. End Sub
    Last edited by Hack; May 1st, 2007 at 11:32 AM. Reason: Added VB Highlight Tags

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Browser Windows

    I never used Microsoft Internet Controls....can you point me in the right direction?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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..

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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.

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  12. #12
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Browser Windows

    I need a solution in VB. So it seems what I want to achieve in VB is not obtainable?

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Browser Windows

    Any assistance?

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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.

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  19. #19

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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.

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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.

  22. #22
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  25. #25

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Browser Windows

    Yes I did look at the link but I don't see how the link assists me further.

  26. #26
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  27. #27

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Browser Windows

    Thanks for the input but I'm now lost......Again thank you.

  28. #28

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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.

  29. #29

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    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

  30. #30
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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
  •  



Click Here to Expand Forum to Full Width