| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 554 人关注过本帖
标题:[求助]API 调用问题,急
只看楼主 加入收藏
酱豆腐
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-12-9
收藏
 问题点数:0 回复次数:0 
[求助]API 调用问题,急

我的Vba在本机通过Kernel32能正常的读写Ini配置文件,但在其他机子上就返回为0,我用Err.lastDllErr观察,返回也是0。
代码如下:
Option Explicit
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

'获取当前路径
Function GetPath() As String
Dim path As String
path = Application.ActiveWorkbook.path
GetPath = path + "\"
End Function

'读INI文件
Function GetIniString(ByVal lpFileName As String, ByVal lpApplicationName As String, ByVal lpKeyName As String) As String
Dim szBuf As String
Dim ret As Integer
Dim path As String
Dim length As Integer

path = GetPath() + lpFileName
szBuf = Space$(1024)
length = Len(szBuf)
ret = GetPrivateProfileString(lpApplicationName, lpKeyName, "0", szBuf, length, path)
If ret Then
GetIniString = Left$(szBuf, ret)
Else
GetIniString = ""
End If
End Function

Private Sub CommandButton1_Click()
Label1.Caption = GetIniString("eareport.ini", TextBox1.Text, TextBox2.Text)
End Sub

Private Sub UserForm_Click()

End Sub
我估计我的请况时,更本没调用API.
我的系统是是Win2000 professional

是不是某个动态库、服务或组件有问题

搜索更多相关主题的帖子: API 
2006-12-09 15:44
快速回复:[求助]API 调用问题,急
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032629 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved