购买了PDF控件后,需要安装并注册FoxitReader_AX_Pro.npk和FoxitReader_AX_Pro.ocx文件。通过易语言编写代码,实现动态调用此OCX并绑定控件事件。代码如下:
Language "EPL"
'初始化FoxitReader控件
Declare Function FoxitReaderInit Lib "FoxitReader_AX_Pro.ocx" Alias "Init" (ByVal hParent As Long, ByVal nX As Long, ByVal nY As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Declare Function FoxitReaderLoadFile Lib "FoxitReader_AX_Pro.ocx" Alias "LoadFile" (ByVal lpszFilePath As String, ByVal bAddToMRU As Long, ByVal bOpenPasswordDlg As Long, ByVal lpszPassword As String) As Long
Declare Sub FoxitReaderClose Lib "FoxitReader_AX_Pro.ocx" Alias "Close" ()
Declare Sub FoxitReaderShowToolBar Lib "FoxitReader_AX_Pro.ocx" Alias "ShowToolBar" (ByVal bShow As Long)
'定义FoxitReader控件事件
Event FoxitReader_OnLoadComplete(ByVal filePath As String)
'调用FoxitReader控件
Dim hFoxitReader As Long
hFoxitReader = FoxitReaderInit(Parent.hWnd, 0, 0, Parent.Width, Parent.Height)
FoxitReaderLoadFile("C:\example.pdf", False, False, "")
FoxitReaderShowToolBar(True)
'FoxitReader控件事件处理
Sub FoxitReader_OnLoadComplete(ByVal filePath As String)
'处理代码
End Sub
暂无评论