DLL帮助文档中的函数说明如下
RC WINAPI LJIF_SaveEnvironmentFile(IN LPCTSTR szFilePath)
Description: Reads the environment setting file from the controller and saves it with the specified name.
Parameter:szFilePath (Setting file name *Specify the full path. )
Returned value :0x00 (Completed without errors
Other See "Return Code List" )
Res The controller must be set to communication mode. 现在准备用VB中的Commondialog 获取地址传递给 API函数
相应程序如下:声明
Global sSourcePgm$
Global sDestFile$ Declare Function LJIF_LoadEnvironmentFile Lib "LJIF.dll" (ByVal szFilePath As Long) As Long
Declare Function LJIF_SaveEnvironmentFile Lib "LJIF.dll" (ByVal szFilePath As Long) As Long调用过程
Private Sub LoadEnvironment_Click()
On Error Resume Next
With Dlg
.FileName = sSourcePgm
.CancelError = True
.DialogTitle = "请根据探头型号选择配置文件"
.Filter = "Lg environment setting file (*.env)|*.env|All files|*.*"
.Action = 1
If Err Then
Err.Clear
Exit Sub
End If
sSourcePgm = .FileName
szFilePath = VarPtr(sSourcePgm)
End With Re = LJIF_LoadEnvironmentFile(szFilePath)
Call ReturnCode
If Re = 0 Then
StatusBar1.Panels(2).Text = "环境设置完成"
Else
StatusBar1.Panels(2).Text = "环境设置失败"
End If
End Sub在调试中,发现返回参数不正常,不能确执行。请各位高手帮忙看看哪里错了,指点一二。
RC WINAPI LJIF_SaveEnvironmentFile(IN LPCTSTR szFilePath)
Description: Reads the environment setting file from the controller and saves it with the specified name.
Parameter:szFilePath (Setting file name *Specify the full path. )
Returned value :0x00 (Completed without errors
Other See "Return Code List" )
Res The controller must be set to communication mode. 现在准备用VB中的Commondialog 获取地址传递给 API函数
相应程序如下:声明
Global sSourcePgm$
Global sDestFile$ Declare Function LJIF_LoadEnvironmentFile Lib "LJIF.dll" (ByVal szFilePath As Long) As Long
Declare Function LJIF_SaveEnvironmentFile Lib "LJIF.dll" (ByVal szFilePath As Long) As Long调用过程
Private Sub LoadEnvironment_Click()
On Error Resume Next
With Dlg
.FileName = sSourcePgm
.CancelError = True
.DialogTitle = "请根据探头型号选择配置文件"
.Filter = "Lg environment setting file (*.env)|*.env|All files|*.*"
.Action = 1
If Err Then
Err.Clear
Exit Sub
End If
sSourcePgm = .FileName
szFilePath = VarPtr(sSourcePgm)
End With Re = LJIF_LoadEnvironmentFile(szFilePath)
Call ReturnCode
If Re = 0 Then
StatusBar1.Panels(2).Text = "环境设置完成"
Else
StatusBar1.Panels(2).Text = "环境设置失败"
End If
End Sub在调试中,发现返回参数不正常,不能确执行。请各位高手帮忙看看哪里错了,指点一二。
dim sFilePath as string
sFilePath =string(255," ")
Re = LJIF_SaveEnvironmentFile(sFilePath)
(ByVal szFilePath As String)
在commondialog
程序段里面只需要sFilePath = .FileName就行了么?
或者
LJIF_LoadEnvironmentFile StrPtr(StrConv(.FileName, vbUnicode))看看