Re: dll's
30.07.2002 18:36:23
Thomas Risi
Hallo ThomasMehr Info wäre nicht schlecht (Compiler, Quellcode, ...).
Hier ein kleines Beispiel (VC++):
#include "stdafx.h"#ifdef __cplusplus
#define EXPORT extern "C" __declspec (dllexport)
#else
#define EXPORT __declspec (dllexport)
#endif
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
EXPORT TCHAR* __stdcall fDllTest1(TCHAR* txt)
{
TCHAR* ReturnMessage = "TestChar";
MessageBox(NULL, ReturnMessage, "TEST", 0);
return ReturnMessage;
}
Option ExplicitDeclare Function fDllTest1 Lib _
"C:\Programme\Microsoft Visual Studio\MyProjects\CodeParser\Debug\CodeParser.dll" _
Alias "_fDllTest1@4" (ByVal Na As String) As Long
Sub Test()
Dim myString As String: myString = ""
Dim Pointer As Long: Pointer = fDllTest1("Beispiel")
'Dim Pointer As Long: Pointer = Beispiel2
Dim i As Long: i = 0
Dim Dummy As Byte: Dummy = 1
Do While Dummy <> 0
CopyMemory ByVal VarPtr(Dummy), ByVal Pointer + i, 1
i = i + 1
If Not Dummy = 0 Then myString = myString & Chr(Dummy)
Loop
MsgBox myString
End Sub
Code eingefügt mit Syntaxhighlighter 1.13
Gruß
Thomas
Risi Thomas Softwareentwicklung
Thomas.Risi@t-online.de