The Forum is up for sale: XeNTaX Forum looking for new owner
PROJECT: MultiEx Plugin Support
do you want a WORKING delphi application? or how it SHOULD work for you, but in delphi?
I have talored the Manager to work with VB, and because of VB crazy dll talking, i've had to do some special. So if i wrote a working application, it would do have to do some cleanup, that VB does automatically and stuff like that.
I have talored the Manager to work with VB, and because of VB crazy dll talking, i've had to do some special. So if i wrote a working application, it would do have to do some cleanup, that VB does automatically and stuff like that.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Code: Select all
// Plugin Support Information
function GetManagerVersion(var Major, Minor: LongInt): LongBool; stdcall;
function GetSupportedInterfaceVersion(var Major, Minor: LongInt): LongBool; stdcall;
function SetPluginDirectory(Directory: PChar): LongBool; stdcall;
function RefreshPluginList(): LongBool; stdcall;
function PluginCount(): LongInt; stdcall;
function PluginInfo(Index: LongInt; var MyPluginInfo: TManagerPluginInfo): LongBool; stdcall;
function FreeCache():LongBool; stdcall;
function SetCacheSize(Size: LongInt):LongBool; stdcall;
// Plugin Calls
function mpGetFormatCount(): LongWord; stdcall;
function mpGetFormatInfo(FormatIndex: LongInt; var FormatInfo: TFormatInfo): LongBool; stdcall;
function mpGetOptions(FormatIndex: LongInt; OptionType: LongInt): PChar; stdcall;
function mpSetOption(FormatIndex: LongInt; OptionType: LongInt; Name: PChar; Value: PChar): LongBool; stdcall;
function mpOpenArchive(var ArchiveHandle: LongInt; FormatIndex: LongInt; ArchiveName: PChar; Flags: Cardinal): LongBool; stdcall;
function mpOpenArchiveBindStream(var ArchiveHandle: LongInt; FormatIndex: LongInt; Stream: IStream; Flags: Cardinal): LongBool; stdcall;
function mpCloseArchive(FormatIndex: LongInt; ArchiveHandle: LongInt): LongBool; stdcall;
function mpIndexCount(FormatIndex: LongInt; ArchiveHandle: LongInt): LongInt; stdcall;
function mpIndexedInfo(FormatIndex: LongInt; ArchiveHandle: LongInt; Index: LongInt; Item: PChar): PChar; stdcall;
function mpFindInfo(FormatIndex: LongInt; Handle: LongInt; Field: PChar): PChar; stdcall;
function mpFindFirstFile(FormatIndex: LongInt; ArchiveHandle: LongInt; FileMask: PChar): LongInt; stdcall;
function mpFindNextFile(FormatIndex: LongInt; FindHandle: LongInt): LongBool; stdcall;
function mpFindClose(FormatIndex: LongInt; FindHandle: LongInt): LongBool; stdcall;
function mpIsFileAnArchive(FormatIndex: LongInt; Filename: PChar): LongBool; stdcall;
function mpIsStreamAnArchive(FormatIndex: LongInt; Stream: IStream): LongBool; stdcall;
function mpExportFileByNameToFile(FormatIndex: LongInt; ArchiveHandle: LongInt; ArchiveFile: PChar; ExternalFile: PChar): LongBool; stdcall;
function mpExportFileByIndexToFile(FormatIndex: LongInt; ArchiveHandle: LongInt; FileIndex: LongInt; ExternalFile: PChar): LongBool; stdcall;
function mpExportFileByNameToStream(FormatIndex: LongInt; ArchiveHandle: LongInt; ArchiveFile: PChar; Stream: IStream): LongBool; stdcall;
function mpExportFileByIndexToStream(FormatIndex: LongInt; ArchiveHandle: LongInt; FileIndex: LongInt; Stream: IStream): LongBool; stdcall;
function mpImportFileFromFile(FormatIndex: LongInt; ArchiveHandle: LongInt; ArchiveFile: PChar; ExternalFile: PChar): LongBool; stdcall;
function mpImportFileFromStream(FormatIndex: LongInt; ArchiveHandle: LongInt; ArchiveFile: PChar; Stream: IStream): LongBool; stdcall;
function mpRemoveFileByName(FormatIndex: LongInt; ArchiveHandle: LongInt; Filename: PChar): LongBool; stdcall;
function mpRemoveFileByIndex(FormatIndex: LongInt; ArchiveHandle: LongInt; FileIndex: LongInt): LongBool; stdcall;
function mpGetLastError(FormatIndex: LongInt): Cardinal; stdcall;
function mpGetErrorText(FormatIndex: LongInt; Value: Cardinal): PChar; stdcall;"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Saw this, didn't know if maybe you wanted to read it.
http://www.vbaccelerator.com/home/VB/Ty ... rticle.asp
http://www.vbaccelerator.com/home/VB/Ty ... rticle.asp
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
-
Mr.Mouse
- Site Admin
- Posts: 4073
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 450 times
- Been thanked: 680 times
- Contact:
Ah yes, something like that may come in handy in the future.Rahly wrote:Saw this, didn't know if maybe you wanted to read it.
http://www.vbaccelerator.com/home/VB/Ty ... rticle.asp
On the current API: it might be possible to change the PChar arguments to WideString. That would make it not reference counted and prevent certain problems. Visual Basic will just take it... but I cannot easily check.
Returning strings (PChar) in DLL functions (also WideStrings) generally leads to problems. Do these functions work right now?
Returning strings (PChar) in DLL functions (also WideStrings) generally leads to problems. Do these functions work right now?
I'll have a plugin skeleton shortly, PChars are not referenced counted, AnsiStrings are.
And VB Doesn't take it. ByVal Value as String <--- VB converts a UTF-16 String to an Ansi String. I'm trying to see if i can find a better way to get WideStrings, as I would like to have that implemented in a later version.
MrMouse and I have spend a few hours just getting strings to work. PChar is what the plugins use as its easy for a C/C++ pluging to make a char* and delphi already has support (PChar). The plugin manager itself acts as a buffer between MexCom and the Plugins. There are a few reasons that make VB a terrible language to implement plugins in.
And VB Doesn't take it. ByVal Value as String <--- VB converts a UTF-16 String to an Ansi String. I'm trying to see if i can find a better way to get WideStrings, as I would like to have that implemented in a later version.
MrMouse and I have spend a few hours just getting strings to work. PChar is what the plugins use as its easy for a C/C++ pluging to make a char* and delphi already has support (PChar). The plugin manager itself acts as a buffer between MexCom and the Plugins. There are a few reasons that make VB a terrible language to implement plugins in.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
I know, I've spend days on it in the past. And got it to work eventually. The 'correct' way to return a string (this is what I used anyway):Rahly wrote: MrMouse and I have spend a few hours just getting strings to work. PChar is what the plugins use as its easy for a C/C++ pluging to make a char* and delphi already has support (PChar). The plugin manager itself acts as a buffer between MexCom and the Plugins. There are a few reasons that make VB a terrible language to implement plugins in.
Code: Select all
function PlugInVersions(Path: PChar; BufferSize: Integer; var Buffer: PChar): Integer; stdcall; forward;Code: Select all
for i:=1 to Length(tmpDynaFile) do begin
Buffer[i-1]:=tmpDynaFile[i];
end;
Buffer[Length(tmpDynaFile)]:=#0;
Result:=Length(tmpDynaFile);
This is the corresponding VB declaration and code:
Code: Select all
Private Declare Function PlugInVersions Lib "tibedhlp.dll" (ByVal Path As String, ByVal BufferLength As Long, BufferText As String) As Long
Function GetPluginLiveUpdateInfo() As String
Dim Buffer As String * 255
Dim q As Long
q = PlugInVersions(DataDir$, 255, Buffer)
GetPluginLiveUpdateInfo = Left$(Buffer, q)
End Function


