Re: Help using a C dll function in VB

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks Mike, although most of your post went right over my head, I`m still
pretty new to VB and .net, this is what I`m thinking. I`ll write a wrapper
around the MP4MetadataGetArtwork function in c as follows:-

char* MY_MP4GetArtwork(MP4FileHandle hFile,long *returnedsize)
{
char *art;
MP4GetMetadataArtwork(hfile,&art,&returnedsize,0);

return art;
}

now in VB can I do the following:-

Declare Function MY_MP4GetArtwork "libmp4v2.dll" (ByVal fhandle As UIntPtr,
_
, ByRef
returnedsize As UInteger) As IntPtr

dim size as UInteger
dim array() as byte = MY_MP4GetArtwork(fhandle,size)



Try not to laugh if thats total jibbarish and has no chance in hell of
working but like I say I`m pretty new to this and I`m at a loss at the
moment.

Rob



"Mike" <unknown@xxxxxxxxxx> wrote in message
news:ef$u41YzJHA.480@xxxxxxxxxxxxxxxxxxxxxxx
Mike wrote:

Start by creating a class library with the functions your want that will
map the libmp4v2.dll. They exposed .NET function do not need to be the
same prototype, it can turn the array, like above.

Sorry, I meant:

The exposed .NET functions do not need to be the same prototype, it
can return an array with no parameters or maybe just the file name,
like above.

If you need to keep file open, then the file handle is a private resource
in your MCL.DLL, which mean you have a classic file I/O wrapper:

private hfile as inptr

public shared function openmp4(byval fn as string) as boolean
hFile = open the file
end function

public shared function closemp4() as boolean
close the hfile
end function

public shared function readmp4() as byte()
read the hfile and return array
end function



.



Relevant Pages

  • Re: Help using a C dll function in VB
    ... I just found this interesting blog article providing some insight and history in the crazy new C++/CLR language syntax. ... Dim array() As Byte = MY_Mp4GetArtwork ... private hfile as inptr ... public shared function openmp4as boolean ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help using a C dll function in VB
    ... Dim array() As Byte = MY_Mp4GetArtwork ... They exposed .NET function do not need to ... private hfile as inptr ... public shared function openmp4as boolean ...
    (microsoft.public.dotnet.languages.vb)
  • Re: matching a condition in a list
    ... Sorting the array. ... sorting the array once, and using BinarySearch would be a benefit, at the ... Public Shared Function IsInSet(ByVal Item As Object, ... SetItemsAs Object) As Boolean ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help using a C dll function in VB
    ... Dim array() As Byte = MY_Mp4GetArtwork ... private hfile as inptr ... public shared function openmp4as boolean ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Read headings from CSV into Form in VBA?
    ... They want to have 4 top heading categories which you can only ... Spliteach line on the separator to derive an array of elements. ... Public Function ReadFile(ByVal FileName As String) As String ... Dim hFile As Long ...
    (microsoft.public.office.developer.vba)