Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Jul : About Size of Record

www.cryer.info
Managed Newsgroup Archive

About Size of Record

Subject:About Size of Record
Posted by:"Churc" (cebas..@gmail.com)
Date:18 Jul 2007 06:50:59

Hello!

me again trying to learn x)

I was looking some advanced codes, source codes of some opensource
programs and when using records, normally there is a field to pass
the size of the record... example

type
TInfo = record
  cbSize: DWORD;
  ...
end;

Ok, some records has this field, others not...
Robb said to me pass this Buffer before to the DLL...

but why to use that, and when?

and in the DLL, how can i use it?

example
type
  PExtensionInfo = ^TExtensionInfo;
  _TAG_EXTENSION_INFO = record
    cbSize: DWORD;
    chCLSID: array [0..16] of Char;
    chDisplayName: array [0..60] of Char;
    chDesc: array [0..MAX_PATH] of Char;
    chAuthor: array [0..60] of Char;
    chEmail: array [0..MAX_PATH] of Char;
    chCopyright: array [0..60] of Char;
    chURL: array [0..MAX_PATH] of Char;
    dwVersion: DWORD;
  end;
  TExtensionInfo = _TAG_EXTENSION_INFO;

i'll pass this record to DLL as Pointer (PExtensionInfo) and i need to
set the buffer before?

like

var
ExtensionInfo: TExtensionInfo;
begin
//Why i need to do it?
ExtensionInfo.cbSize := SizeOf(TExtensionInfo);
...;
PasstoDLL(@ExtensionInfo);

How can i manager that buffer in DLL, or isnt necessary to do nothing?

Thanksss :D

Best Regards
Carlos

--

Replies:

www.cryer.info
Managed Newsgroup Archive