gpt4 book ai didi

c# - 不支持 WPF 调用脚本?

转载 作者:搜寻专家 更新时间:2023-10-31 22:47:53 24 4
gpt4 key购买 nike

我正在尝试在我的 wpf 应用程序中以 html 格式显示某种帮助页面,我已经从我的资源管理器加载了 html,它包含多个我想从 c# 执行的 javascript 函数。

应该这样做:

webBrowser1.InvokeScript("MyFunction");

这根本不起作用,我收到错误代码:

Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))

Microsoft 对此没有任何帮助,谷歌搜索也无济于事。

问题:如何在 wpf 网络浏览器中调用脚本?

最佳答案

根据 MSDN -

InvokeScript(String) should not be called before the document that implements it has finished loading. You can detect when a document has finished loading by handling the LoadCompleted event.

这家伙 here得到同样的错误,原因是上面提到的那个,即在加载文档之前尝试调用。

关于c# - 不支持 WPF 调用脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13102676/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com