Hello
I've (in WinImage SDK http://www.winimage.com/wima_sdk.htm ) a function that
I need to use from a VB.Net apps
First, on the unmanaged Win32 DLL, I've a function which get the number of
item (function GetNbEntryCurDi r)
after, I allocate an array and I call GetDirInfo to fill the array
// GetNbEntryCurDi r : Get the number of entry of cur directory
DWORD WIMAAPI GetNbEntryCurDi r(HIMA hIma);
#define MAXLFN 256
typedef struct
{
char nom[8];
char ext[3];
char szCompactName[13];
BYTE bAttr;
BYTE dir_CreateMSec;
WORD dir_CreateDate;
WORD DosTime;
WORD DosDate;
BOOL fIsSubDir;
BOOL fSel; // for private use of client app.
BOOL fLfnEntry;
DWORD dwSize;
UINT uiPosInDir;
DWORD dwLocalisation;
DWORD dwTrueSize;
char longname[MAXLFN];
WORD dir_CreateTime;
WORD dir_LastAccessD ate;
} DIRINFO;
// GetDirInfo : Get info about the entry of cur directory
// LPDIRINFO : array of DIRINFO that will receive the info
// (use GetNbEntryCurDi r for know the size needed)
// bSort : specify how the file must be sort
// (SORT_NONE, SORT_NAME, SORT_EXT, SORT_SIZE or SORT_DATE)
BOOL WIMAAPI GetDirInfo(HIMA hIma,LPDIRINFO lpdi,BYTE bSort);
on C++ unmanager, I do:
{
HIMA hIma; // filled by other function
DWORD dwNumber = GetNbEntryCurDi r(hIma);
DIRINFO* pDirInfo = (DIRINFO*)mallo c(sizeof(DIRINF O) * dwNumber );
GetDirInfo(hIma ,pDirInfo,0);
DWORD i;
for (i=0;i<dwNumber ;i++) printf("%s\n", (pDirInfo+i)->longname)
}
I want do the same work on VB.net
I had converted DIRINFO structure on VB.net
Public Const MAXLFN As Short = 256
<StructLayout(L ayoutKind.Seque ntial, CharSet:=CharSe t.Ansi, Pack:=1)_
Public Structure DIRINFO
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=8)Pu blic nom As String
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=3)Pu blic ext As String
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=13)P ublic szCompactName As
String
Public bAttr As Byte
Public dir_CreateMSec As Byte
Public dir_CreateDate As Short
Public DosTime As Short
Public DosDate As Short
Public fIsSubDir As Integer
Public fSel As Integer
Public fLfnEntry As Integer
Public dwSize As Integer
Public uiPosInDir As Integer
Public dwLocalisation As Integer
Public dwTrueSize As Integer
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=MAXL FN)Public longname As
String
Public dir_CreateTime As Short
Public dir_LastAccessD ate As Short
End Structure
I need help to convert VB Array to unmanaged C-Style array. I suppose I need
<MarshalAs(Unma nagedType.LPArr ay)or <MarshalAs(Unma nagedType.ByVal Array)>
I tried
Declare Function GetDirInfo Lib "wimadll.dl l" (ByVal Ima As Integer,
<MarshalAs(Unma nagedType.LPArr ay)ByRef dia As DIRINFO, ByVal bSort As
Byte) As Boolean
without success
Any help or tips will be a lot welcome !
regards
Gilles Vollant