如何以编程方式从 MS Access 最大化浏览器?

发布于 2024-11-05 10:35:29 字数 459 浏览 1 评论 0原文

我最大化浏览器的目的是为用户提供从 MS Access 应用程序到 Web 应用程序的连接和无缝体验。出于这个原因,我正在寻找一种解决方案,最大限度地提高通过 MS Access 应用程序控制的 Web 浏览器的相同实例。

我首先做这样的事情:

Dim IE As InternetExplorer
Set IE = New InternetExplorer
IE.Navigate2 "\\File Location\index.html"
IE.Document.all("txtSearchKey").innertext = SearchKeyValue
IE.Document.all("btnSearchForKey").Click
IE.Visible = True
Set IE = Nothing

但我想做的是确保每次运行此代码时,浏览器也最大化。

以编程方式完成此任务的最佳方法是什么?

My purpose for maximizing the browser is to provide a connected and seamless experience for the user from their MS Access application to their web application. For this reason I am looking for a solution which maximizes the same instence of the web browser being controlled via the MS Access application.

I start by doing something like this:

Dim IE As InternetExplorer
Set IE = New InternetExplorer
IE.Navigate2 "\\File Location\index.html"
IE.Document.all("txtSearchKey").innertext = SearchKeyValue
IE.Document.all("btnSearchForKey").Click
IE.Visible = True
Set IE = Nothing

But what I want to do is ensure every time this code is run, the browser is also maximized.

What is the best way to accomplish this programmatically?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鸵鸟症 2024-11-12 10:35:29

我发现以下 Windows API 调用对于设置 Web 浏览器的窗口大小特别有用。这看起来也可以与窗口句柄可用的任何其他窗口应用程序一起使用。

Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2

因此,通过将其放在上面问题中的代码末尾,我调用了此函数来将浏览器大小设置为最大化:

apiShowWindow IE.hwnd, SW_MAXIMIZE

I found the following windows API call to be particularly useful in setting the window size of the web browser. This looks like it could also be used with any other windows application for which the window handle is available to as well.

Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2

So, by putting this together at the end of the code in the question above, I made this function call to set the browser size to maximized:

apiShowWindow IE.hwnd, SW_MAXIMIZE
物价感观 2024-11-12 10:35:29

如果使用 Shell 语句调用浏览器,则可以使用 vbMaximizedFocus 窗口样式。 Windows 资源管理器示例:

Shell "explorer.exe", vbMaximizedFocus

If you call the browser using the Shell statement, you can use the vbMaximizedFocus windowstyle. Example with Windows Explorer:

Shell "explorer.exe", vbMaximizedFocus
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文