0
使用WebBrowser控件顯示PPT文件。VK_PRIOR鍵不工作
對於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