Board index » delphi » Win32 API definitions in Delphi

Win32 API definitions in Delphi

Hi,

I would like to know if the record WIN32_FIND_DATA used in FindFirstFile
and FindNextFile API functions is declared in a Delphi unit and if so, in
which? And, while we're at it, is HANDLE a declared type in Delphi, in some
unit? I thought it would be in Windows (WinTypes), but the compiler doesn't
recognizes this type. Please understand that I have Delphi Desktop, so I
don't have the sources of the Delphi units (biggest computer-related error
of my life -- watch me when D3 comes out!).

Thanks for the help and please reply by e-mail.
--
Martin Angers
============================
Let's keep knowledge sharing
one of the few remainings of the
human generosity.

 

Re:Win32 API definitions in Delphi


Quote
Martin Angers wrote:

> Hi,

> I would like to know if the record WIN32_FIND_DATA used in FindFirstFile
> and FindNextFile API functions is declared in a Delphi unit and if so, in
> which? And, while we're at it, is HANDLE a declared type in Delphi, in some
> unit? I thought it would be in Windows (WinTypes), but the compiler doesn't
> recognizes this type.

All are defined in the Windows unit. HANDLE is called THandle to not
confuse it with TWinControl.Handle.

M.

PS. Heavy crossposting reduced somewhat.

--
Martin Larsson, author of several unknown utilities for DOS and Windows.
mailto:martin.lars...@delfi-data.msmail.telemax.no
http://www.delfidata.no/users/~martin
X.400:G=martin;S=larsson;O=delfi-data;P=msmail;A=telemax;C=no

Re:Win32 API definitions in Delphi


On 11 Sep 1996 23:54:54 GMT, "Martin Angers" <m...@mediom.qc.ca> wrote:

Quote
>I would like to know if the record WIN32_FIND_DATA used in FindFirstFile
>and FindNextFile API functions is declared in a Delphi unit and if so, in
>which? And, while we're at it, is HANDLE a declared type in Delphi, in some
>unit? I thought it would be in Windows (WinTypes), but the compiler doesn't
>recognizes this type. Please understand that I have Delphi Desktop, so I
>don't have the sources of the Delphi units (biggest computer-related error
>of my life -- watch me when D3 comes out!).

The record is declared in the Windows unit, but the name is
TWin32FindData. Unfortunately, Borland changed many of the type names
when converting from C to Pascal, and the only way to know the true
names is to read the source code. Fortunately, you have the source
code for the Windows unit, even though you have the Desktop edition.
Look in the Source\Rtl\Win directory.

The type THandle (note the T) is also declared in Windows.
--
Ray Lischner, Author of Secrets of Delphi 2 (Waite Group Press)
Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

Re:Win32 API definitions in Delphi


I believe that there is a type HWnd, which is used to store Handles.

As far as for the Win32_find_data record, it is defined in Delphi as:

  TWin32FindDataA = record
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
    dwReserved0: DWORD;
    dwReserved1: DWORD;
    cFileName: array[0..MAX_PATH - 1] of AnsiChar;
    cAlternateFileName: array[0..13] of AnsiChar;
  end;
  TWin32FindDataW = record
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
    dwReserved0: DWORD;
    dwReserved1: DWORD;
    cFileName: array[0..MAX_PATH - 1] of WideChar;
    cAlternateFileName: array[0..13] of WideChar;
  end;
  TWin32FindData = TWin32FindDataA;

The *A record is for short strings, the *W record is for long strings.
But, it's there for use. :)

BTW, you can buy the source from Borland, if you can't wait for D3.
But, sounds like you already realize how helpful it is to have the
source handy. :)

Ed

Quote
"Martin Angers" <m...@mediom.qc.ca> wrote:
>Hi,
>I would like to know if the record WIN32_FIND_DATA used in FindFirstFile
>and FindNextFile API functions is declared in a Delphi unit and if so, in
>which? And, while we're at it, is HANDLE a declared type in Delphi, in some
>unit? I thought it would be in Windows (WinTypes), but the compiler doesn't
>recognizes this type. Please understand that I have Delphi Desktop, so I
>don't have the sources of the Delphi units (biggest computer-related error
>of my life -- watch me when D3 comes out!).
>Thanks for the help and please reply by e-mail.
>--
>Martin Angers
>============================
>Let's keep knowledge sharing
>one of the few remainings of the
>human generosity.

Re:Win32 API definitions in Delphi


In article <3237C009.4...@delfi-data.msmail.telemax.no>,
   Martin Larsson <martin.lars...@delfi-data.msmail.telemax.no> wrote:

Quote
>Martin Angers wrote:

>> Hi,

>> I would like to know if the record WIN32_FIND_DATA used in
>> FindFirstFile and FindNextFile API functions is declared in a Delphi
>> unit and if so, in which? And, while we're at it, is HANDLE a declared
>> type in Delphi, in some unit? I thought it would be in Windows
>> (WinTypes), but the compiler doesn't recognizes this type.

WIN32_FIND_DATA is defined as TWin32FindData (the pointer equivalent
is defined as PWin32FindData and the DBCS version is TWin32FindDataW)

A good hint to finding the equivalents of C/C++ Win SDK types in
Delphi is to remove all underlines, capitalize only each part of
the identifier, and stick a T in front of it.

Constants are typically named the same.

Quote
>All are defined in the Windows unit. HANDLE is called THandle to not
>confuse it with TWinControl.Handle.

>M.

  --=- Ritchie A.

Re:Win32 API definitions in Delphi


On 11 Sep 1996 23:54:54 GMT, "Martin Angers" <m...@mediom.qc.ca> wrote:

Quote
>Hi,

Hi Martin,
In response to your questions.
Quote

>I would like to know if the record WIN32_FIND_DATA used in FindFirstFile
>and FindNextFile API functions is declared in a Delphi unit and if so, in
>which?

This structure is defined by Delphi as TWin32FindData in the Windows
unit. Members of the structure are as follows :
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
    dwReserved0: DWORD;
    dwReserved1: DWORD;
    cFileName: array[0..MAX_PATH - 1] of AnsiChar;
    cAlternateFileName: array[0..13] of AnsiChar;

Quote
> And, while we're at it, is HANDLE a declared type in Delphi, in some
>unit? I thought it would be in Windows (WinTypes), but the compiler doesn't
>recognizes this type. Please understand that I have Delphi Desktop, so I
>don't have the sources of the Delphi units (biggest computer-related error
>of my life -- watch me when D3 comes out!).

Handle is not a declare type in Delphi. What you need to use is
THandle

Quote
>Thanks for the help and please reply by e-mail.
>--
>Martin Angers
>============================

Best of Luck

Martin Cully
cully.mar...@a1.siog.dbo.mts.dec.com

Quote
>Let's keep knowledge sharing
>one of the few remainings of the
>human generosity.

Other Threads