Hex Artifact Content

Not logged in

Artifact d85b79a6d3b758cc1c3ec922b9e418c1640fa2ab:


0000: 0a 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ./**************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0040: 2a 2a 2a 2a 2a 2a 2a 2a 2a 5c 0a 2a 20 20 20 20  *********\.*    
0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0060: 20 20 20 20 20 20 20 20 20 20 20 20 77 69 6e 64              wind
0070: 65 66 2e 64 20 20 20 20 20 20 20 20 20 20 20 20  ef.d            
0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0090: 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 20     *.*          
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a 2a               *.*
00e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00f0: 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73 20 41         Windows A
0100: 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75 6c 65  PI header module
0110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0120: 20 20 20 20 20 20 20 2a 0a 2a 20 20 20 20 20 20         *.*      
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0170: 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20   *.*            
0180: 20 20 20 20 20 54 72 61 6e 73 6c 61 74 65 64 20       Translated 
0190: 66 72 6f 6d 20 4d 69 6e 47 57 20 57 69 6e 64 6f  from MinGW Windo
01a0: 77 73 20 68 65 61 64 65 72 73 20 20 20 20 20 20  ws headers      
01b0: 20 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 20             *.*  
01c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
01d0: 20 20 20 20 20 20 20 20 20 62 79 20 53 74 65 77           by Stew
01e0: 61 72 74 20 47 6f 72 64 6f 6e 20 20 20 20 20 20  art Gordon      
01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0200: 20 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 20       *.*        
0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a                 *
0250: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .*              
0260: 20 20 20 20 20 20 20 20 20 50 6c 61 63 65 64 20           Placed 
0270: 69 6e 74 6f 20 70 75 62 6c 69 63 20 64 6f 6d 61  into public doma
0280: 69 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20  in              
0290: 20 20 20 20 20 20 20 20 20 2a 0a 5c 2a 2a 2a 2a           *.\****
02a0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02e0: 2a 2a 2a 2f 0a 6d 6f 64 75 6c 65 20 77 69 6e 33  ***/.module win3
02f0: 32 2e 77 69 6e 64 65 66 3b 0a 0a 70 75 62 6c 69  2.windef;..publi
0300: 63 20 69 6d 70 6f 72 74 20 77 69 6e 33 32 2e 77  c import win32.w
0310: 69 6e 6e 74 3b 0a 70 72 69 76 61 74 65 20 69 6d  innt;.private im
0320: 70 6f 72 74 20 77 69 6e 33 32 2e 77 33 32 61 70  port win32.w32ap
0330: 69 3b 0a 0a 63 6f 6e 73 74 20 73 69 7a 65 5f 74  i;..const size_t
0340: 20 4d 41 58 5f 50 41 54 48 20 3d 20 32 36 30 3b   MAX_PATH = 260;
0350: 0a 0a 75 73 68 6f 72 74 20 4d 41 4b 45 57 4f 52  ..ushort MAKEWOR
0360: 44 28 75 62 79 74 65 20 61 2c 20 75 62 79 74 65  D(ubyte a, ubyte
0370: 20 62 29 0a 7b 0a 20 20 20 20 72 65 74 75 72 6e   b).{.    return
0380: 20 63 61 73 74 28 75 73 68 6f 72 74 29 20 28 28   cast(ushort) ((
0390: 62 20 3c 3c 20 38 29 20 7c 20 61 29 3b 0a 7d 0a  b << 8) | a);.}.
03a0: 0a 0a 75 69 6e 74 20 4d 41 4b 45 4c 4f 4e 47 28  ..uint MAKELONG(
03b0: 75 73 68 6f 72 74 20 61 2c 20 75 73 68 6f 72 74  ushort a, ushort
03c0: 20 62 29 0a 7b 0a 20 20 20 20 72 65 74 75 72 6e   b).{.    return
03d0: 20 63 61 73 74 28 75 69 6e 74 29 20 28 28 62 20   cast(uint) ((b 
03e0: 3c 3c 20 31 36 29 20 7c 20 61 29 3b 0a 7d 0a 0a  << 16) | a);.}..
03f0: 0a 75 73 68 6f 72 74 20 4c 4f 57 4f 52 44 28 75  .ushort LOWORD(u
0400: 69 6e 74 20 6c 29 0a 7b 0a 20 20 20 20 72 65 74  int l).{.    ret
0410: 75 72 6e 20 63 61 73 74 28 75 73 68 6f 72 74 29  urn cast(ushort)
0420: 20 6c 3b 0a 7d 0a 0a 0a 75 73 68 6f 72 74 20 48   l;.}...ushort H
0430: 49 57 4f 52 44 28 75 69 6e 74 20 6c 29 0a 7b 0a  IWORD(uint l).{.
0440: 20 20 20 20 72 65 74 75 72 6e 20 63 61 73 74 28      return cast(
0450: 75 73 68 6f 72 74 29 20 28 6c 20 3e 3e 3e 20 31  ushort) (l >>> 1
0460: 36 29 3b 0a 7d 0a 0a 0a 75 62 79 74 65 20 4c 4f  6);.}...ubyte LO
0470: 42 59 54 45 28 75 73 68 6f 72 74 20 77 29 0a 7b  BYTE(ushort w).{
0480: 0a 20 20 20 20 72 65 74 75 72 6e 20 63 61 73 74  .    return cast
0490: 28 75 62 79 74 65 29 20 77 3b 0a 7d 0a 0a 0a 75  (ubyte) w;.}...u
04a0: 62 79 74 65 20 48 49 42 59 54 45 28 75 73 68 6f  byte HIBYTE(usho
04b0: 72 74 20 77 29 0a 7b 0a 20 20 20 20 72 65 74 75  rt w).{.    retu
04c0: 72 6e 20 63 61 73 74 28 75 62 79 74 65 29 20 28  rn cast(ubyte) (
04d0: 77 20 3e 3e 3e 20 38 29 3b 0a 7d 0a 0a 0a 2f 2b  w >>> 8);.}.../+
04e0: 20 74 65 6d 70 6c 61 74 65 20 6d 61 78 28 54 29   template max(T)
04f0: 20 7b 0a 20 20 20 20 54 20 6d 61 78 28 54 20 61   {.    T max(T a
0500: 2c 20 54 20 62 29 0a 20 20 20 20 7b 0a 20 20 20  , T b).    {.   
0510: 20 20 20 20 20 72 65 74 75 72 6e 20 61 20 3e 20       return a > 
0520: 62 20 3f 20 61 20 3a 20 62 3b 0a 20 20 20 20 7d  b ? a : b;.    }
0530: 0a 7d 0a 0a 74 65 6d 70 6c 61 74 65 20 6d 69 6e  .}..template min
0540: 28 54 29 20 7b 0a 20 20 20 20 54 20 6d 69 6e 28  (T) {.    T min(
0550: 54 20 61 2c 20 54 20 62 29 0a 20 20 20 20 7b 0a  T a, T b).    {.
0560: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 61          return a
0570: 20 3c 20 62 20 3f 20 61 20 3a 20 62 3b 0a 20 20   < b ? a : b;.  
0580: 20 20 7d 0a 7d 20 2b 2f 0a 0a 65 6e 75 6d 20 4e    }.} +/..enum N
0590: 55 4c 4c 20 3d 20 6e 75 6c 6c 3b 0a 2f 2f 7e 20  ULL = null;.//~ 
05a0: 61 6c 69 61 73 20 6e 75 6c 6c 20 4e 55 4c 4c 3b  alias null NULL;
05b0: 0a 2f 2f 7e 20 63 6f 6e 73 74 20 76 6f 69 64 20  .//~ const void 
05c0: 20 2a 4e 55 4c 4c 20 3d 20 6e 75 6c 6c 3b 0a 61   *NULL = null;.a
05d0: 6c 69 61 73 20 75 62 79 74 65 20 20 42 59 54 45  lias ubyte  BYTE
05e0: 3b 0a 61 6c 69 61 73 20 75 62 79 74 65 20 2a 50  ;.alias ubyte *P
05f0: 42 59 54 45 2c 20 4c 50 42 59 54 45 3b 0a 61 6c  BYTE, LPBYTE;.al
0600: 69 61 73 20 75 73 68 6f 72 74 20 55 53 48 4f 52  ias ushort USHOR
0610: 54 2c 20 57 4f 52 44 2c 20 41 54 4f 4d 3b 0a 61  T, WORD, ATOM;.a
0620: 6c 69 61 73 20 75 73 68 6f 72 74 2a 50 55 53 48  lias ushort*PUSH
0630: 4f 52 54 2c 20 50 57 4f 52 44 2c 20 4c 50 57 4f  ORT, PWORD, LPWO
0640: 52 44 3b 0a 61 6c 69 61 73 20 75 69 6e 74 20 20  RD;.alias uint  
0650: 20 55 4c 4f 4e 47 2c 20 44 57 4f 52 44 2c 20 55   ULONG, DWORD, U
0660: 49 4e 54 2c 20 43 4f 4c 4f 52 52 45 46 3b 0a 61  INT, COLORREF;.a
0670: 6c 69 61 73 20 75 69 6e 74 20 20 2a 50 55 4c 4f  lias uint  *PULO
0680: 4e 47 2c 20 50 44 57 4f 52 44 2c 20 4c 50 44 57  NG, PDWORD, LPDW
0690: 4f 52 44 2c 20 50 55 49 4e 54 2c 20 4c 50 55 49  ORD, PUINT, LPUI
06a0: 4e 54 3b 0a 61 6c 69 61 73 20 69 6e 74 20 57 49  NT;.alias int WI
06b0: 4e 42 4f 4f 4c 2c 20 42 4f 4f 4c 2c 20 49 4e 54  NBOOL, BOOL, INT
06c0: 2c 20 4c 4f 4e 47 2c 20 48 46 49 4c 45 2c 20 48  , LONG, HFILE, H
06d0: 52 45 53 55 4c 54 3b 0a 61 6c 69 61 73 20 69 6e  RESULT;.alias in
06e0: 74 2a 50 57 49 4e 42 4f 4f 4c 2c 20 4c 50 57 49  t*PWINBOOL, LPWI
06f0: 4e 42 4f 4f 4c 2c 20 50 42 4f 4f 4c 2c 20 4c 50  NBOOL, PBOOL, LP
0700: 42 4f 4f 4c 2c 20 50 49 4e 54 2c 20 4c 50 49 4e  BOOL, PINT, LPIN
0710: 54 2c 20 4c 50 4c 4f 4e 47 3b 0a 61 6c 69 61 73  T, LPLONG;.alias
0720: 20 66 6c 6f 61 74 20 46 4c 4f 41 54 3b 0a 61 6c   float FLOAT;.al
0730: 69 61 73 20 66 6c 6f 61 74 2a 50 46 4c 4f 41 54  ias float*PFLOAT
0740: 3b 0a 61 6c 69 61 73 20 43 50 74 72 21 28 76 6f  ;.alias CPtr!(vo
0750: 69 64 29 20 50 43 56 4f 49 44 2c 20 4c 50 43 56  id) PCVOID, LPCV
0760: 4f 49 44 3b 0a 0a 61 6c 69 61 73 20 55 49 4e 54  OID;..alias UINT
0770: 5f 50 54 52 20 57 50 41 52 41 4d 3b 0a 61 6c 69  _PTR WPARAM;.ali
0780: 61 73 20 4c 4f 4e 47 5f 50 54 52 20 4c 50 41 52  as LONG_PTR LPAR
0790: 41 4d 2c 20 4c 52 45 53 55 4c 54 3b 0a 0a 61 6c  AM, LRESULT;..al
07a0: 69 61 73 20 48 41 4e 44 4c 45 20 48 47 4c 4f 42  ias HANDLE HGLOB
07b0: 41 4c 2c 20 48 4c 4f 43 41 4c 2c 20 47 4c 4f 42  AL, HLOCAL, GLOB
07c0: 41 4c 48 41 4e 44 4c 45 2c 20 4c 4f 43 41 4c 48  ALHANDLE, LOCALH
07d0: 41 4e 44 4c 45 2c 20 48 47 44 49 4f 42 4a 2c 20  ANDLE, HGDIOBJ, 
07e0: 48 41 43 43 45 4c 2c 0a 20 20 20 20 20 20 20 20  HACCEL,.        
07f0: 20 20 20 20 20 48 42 49 54 4d 41 50 2c 20 48 42       HBITMAP, HB
0800: 52 55 53 48 2c 20 48 43 4f 4c 4f 52 53 50 41 43  RUSH, HCOLORSPAC
0810: 45 2c 20 48 44 43 2c 20 48 47 4c 52 43 2c 20 48  E, HDC, HGLRC, H
0820: 44 45 53 4b 2c 20 48 45 4e 48 4d 45 54 41 46 49  DESK, HENHMETAFI
0830: 4c 45 2c 20 48 46 4f 4e 54 2c 0a 20 20 20 20 20  LE, HFONT,.     
0840: 20 20 20 20 20 20 20 20 48 49 43 4f 4e 2c 20 48          HICON, H
0850: 49 4e 53 54 41 4e 43 45 2c 20 48 4b 45 59 2c 20  INSTANCE, HKEY, 
0860: 48 4d 45 4e 55 2c 20 48 4d 45 54 41 46 49 4c 45  HMENU, HMETAFILE
0870: 2c 20 48 4d 4f 44 55 4c 45 2c 20 48 4d 4f 4e 49  , HMODULE, HMONI
0880: 54 4f 52 2c 20 48 50 41 4c 45 54 54 45 2c 20 48  TOR, HPALETTE, H
0890: 50 45 4e 2c 0a 20 20 20 20 20 20 20 20 20 20 20  PEN,.           
08a0: 20 20 48 52 47 4e 2c 20 48 52 53 52 43 2c 20 48    HRGN, HRSRC, H
08b0: 53 54 52 2c 20 48 54 41 53 4b 2c 20 48 57 4e 44  STR, HTASK, HWND
08c0: 2c 20 48 57 49 4e 53 54 41 2c 20 48 4b 4c 2c 20  , HWINSTA, HKL, 
08d0: 48 43 55 52 53 4f 52 3b 0a 61 6c 69 61 73 20 48  HCURSOR;.alias H
08e0: 41 4e 44 4c 45 2a 50 48 4b 45 59 3b 0a 0a 73 74  ANDLE*PHKEY;..st
08f0: 61 74 69 63 0a 0a 69 66 20 28 57 49 4e 56 45 52  atic..if (WINVER
0900: 20 3e 3d 20 30 78 35 30 30 29 0a 7b 0a 20 20 20   >= 0x500).{.   
0910: 20 61 6c 69 61 73 20 48 41 4e 44 4c 45 20 48 54   alias HANDLE HT
0920: 45 52 4d 49 4e 41 4c 2c 20 48 57 49 4e 45 56 45  ERMINAL, HWINEVE
0930: 4e 54 48 4f 4f 4b 3b 0a 7d 0a 0a 61 6c 69 61 73  NTHOOK;.}..alias
0940: 20 65 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 73   extern (Windows
0950: 29 20 69 6e 74 20 66 75 6e 63 74 69 6f 6e 28 29  ) int function()
0960: 20 46 41 52 50 52 4f 43 2c 20 4e 45 41 52 50 52   FARPROC, NEARPR
0970: 4f 43 2c 20 50 52 4f 43 3b 0a 0a 73 74 72 75 63  OC, PROC;..struc
0980: 74 20 52 45 43 54 0a 7b 0a 20 20 20 20 4c 4f 4e  t RECT.{.    LON
0990: 47 20 6c 65 66 74 3b 0a 20 20 20 20 4c 4f 4e 47  G left;.    LONG
09a0: 20 74 6f 70 3b 0a 20 20 20 20 4c 4f 4e 47 20 72   top;.    LONG r
09b0: 69 67 68 74 3b 0a 20 20 20 20 4c 4f 4e 47 20 62  ight;.    LONG b
09c0: 6f 74 74 6f 6d 3b 0a 7d 0a 61 6c 69 61 73 20 52  ottom;.}.alias R
09d0: 45 43 54 20 52 45 43 54 4c 3b 0a 61 6c 69 61 73  ECT RECTL;.alias
09e0: 20 52 45 43 54 2a 50 52 45 43 54 2c 20 4c 50 52   RECT*PRECT, LPR
09f0: 45 43 54 2c 20 50 52 45 43 54 4c 2c 20 4c 50 52  ECT, PRECTL, LPR
0a00: 45 43 54 4c 3b 0a 61 6c 69 61 73 20 43 50 74 72  ECTL;.alias CPtr
0a10: 21 28 52 45 43 54 29 20 4c 50 43 52 45 43 54 2c  !(RECT) LPCRECT,
0a20: 20 4c 50 43 52 45 43 54 4c 3b 0a 0a 73 74 72 75   LPCRECTL;..stru
0a30: 63 74 20 50 4f 49 4e 54 0a 7b 0a 20 20 20 20 4c  ct POINT.{.    L
0a40: 4f 4e 47 20 78 3b 0a 20 20 20 20 4c 4f 4e 47 20  ONG x;.    LONG 
0a50: 79 3b 0a 20 20 20 20 61 6c 69 61 73 20 78 20 65  y;.    alias x e
0a60: 31 3b 0a 20 20 20 20 61 6c 69 61 73 20 79 20 65  1;.    alias y e
0a70: 32 3b 0a 7d 0a 61 6c 69 61 73 20 50 4f 49 4e 54  2;.}.alias POINT
0a80: 20 50 4f 49 4e 54 4c 3b 0a 61 6c 69 61 73 20 50   POINTL;.alias P
0a90: 4f 49 4e 54 2a 50 50 4f 49 4e 54 2c 20 4c 50 50  OINT*PPOINT, LPP
0aa0: 4f 49 4e 54 2c 20 50 50 4f 49 4e 54 4c 2c 20 4c  OINT, PPOINTL, L
0ab0: 50 50 4f 49 4e 54 4c 3b 0a 0a 73 74 72 75 63 74  PPOINTL;..struct
0ac0: 20 53 49 5a 45 0a 7b 0a 20 20 20 20 4c 4f 4e 47   SIZE.{.    LONG
0ad0: 20 63 78 3b 0a 20 20 20 20 4c 4f 4e 47 20 63 79   cx;.    LONG cy
0ae0: 3b 0a 7d 0a 61 6c 69 61 73 20 53 49 5a 45 20 53  ;.}.alias SIZE S
0af0: 49 5a 45 4c 3b 0a 61 6c 69 61 73 20 53 49 5a 45  IZEL;.alias SIZE
0b00: 2a 50 53 49 5a 45 2c 20 4c 50 53 49 5a 45 2c 20  *PSIZE, LPSIZE, 
0b10: 50 53 49 5a 45 4c 2c 20 4c 50 53 49 5a 45 4c 3b  PSIZEL, LPSIZEL;
0b20: 0a 0a 73 74 72 75 63 74 20 50 4f 49 4e 54 53 0a  ..struct POINTS.
0b30: 7b 0a 20 20 20 20 53 48 4f 52 54 20 78 3b 0a 20  {.    SHORT x;. 
0b40: 20 20 20 53 48 4f 52 54 20 79 3b 0a 7d 0a 61 6c     SHORT y;.}.al
0b50: 69 61 73 20 50 4f 49 4e 54 53 2a 50 50 4f 49 4e  ias POINTS*PPOIN
0b60: 54 53 2c 20 4c 50 50 4f 49 4e 54 53 3b 0a 0a 65  TS, LPPOINTS;..e
0b70: 6e 75 6d 20 3a 20 42 4f 4f 4c 20 7b 0a 20 20 20  num : BOOL {.   
0b80: 20 46 41 4c 53 45 20 3d 20 30 2c 0a 20 20 20 20   FALSE = 0,.    
0b90: 54 52 55 45 20 20 3d 20 31 0a 7d 0a              TRUE  = 1.}.