单击 webbrowser html 页面中的链接时显示 VB6 表单

Show VB6 forms when click a link in html page of webbrowser(单击 webbrowser html 页面中的链接时显示 VB6 表单)
本文介绍了单击 webbrowser html 页面中的链接时显示 VB6 表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VB6 WebBrowser,当用户单击 WebBrowser 链接的任何特定链接时,我需要打开一个 vb6 表单,例如

I am working with VB6 WebBrowser, Here i need to open a vb6 form when user click any particular link of WebBrowser's link like

在 HTML 中

<html>
<head>
<body>
<a href="--show vb6 form--">Click To show VB6 Form2</a>
</body>
</html>

我不知道该怎么做.我认为有时可以完成第三个文本文件,例如单击链接时会在文本文件中写入类似 002 的代码.

I do't have any idea how to do it. I thought sometime it can be done a third text file like when the link clicked will write a cod like 002 in a text file.

vb 格式的 Timer 会每秒检查一次文件,当计时器检测到文件包含 002 时,它会显示该格式.

And the in vb form a Timer will check once a second the file, when timer detect the file contains 002 it will show the form.

这种方法可以做到吗?还是我能做的其他更短的?

Can be do this by this method? or anything else shorter i can except?

推荐答案

选择一个更好的命名方案,例如:

Pick a better naming scheme like:

<a href="#vb-showform2">Click To show VB6 Form2</a>
<a href="#vb-waffles">Waffles</a>

然后通过 BeforeNavigate2 事件拦截链接点击,查看 url,如果它匹配 #vb-* 运行您的代码:

Then intercept link clicks via the BeforeNavigate2 event, look at the url and if it matches #vb-* run your code:

Private Sub WebBrowserCtrl_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)

    '// get #vb-XXX command from url
    Dim pos As Long: pos = InStrRev(URL, "#vb-")

    If pos Then
        Cancel = True '// stop default navigation

        URL = Mid$(URL, pos + 4)

        Select Case LCase$(URL)
            Case "showform2": Form2.Show
            '...
            Case "waffles":   MsgBox "Waffles."
            Case Else:        MsgBox "Unknown Command " & URL
        End Select
    End If

End Sub

这篇关于单击 webbrowser html 页面中的链接时显示 VB6 表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)