Webbrowser in Form without Control !!!! Years to late.... (2 Viewers)

MsAccessNL

Member
Local time
Today, 14:27
Joined
Aug 27, 2022
Messages
217
I worked on this many years ago, my gut told me it should be possible, i was so close. Years later i solved the puzzle (bit to late..)Edit thread

We could have worked with the modern webbrowsers inside access for many years already, without using any control. I can also open Excel, Word, Outlook,Notepad and probaly every other program. Also other access databases. I want to post this and make a youtube. So please don't steal the topic (happened before..)


1760645738425.png
 
Last edited:
ny years already, without using any control. I can also open Excel, Word, Outlook,Notepad and probaly every other program
Well, sounds nice, but can you control (automate) those other applications in any meaningful way?
 
This is the chrome webbrowser, for those who don’tt like edge.
 
FYI, Daniel Pineault has posted a teaser on this topic specifically, in recent days.
 
After reading Daniel's post, I'm at a loss. What purpose does this serve?

@MsAccessNL, does your approach provide any additional benefits? When is the announced video coming up?
 
Been playing with Daniel Pineault's code…… As he states works well for some apps but not others.
Need to identify external apps without PID's

A few different options to consider maybe: -

Code:
'==========================
' Module: WindowIdentifier
' Purpose: Identify external app windows without relying on PID
'==========================

Option Compare Database
Option Explicit

' Windows API declarations
Private Declare PtrSafe Function EnumWindows Lib "user32" _
    (ByVal lpEnumFunc As LongPtr, ByVal lParam As LongPtr) As Long

Private Declare PtrSafe Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
    (ByVal hwnd As LongPtr, ByVal lpString As String, ByVal cch As Long) As Long

Private Declare PtrSafe Function GetClassName Lib "user32" Alias "GetClassNameA" _
    (ByVal hwnd As LongPtr, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Private Declare PtrSafe Function GetWindowThreadProcessId Lib "user32" _
    (ByVal hwnd As LongPtr, lpdwProcessId As Long) As Long

' Store matched windows
Public MatchedWindows As Collection

' Entry point: call this to find windows by title or class
Public Sub FindWindowsByPattern(ByVal titlePattern As String, ByVal classPattern As String)
    Set MatchedWindows = New Collection
    EnumWindows AddressOf EnumWindowsProc, ByVal 0
    Debug.Print "Found " & MatchedWindows.Count & " matching windows."
End Sub

' Callback for EnumWindows
Private Function EnumWindowsProc(ByVal hwnd As LongPtr, ByVal lParam As LongPtr) As Long
    Dim winTitle As String, winClass As String
    winTitle = GetWindowTitle(hwnd)
    winClass = GetWindowClass(hwnd)

    ' Match patterns (case-insensitive)
    If (titlePattern <> "" And InStr(1, winTitle, titlePattern, vbTextCompare) > 0) Or _
       (classPattern <> "" And InStr(1, winClass, classPattern, vbTextCompare) > 0) Then
        MatchedWindows.Add hwnd
        Debug.Print "Match: hWnd=" & hwnd & " | Title=" & winTitle & " | Class=" & winClass
    End If

    EnumWindowsProc = 1 ' Continue enumeration
End Function

' Helpers to get window title and class
Private Function GetWindowTitle(ByVal hwnd As LongPtr) As String
    Dim buffer As String * 256
    Dim length As Long
    length = GetWindowText(hwnd, buffer, Len(buffer))
    If length > 0 Then GetWindowTitle = Left$(buffer, length)
End Function

Private Function GetWindowClass(ByVal hwnd As LongPtr) As String
    Dim buffer As String * 256
    Dim length As Long
    length = GetClassName(hwnd, buffer, Len(buffer))
    If length > 0 Then GetWindowClass = Left$(buffer, length)
End Function
 

Attachments

Last edited:
I couldn't make it work, but does it give you an object model to manipulate the application or is this just for the amusement of opening an application from an Access form?
 
I couldn't make it work, but does it give you an object model to manipulate the application or is this just for the amusement of opening an application from an Access form?

The Windows Identifier Module hasn’t been formally tested yet, but it surfaces several promising strategies for working around the lack of PID exposure in certain applications.

The included EXTERNALAPPLICATIONHOST attachment does function reliably — in my case, it integrates well with Advanced IP Scanner, which I use frequently. I made a few tweaks to Daniel’s excellent base code to suit my needs:

• Launch the external app hidden, then reveal it — avoiding the brief standalone window before embedding.
• Apply a form mask, with side and bottom margins only.
• Enable resize support.
• Detect and respond to app form closure.

It’s intentionally minimal — just enough to prove the concept. You’ll want to test with a different app on load to see if it behaves similarly in your setup.

Looking forward to Daniel’s next round of enhancements…
 
Last edited:
I went to download Daniel's code this morning and found that he had deleted the page.
Using Jason's example, I tried 4 different apps and was able to load 3 of them successfully.
However, like others I'm also wondering what the practical value of doing this actually is - that is beyond the challenge of getting it to work.

In essence, opening other apps from Access can be done just with a Shell command as I do from a custom ribbon as below (or using hotkeys):
1761380564178.png


In that example, I'm using the custom ribbon to open one or more apps, many of which I use regularly in conjunction with Access development work. If anyone wants to try out my own version which is deliberately very simple and low code, it is available from

 
After reading Daniel's post, I'm at a loss. What purpose does this serve?

@MsAccessNL, does your approach provide any additional benefits? When is the announced video coming up?
Additional Benefits: Sure; we can launch apps from Access however i don't think that is what Daniel was promoting. I transitioned from my old dashboard to a HTML menu-driven frontend, which connects directly to my domain for PHP integration and backend manipulation. Because the PC is locked down to run exclusively through my Access frontend with restricted 3rd party apps available, I’ve always needed a way to launch external applications that appear seamlessly within an Access form of which i have control — both for functionality and to maintain a polished UI.

I spent a lot of time trying to replicate what Daniel achieved. I got close, but not close enough, and eventually shelved the idea. His example laid bare all the things I hadn’t considered. Knowing how difficult it was for me to get even partway there, I genuinely tip my hat to him.
 
Last edited:
@Jason Lee Hayes
Daniel's now deleted article suggested that he was opening external apps within Access (rather than from Access as in my own example app).

I assume your example is a modified version of what Daniel published and was able to use it to open a number of external apps including Excel & Notepad++ . . . BUT all of those apps opened externally and not in the Access form. So, in that sense, I've not yet seen it working

Hopefully @MsAccessNL (another Daniel I believe) will be able to demonstrate what he has done soon.

P.S. Your misspelling of Daniel Pineault's name is post #7 was amusing but I somehow doubt Daniel will think so

1761384068505.png
 
I assume your example is a modified version of what Daniel published and was able to use it to open a number of external apps including Excel & Notepad++ . . . BUT all of those apps opened externally and not in the Access form. So, in that sense, I've not yet seen it working
In his article Daniel explained that the way to execute applications in a form is different depending on the application. The code he published allowed to execute the PowerShell ISE in an Access form, but not any application with that approach.
 
Last edited:
@Jason Lee Hayes
Daniel's now deleted article suggested that he was opening external apps within Access (rather than from Access as in my own example app).

I assume your example is a modified version of what Daniel published and was able to use it to open a number of external apps including Excel & Notepad++ . . . BUT all of those apps opened externally and not in the Access form. So, in that sense, I've not yet seen it working

Hopefully @MsAccessNL (another Daniel I believe) will be able to demonstrate what he has done soon.

P.S. Your misspelling of Daniel Pineault's name is post #7 was amusing but I somehow doubt Daniel will think so

View attachment 121965

I’ve just reviewed post 7 and corrected it—this was an honest mistake, and I want to make clear that I meant no offense. We've all seen how easily things can be misinterpreted and spiral out of control, and I’d rather avoid adding to that.


I have the utmost respect for Daniel, and I’m confident he knows that. The version I uploaded is almost entirely his work—I'd estimate 99%—and all credit goes to him. I’ve made only minor tweaks to incorporate a couple of additional ideas.


My genuine reason for posting was to showcase his code in action, and more importantly, to explore fallback strategies for cases where the app being embedded into the form doesn’t expose a PID. The separate snippet was simply meant to suggest alternative identification methods that might help load such apps into the form reliably.

Here is a screen shot of an app (Advanced IP Scanner) fully functional within a MS Access Form
 

Attachments

  • Screenshot 2025-10-25 104414.png
    Screenshot 2025-10-25 104414.png
    30.6 KB · Views: 13
Another AWF member who prefers to remain anonymous was kind enough to forward Daniel's original example which I just tried.

The splash screen opened in the Access form but PowerShell itself then opened as an external app with its own taskbar icon.
This is also what I saw with various other apps using Jason's modified version

Is that what happens for others as well? If so, I fail to see the point of doing this other than as a coding challenge - nothing wrong with that of course!

Jason's screenshot clearly shows his scanner app opening in an Access form but so far I haven't experienced this outcome with any app I tested.

P.S. Glad to see Jason corrected that spelling though it will be hard to forget his original typo.
 

Users who are viewing this thread

Back
Top Bottom