Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Apr : I'm Stuck - Pointer to an Array?

www.cryer.info
Managed Newsgroup Archive

I'm Stuck - Pointer to an Array?

Subject:I'm Stuck - Pointer to an Array?
Posted by:"MikeW (Dallas)" (mikew@nospam-dallasaddress.com)
Date:Mon, 23 Apr 2007 16:19:26

I'm sure that I am an idiot.  I just cannot manage to make this work.  I am
trying to work with simple mapi structure as defined in MAPI.PAS.  Any
advice would be appreciated.

  PMapiFileDesc = ^TMapiFileDesc;
  MapiFileDesc = packed record
    ulReserved: Cardinal;        { Reserved for future use (must be 0)     }
    flFlags: Cardinal;           { Flags                                   }
    nPosition: Cardinal;         { character in text to be replaced by
attachment }
    lpszPathName: LPSTR;         { Full path name of attachment file       }
    lpszFileName: LPSTR;         { Original file name (optional)           }
    lpFileType: Pointer;         { Attachment file type (can be
lpMapiFileTagExt) }
  end;
  TMapiFileDesc = MapiFileDesc;

The MapiFileDescripion is a POINTER TO AN ARRAY.   How do I turn a pointer
to an array into a real array that I can read ??????

This is my attempt that, of course, fails ...

function MapiSendMail(lhSession: LHANDLE; ulUIParam: Cardinal;
    var lpMessage: TMapiMessage; flFlags: FLAGS; ulReserved: Cardinal):
Cardinal; stdcall;
var
  Files: array[0..64] of TMapiFileDesc;
  i: Integer;
begin

  FillChar(Files, SizeOf(TMapiFileDesc)*64, 0);
  Files[0] := @lpMessage.lpFiles;

    for I := 0 to lpMessage.nFileCount do
          ShowMessage(Files[i].lpszPathName);

Replies:

www.cryer.info
Managed Newsgroup Archive