home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Shareware (Platinum Edition) / QUEPLAT95.ISO / files / programm / tpw32_10 / w32types.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-11-15  |  7.9 KB  |  289 lines

  1. Unit W32Types;
  2. { FILE: W32TYPES.PAS
  3.  
  4.  Purpose:
  5.  This unit implements some data types/structures for Win32 API programming
  6.  using BPW 7.x and/or Delphi. The main unit of this package (TPW32.PAS)
  7.  uses these data types/structures
  8.  
  9.  Okay, so the data types contain my own interpretations (and some of
  10.  Christian Ghisler and Claus Ziegler's interpretations) of the C data
  11.  structures used in MS documentation of the Win32 API. These
  12.  interpretations may or may not suit you. They work for me, but your
  13.  mileage may vary.
  14.  
  15.  History:
  16.  November 15 1995: 1st version by Dr A Olowofoyeku (the African Chief)
  17. }
  18.  
  19. interface
  20. {$F+}
  21. Uses WinDos;
  22.  
  23. {********* Win3232 types ***************}
  24. {some general constants}
  25. Const
  26. Infinite=Longint($FFFFFFFF);
  27. Invalid_Handle_Value=Longint(-1);
  28. Invalid_Handle=Invalid_Handle_Value;
  29.  
  30. {/////////////////////////////////////////////////////////}
  31. Const
  32. { drive types }
  33. Drive_Unknown  = 0;
  34. Drive_NotExist = 1;
  35. Drive_Removable= 2;
  36. Drive_Fixed    = 3;
  37. Drive_Remote   = 4;
  38. Drive_CDROM    = 5;
  39. Drive_RamDISK  = 6;
  40.  
  41. DriveTypes:array[0..6] of pchar=
  42. ('Unknown','Invalid','Removeable','Fixed','Network','CDROM','Ram');
  43.  
  44. {/////////////////////////////////////////////////////////}
  45. { file types }
  46. Const
  47. File_Type_Unknown = $0000;
  48. File_Type_Disk    = $0001;
  49. File_Type_Char    = $0002;
  50. File_Type_Pipe    = $0003;
  51.  
  52. {/////////////////////////////////////////////////////////}
  53. {file modes }
  54. Const
  55. Generic_Read      = Longint($80000000);
  56. Generic_Write     = Longint($40000000);
  57. File_Share_Read   = $00000001;
  58. File_Share_Write  = $00000002;
  59.  
  60. Create_New        = 1;
  61. Create_Always     = 2;
  62. Open_Existing     = 3;
  63. Open_Always       = 4;
  64. Truncate_Existing = 5;
  65.  
  66. {/////////////////////////////////////////////////////////}
  67. { file attributes }
  68. Const
  69. File_Attribute_ReadOnly       = $00000001;
  70. File_Attribute_Hidden         = $00000002;
  71. File_Attribute_System         = $00000004;
  72. File_Attribute_Directory      = $00000010;
  73. File_Attribute_Archive        = $00000020;
  74. File_Attribute_Normal         = $00000080;
  75. File_Attribute_Temporary      = $00000100;
  76. File_Attribute_Atomic_Write   = $00000200;
  77. File_Attribute_XAction_Write  = $00000400;
  78.  
  79. {/////////////////////////////////////////////////////////}
  80. {processes}
  81. Const
  82.   DEBUG_PROCESS           = $000000001;
  83.   DEBUG_ONLY_THIS_PROCESS = $000000002;
  84.   CREATE_SUSPENDED        = $000000004;
  85.   DETACHED_PROCESS        = $000000008;
  86.   CREATE_NEW_CONSOLE      = $000000010;
  87.   NORMAL_PRIORITY_CLASS   = $000000020;
  88.   IDLE_PRIORITY_CLASS     = $000000040;
  89.   HIGH_PRIORITY_CLASS     = $000000080;
  90.   REALTIME_PRIORITY_CLASS = $000000100;
  91.   CREATE_NEW_PROCESS_GROUP= $000000200;
  92.   CREATE_NO_WINDOW        = $008000000;
  93.  
  94.  
  95. {/////////////////////////////////////////////////////////}
  96. {file dialogs}
  97. const
  98.   ofn_ReadOnly             = $00000001;
  99.   ofn_OverWritePrompt      = $00000002;
  100.   ofn_HideReadOnly         = $00000004;
  101.   ofn_NoChangeDir          = $00000008;
  102.   ofn_ShowHelp             = $00000010;
  103.   ofn_EnableHook           = $00000020;
  104.   ofn_EnableTemplate       = $00000040;
  105.   ofn_EnableTemplateHandle = $00000080;
  106.   ofn_NoValidate           = $00000100;
  107.   ofn_AllowMultiSelect     = $00000200;
  108.   ofn_ExtentionDifferent   = $00000400;
  109.   ofn_PathMustExist        = $00000800;
  110.   ofn_FileMustExist        = $00001000;
  111.   ofn_CreatePrompt         = $00002000;
  112.   ofn_ShareAware           = $00004000;
  113.   ofn_NoReadOnlyReturn     = $00008000;
  114.   ofn_NoTextFileCreate     = $00010000;
  115. {///////////////////////////////}
  116. {status}
  117. Const
  118.   STATUS_WAIT_0           = $00000000;
  119.   STATUS_ABANDONED_WAIT_0 = $00000080;
  120.   STATUS_USER_APC         = $000000C0;
  121.   STATUS_TIMEOUT          = $00000102;
  122.   STATUS_PENDING          = $00000103;
  123.   STILL_ACTIVE            = STATUS_PENDING;
  124. {/////////////////////////////////////////////////////////}
  125. {/////////////////////////////////////////////////////////}
  126. {/////////////////////////////////////////////////////////}
  127. {general Win32 types}
  128. type
  129.   Handle   = Longint;
  130.   W32Handle= Longint;
  131.   DWORD    = Longint;
  132.   longfile = longint;
  133.   LRESULT  = LONGINT;
  134.   UINT     = Word;
  135.   HKEY     = Handle;
  136.   W32HWnd  = Handle; {Don't want to tamper with Wintypes.HWnd itself}
  137. {/////////////////////////////////////////////////////////}
  138. {beziers}
  139. Type
  140.     Tagpoint=array[0..3] of record
  141.     x,y:longint;
  142. end;
  143. {/////////////////////////////////////////////////////////}
  144. {file finding}
  145.   type
  146.   tFILETIME=
  147.   record
  148.     dwLowDateTime,
  149.     dwHighDateTime:longint;
  150.   end;
  151.   pFILETIME=^tFILETIME;
  152.  
  153. {WIN32_FIND_DATA structure: for Win32 Findfirst and Findnext functions}
  154. type
  155.   WIN32_FIND_DATA=record
  156.     dwFileAttributes:longint;
  157.     ftCreationTime,
  158.     ftLastAccessTime,
  159.     ftLastWriteTime:tFileTime{array[0..1] of longint};
  160.     nFileSizeHigh,
  161.     nFileSizeLow,
  162.     dwReserved0,
  163.     dwReserved1:longint;
  164.     cFileName:array[0..259] of char;         {long filename}
  165.     cAlternateFileName:array[0..13] of char; {short filename}
  166.   end;
  167.   pWIN32_FIND_DATA=^WIN32_FIND_DATA;
  168.  
  169.  Type
  170.   tSYSTEMTIME=record
  171.     Year,
  172.     Month,
  173.     DayOfWeek,
  174.     Day,
  175.     Hour,
  176.     Min,
  177.     Sec,
  178.     Milliseconds:word;
  179.   end;
  180. {/////////////////////////////////////////////////////////}
  181. {processes}
  182. Type
  183.   tStartupInfo=record
  184.     cb:longint;
  185.     lpReserved,
  186.     lpDesktop,
  187.     lpTitle:pchar;
  188.     dwX,
  189.     dwY,
  190.     dwXSize,
  191.     dwYSize,
  192.     dwXCountChars,
  193.     dwYCountChars,
  194.     dwFillAttribute,
  195.     dwFlags:longint;
  196.     wShowWindow,
  197.     cbReserved2:word;
  198.     lpReserved2:^byte;
  199.     hStdInput,
  200.     hStdOutput,
  201.     hStdError:longint;
  202.   end;
  203.  
  204.   Type
  205.   PROCESS_INFORMATION=record
  206.     hProcess,
  207.     hThread,
  208.     dwProcessId,
  209.     dwThreadId:longint;
  210.   end;
  211.  
  212. {/////////////////////////////////////////////////////////}
  213. {memory}
  214. Type
  215.  MemoryStatus=Record
  216.      dwLength:longint;
  217.      dwMemoryLoad:longint;
  218.      dwTotalPhys:longint;
  219.      dwAvailPhys:longint;
  220.      dwTotalPageFile:longint;
  221.      dwAvailPageFile:longint;
  222.      dwTotalVirtual:longint;
  223.      dwAvailVirtual:longint;
  224.  End;
  225. {/////////////////////////////////////////////////////////}
  226. {Hooks}
  227. Type
  228. T32HookProc=function(Wnd: W32HWnd; Msg, wParam: Longint; lParam: Longint): Longint;
  229.  
  230. Type
  231. HHook = Longint;
  232. T32EventMsg=Record   {EventMsg record for hook functions}
  233.    Message : Uint;
  234.    ParamL  : Uint;
  235.    ParamH  : Uint;
  236.    Time    : Longint;
  237. End;
  238. {/////////////////////////////////////////////////////////}
  239. {file dialogs; doesn't work!}
  240. Type
  241. T32OpenFilename = record
  242.   lStructSize: Longint;
  243.   hWndOwner: W32HWnd;
  244.   hInstance: Handle;
  245.   lpstrFilter: PChar;
  246.   lpstrCustomFilter: PChar;
  247.   nMaxCustFilter: Longint;
  248.   nFilterIndex: Longint;
  249.   lpstrFile: PChar;
  250.   nMaxFile: Longint;
  251.   lpstrFileTitle: PChar;
  252.   nMaxFileTitle: Longint;
  253.   lpstrInitialDir: PChar;
  254.   lpstrTitle: PChar;
  255.   Flags: Longint;
  256.   nFileOffset: Longint;
  257.   nFileExtension: Longint;
  258.   lpstrDefExt: PChar;
  259.   lCustData: Longint;
  260.   lpfnHook: T32HookProc;
  261.   lpTemplateName: PChar;
  262. end;
  263. {/////////////////////////////////////////////////////////}
  264. {My own SearchRec-like record for 32-bit file functions;
  265.  externally mimics WinDos.Tsearchrec; but has long filename support}
  266. Type
  267. T32SearchRec=Record
  268.     Attr:  Longint;               {the file's attributes}
  269.     Time:  Longint;
  270.     Size:  Longint;
  271.     Name:  array[0..13] of Char;  {the short filename}
  272.     lName: Array[0..259] of char; {the long file name; or copy of short name in Win16}
  273.     lDateTime : WinDos.TDateTime;
  274.     hHandle   : longint;    {the record's 32-bit handle; don't ever change this!}
  275.     hAttrib   : longint;    {attribute passed to W32findfirst(); don't ever change this!}
  276.     tSs       : TSearchRec; {holds a TSearchRec for 16 bit compatibility}
  277. end;
  278.  
  279. Type
  280. T32FileProc=Procedure(Var sR:T32SearchRec);
  281. {procedural type for my LocateFiles() function}
  282. {/////////////////////////////////////////////////////////}
  283. {/////////////////////////////////////////////////////////}
  284. implementation
  285.  
  286. End.
  287.  
  288. {November 15 1995, Dr A Olowofoyeku}
  289.