How to set a file attribute that filename consist of UNICODE character?
for example:
C:\我的文件.txt
I've tried SetAttr and SetFileAttributesA(API) are having error.
Anyone got an idea for unicode filename?
Printable View
How to set a file attribute that filename consist of UNICODE character?
for example:
C:\我的文件.txt
I've tried SetAttr and SetFileAttributesA(API) are having error.
Anyone got an idea for unicode filename?
Use the wide version: SetFileAttributesW.
See http://vb.mvps.org/tips/varptr.asp for a tip on using StrPtr() to make this possible from VB6.
Unicode aware SetFileAttr
Returns True if successful
Code:'Purpose: Unicode aware SetFileAttr
Public Function SetFileAttributes(ByVal lpFilename As String, ByVal dwFileAttributes As Long) As Boolean
If Len(lpFilename) Then
SetFileAttributes = SetFileAttributesW(StrPtr(lpFilename), dwFileAttributes) <> 0
End If
End Function
Thanks for DrUnicode and dilettante, the problem is solved!