Page 8 of 20

Posted: Tue Feb 15, 2005 9:58 am
by Mr.Mouse
The size is 24

This is your declaration :

Code: Select all

  // Not to be used outside of the plugin 
  TFileFindInfo = record 
    Filename: PChar; 
    FieldData: PChar; 
    FileMask: PChar; 
    ArchiveHandle: Integer; 
    FieldList: PChar; 
    InternalFindInfo: Pointer; 
  end; 
This is mine :

Code: Select all

Public Type TFileFindInfo
    Filename As String
    FieldData As String
    FileMask As String
    ArchiveHandle As Long
    FieldList As String
    InternalFindInfo As Long 'pointer?
  End Type
Then I declare the function like this:

Code: Select all

Declare Function mpFindFirstFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByVal ArchiveHandle As Long, ByVal FileMask As String, ByVal FieldList As String, ByRef finddata As TFileFindInfo) As Boolean
And call it like this:

Code: Select all

Dim finddata As TFileFindInfo
SizeOfTheThing = Len(finddata)

res = mpFindFirstFile(inh, freehand, "*.*", Null, finddata)
It no longer crashes, as the msitake was to call the function with a LOCALLY declared finddata, I have now created a global finddata and the function returns TRUE. However, the FindData info is blank. No filenames, etc. Also afer using mpFindNext. It just returns no info.

Posted: Tue Feb 15, 2005 2:04 pm
by Rahly
can you send me your "test" program?

Posted: Wed Feb 16, 2005 12:32 pm
by Mr.Mouse
Ok, I'll see what I can do about sending a test program with the VB code.

Posted: Thu Feb 17, 2005 9:04 pm
by Mr.Mouse
Okay, I have send you the code to your terrygoodkind mail address.

Posted: Fri Feb 18, 2005 12:30 am
by Rahly
umm great.... ummm can you do me a favor, send me the compile executable, thats all

i tried compiling and running it myself, but i had to convert it to VB.NET, and it fails on mpGetFormatInfo.

Posted: Fri Feb 18, 2005 9:33 am
by Mr.Mouse
Hmm, please try to compile it nonetheless, if you will. I have experienced some difficulty with this test program. I had to copy the relevant code from another test program, as that one was too big. But once copied, the mpFindFirstFile no longer can be called using a "null" for fieldlist. VB nags abouth that. Consequently, the executable would also nag about that. When I use "" instead (empty string) everything crashes. If you can have both VB and Delphi running you can finetune the functions so they match, n'est-pas?
You know your own code best and can see what is happening. Just a thought.

Posted: Fri Feb 18, 2005 11:15 pm
by Rahly
Yes, but all i need is the executable, the main problem is that VB.NET doesn't run anything like the other versions of VB. The main problem is that i COULD get it working with VB.NET but it is almost guaranteed not to work with VB5 or 6. If you want me to get it working under .NET I will though. I was shooting for VB5, the one you have.

Posted: Fri Feb 18, 2005 11:21 pm
by Mr.Mouse
Okay, so the problem is the VB.net thing. I have Delphi installed, so I could also take a look at the plugin manager code and play with that code. The problem is, the test program just crashes at the moment. I'm not sure what good it would do, when you start it, and it crashes. Perhaps I'm just calling it all wrong, and without the code, you can't alter the behaviour of my executable. :oops:

Posted: Sat Feb 19, 2005 2:21 am
by Rahly
i don't really need too, but with the executable i can tell how your calling the function, and suggest changes.

What is it crashing on?

Posted: Sat Feb 19, 2005 9:01 am
by Guest
It crashes when I use an empty string for FieldList. ( "" )
But the crash may be due to the call itself, or some other variable.
Anyway, I sent you the executable.

Posted: Sat Feb 19, 2005 9:04 am
by Mr.Mouse
Whooops, that was me.... :)

Posted: Sun Feb 20, 2005 3:15 am
by Rahly
i think i'm going to do what you said earlier though, but i'm going to do it in the plugin manager.

Posted: Sun Feb 20, 2005 5:29 am
by Rahly
ok, for that error, what are the differences in the "Type" from the working version and the one that doesn't work, also is mpGetFormatInfo being called the same and "ByRef"?

From what i can see, the function works correctly, but when you get it back, you copy the strings out of it, and then try to FREE the ones i sent you, which you can't, you try to free them like Ole/Com strings, and they aren't

Posted: Sun Feb 20, 2005 10:33 am
by Mr.Mouse
Yes, both ByRef

Code: Select all

Declare Function mpGetFormatInfo Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByRef FormatInfo As TFormatInfo) As Boolean

Code: Select all

Declare Function mpFindFirstFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByVal ArchiveHandle As Long, ByVal FileMask As String, ByVal FieldList As String, ByRef FindData As TFileFindInfo) As Boolean
Declare Function mpFindNextFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByRef FindData As TFileFindInfo) As Boolean
As for the freeing of strings, there's no code of mine doing that, must be how VB handles certain things. You are talking about the fieldlist and filemask strings, right? As for the FindData strings, I don't do much with them, as the program crashes before I can do something.

Posted: Sun Feb 20, 2005 5:12 pm
by Rahly
how do you have it TFormatInfo defined in both? how are the variables declared? globally in one, locally in another?