Dim iniFileName(255) As String
Function Export OpenFile(ByVal fID As Integer, ByVal sFileName As BytePtr) As Integer
If fID < 0 Or fID > 255 Then
OpenFile = 1
ElseIf iniFileName(fID) <> "" Then
OpenFile = 2
Else
iniFileName(fID) = MakeStr(sFileName)
OpenFile = 0
End If
End Function
Private Declare Function OpenFile Lib "test.dll" (ByVal fID As Integer, ByVal sFileName As String) As Integer
Private Sub Form_Load()
Debug.Print OpenFile(0, App.Path & "\test.txt")
End Sub
Sub Form_Load()
Dim A$ As String,B As DWord
A$=MakeStr(App.path)+"\test.txt"
B=calloc(Len(A$)+1)
memcpy(B,A$,Len(A$))
#ifdef _DEBUG
MessageBox(0,Str$(OpenFile(0,B)),"debug",MB_OK)
#endif
free(B)
End Sub
Function Export DllMain(hinstDLL As HINSTANCE, fdwReason As DWord, pvReserved As VoidPtr) As BOOL
'DLLエントリポイント
Select Case fdwReason
Case DLL_PROCESS_ATTACH
'DLLがプロセス空間にロードされた時に実行されます。
_System_StartupProgram()
InitializeIniFileName()
DllMain = TRUE
End Select
End Function