VK_PRIOR 键不起作用
使用WebBrowser Control 显示PPT 文件。
在 Office 2007 中这是成功的,但在 Office 2010 中,向下翻页键 (VK_PRIOR
) 不起作用。
用于单击上一个的代码不适用于 Office 2010,但适用于 Office 2007:
Private Sub btnPREV_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPREV.Click
If docType = DocumentType.PPT Then
If hndl = IntPtr.Zero Then
GetHandles()
End If
NativeMethods.PostMessage(hndl, WM_KEYDOWN, VK_PRIOR, IntPtr.Zero)
NativeMethods.PostMessage(hndl, WM_KEYUP, VK_PRIOR, IntPtr.Zero)
End If
End Sub
用于单击下一个的代码适用于 Office 2007 和 2010:
Private Sub BtnNEXT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNEXT.Click
If docType = DocumentType.PPT Then
If hndl = IntPtr.Zero Then
GetHandles()
End If
NativeMethods.PostMessage(hndl, WM_KEYDOWN, VK_NEXT, IntPtr.Zero)
NativeMethods.PostMessage(hndl, WM_KEYUP, VK_NEXT, IntPtr.Zero)
End If
End Sub
using WebBrowser Control to display a PPT file.
With Office 2007 this is successful, but with Office 2010, the page down key (VK_PRIOR
) does not work.
This code for click previous does not work with Office 2010, but works with Office 2007:
Private Sub btnPREV_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPREV.Click
If docType = DocumentType.PPT Then
If hndl = IntPtr.Zero Then
GetHandles()
End If
NativeMethods.PostMessage(hndl, WM_KEYDOWN, VK_PRIOR, IntPtr.Zero)
NativeMethods.PostMessage(hndl, WM_KEYUP, VK_PRIOR, IntPtr.Zero)
End If
End Sub
This code for click next works with both Office 2007 and 2010:
Private Sub BtnNEXT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNEXT.Click
If docType = DocumentType.PPT Then
If hndl = IntPtr.Zero Then
GetHandles()
End If
NativeMethods.PostMessage(hndl, WM_KEYDOWN, VK_NEXT, IntPtr.Zero)
NativeMethods.PostMessage(hndl, WM_KEYUP, VK_NEXT, IntPtr.Zero)
End If
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决办法找到:
WebBrowser1是WebBrowser类的对象。
就是这样。由于触发了 Page Up 事件,因此“上一个”单击开始起作用。
The solution is found:
WebBrowser1 is the object of the WebBrowser Class.
That's it. The "previous" click starts working, since the Page Up event is fired.