掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
iniファイルから文字列(実行ファイルのパス)を取得するには? (ID:76958)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
まずAPIの宣言ですが、.NETでは Integerが32bit、Longが64bitに変更されています。 なので、VB6でのLongは全てIntegerに変える必要があります。 Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As String, _ ByVal lpDefault As String, _ ByVal lpReturnedString As String, _ ByVal nSize As Integer, _ ByVal lpFileName As String) As Integer 次にFunction部分ですが、上記と同じ理由でLongをIntegerに変更します。 あとデータを返す時はReturnを使うの.NET流だそうです。 あとは見たところ問題なさそうです。 Function INI_DBPATH_READ(ByVal sFilePath As String) As String Dim linebuf As String linebuf = New String(CChar(" "), 256) Dim buf As String buf = New String(CChar(" "), 256) Dim ret As Integer 'linebuf = Space(256) 'buf = Space(256) ret = GetPrivateProfileString("section", "entry", "", linebuf, 256, sFilePath) If ret > 0 Then buf = Left(linebuf, InStr(linebuf, Chr(0)) - 1) Return buf End If End Function こんな感じでどうでしょうか?
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.