在VB程序运行时,存储数据提示“实时错误76”,并指向Open Left(App.Path, Len(App.Path) - 0) + "\data\" + Format(Now, "yy/mm/dd/hh/mm/ss") + ".txt" For Binary As #1这句话,请问怎么解决?运行环境是win7,求大神指导啊!!!急急急 !!!
ANSI String文件名不能被正确识别的问题。
其实2000以后,系统就开始全面支持Unicode了,而VB6比较老,为兼容95,一直是强制将本身的Unicode转成ANSI,这对于win2000以上的系统,实际上是极低效的做法,VB把Unicode转成ANSI,系统需把这ANSI再次转成Unicode才能使用,碰到上面情况还会出错。 用API操作
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileW" (ByVal lpFileName As Long, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
文件名参数,传递时,要用Byval Strptr(Filename)的方式。
楼主,你的“Open Left(App.Path, Len(App.Path) - 0) + "\data\" + Format(Now, "yy/mm/dd/hh/mm/ss") + ".txt" For Binary As #1”错误问题解决了吗?求解啊!!!