■65092 / inTopicNo.4) |
Re[3]: 変換後のGetPrivateProfileString |
□投稿者/ shu (168回)-(2013/02/04(Mon) 17:06:00)
|
■No65091 (MassyPie さん) に返信
Declare宣言のcharsetmodifierを省略するとAnsiになるのでWの場合Unicode指定しないと駄目です。
http://msdn.microsoft.com/ja-jp/library/4zey12w5(v=vs.80).aspx
以下の4つの宣言どれでも戻りは同じになります。
Wの方が良いのでDeclareかDllImportのUnicode指定の宣言を使用されるとよいと思います。
Public Declare Unicode Function GetPrivateProfileString1 Lib "kernel32" Alias "GetPrivateProfileStringW" (ByVal pApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As System.Text.StringBuilder,
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
Public Declare Ansi Function GetPrivateProfileString2 Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal pApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As System.Text.StringBuilder,
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
<DllImport("kernel32.DLL", EntryPoint:="GetPrivateProfileStringW", SetLastError:=True, _
CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetPrivateProfileString3(ByVal pApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As System.Text.StringBuilder,
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
End Function
<DllImport("kernel32.DLL", EntryPoint:="GetPrivateProfileStringA", SetLastError:=True, _
CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetPrivateProfileString4(ByVal pApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As System.Text.StringBuilder,
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
End Function
|
|