home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / INC.PAK / BIVBX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  8.1 KB  |  253 lines

  1. /*  bivbx.h
  2.  
  3.     Defines structs and functions for dealing with VBX controls.
  4.  
  5. */
  6. /*
  7.  *      C/C++ Run Time Library - Version 6.0
  8.  *
  9.  *      Copyright (c) 1993, 1994 by Borland International
  10.  *      All Rights Reserved.
  11.  *      $Revision:   9.15  $
  12.  */
  13.  
  14. #ifndef __BIVBX_H
  15. #define __BIVBX_H
  16.  
  17. #define STRICT
  18. #include <windows.h>
  19.  
  20. #ifdef __cplusplus
  21.   extern "C" {            /* Assume C declarations for C++ */
  22. #endif
  23.  
  24. #include <pshpack1.h>
  25.  
  26. #ifndef __VBX_H
  27.  
  28.   #if ! defined(__DDEML_H) && ! defined(_HSZ_DEFINED)
  29.     #define _HSZ_DEFINED
  30.     typedef LPSTR          HSZ;
  31.   #endif
  32.   typedef unsigned char  ENUM;
  33.   typedef LPVOID         HCTL;
  34.   typedef short          SHORT;
  35.   typedef unsigned short USHORT;
  36.   typedef HANDLE         HFORMFILE;
  37.   typedef USHORT         ERR;
  38.   typedef WORD           HPIC;
  39.   typedef LPVOID         HLSTR;
  40.  
  41.   #ifdef RC_INVOKED
  42.     #define DLGINIT 240
  43.   #else
  44.     #define RT_DLGINIT MAKEINTRESOURCE(240)
  45.   #endif
  46.  
  47. #endif
  48.  
  49. /* VBX Window Messages */
  50. #define WM_VBXFIREEVENT 0x0360
  51.  
  52. /* VBX Event Structure */
  53. typedef struct VBXEVENT {
  54.   HCTL   Control;
  55.   HWND   Window;
  56.   int    ID;
  57.   int    EventIndex;
  58.   LPCSTR EventName;
  59.   int    NumParams;
  60.   LPVOID ParamList;
  61. } VBXEVENT, FAR * LPVBXEVENT, NEAR * NPVBXEVENT;
  62.  
  63. /* macros for accessing event arguments */
  64. #define VBX_EVENTARGNUM(event,type,index) \
  65.   *(((type FAR * FAR *)(event)->ParamList)[(event)->NumParams - (index) - 1])
  66. #define VBX_EVENTARGSTR(event,index) \
  67.   (((HLSTR FAR *)(event)->ParamList)[(event)->NumParams - (index) - 1])
  68.   
  69. /* Initialization */
  70. BOOL      WINAPI VBXInit(HINSTANCE instance, LPCSTR classPrefix);
  71. void      WINAPI VBXTerm(void);
  72. BOOL      WINAPI VBXEnableDLL(HINSTANCE instApp, HINSTANCE instDLL);
  73.  
  74. /* Controls */
  75. HCTL      WINAPI VBXGetHctl(HWND window);
  76. HWND      WINAPI VBXGetHwnd(HCTL control);
  77. HCTL      WINAPI VBXCreate(HWND windowParent, UINT id,
  78.                            LPCSTR library, LPCSTR cls,
  79.                            LPCSTR title, DWORD style,
  80.                            int x, int y, int w, int h,
  81.                            HFORMFILE file);
  82. BOOL      WINAPI VBXMakeDefCtlNameBuf(HCTL hCtl, LPSTR lpszBuf, int nMax);
  83.  
  84. /* Dialogs */
  85. BOOL WINAPI VBXInitDialog(HWND window, HINSTANCE instance, LPSTR id);
  86.  
  87. /* Properties */
  88. #define PTYPE_CSTRING    0x01  /* HSZ */
  89. #define PTYPE_SHORT      0x02  /* short */
  90. #define PTYPE_LONG       0x03  /* LONG */
  91. #define PTYPE_BOOL       0x04  /* BOOL */
  92. #define PTYPE_COLOR      0x05  /* COLORREF or DWORD */
  93. #define PTYPE_ENUM       0x06  /* BYTE */
  94. #define PTYPE_REAL       0x07  /* float */
  95. #define PTYPE_XPOS       0x08  /* LONG (twips) */
  96. #define PTYPE_XSIZE      0x09  /* LONG (twips) */
  97. #define PTYPE_YPOS       0x0A  /* LONG (twips) */
  98. #define PTYPE_YSIZE      0x0B  /* LONG (twips) */
  99. #define PTYPE_PICTURE    0x0C  /* HPIC */
  100. #define PTYPE_BSTRING    0x0D  /* HLSTR */
  101.  
  102. BOOL   WINAPI VBXGetArrayProp(HCTL control, int index, int element, LPVOID value);
  103. BOOL   WINAPI VBXGetArrayPropByName(HCTL control, LPSTR name, int element, LPVOID value);
  104. int    WINAPI VBXGetNumProps(HCTL control);
  105. BOOL   WINAPI VBXGetProp(HCTL control, int index, LPVOID value);
  106. BOOL   WINAPI VBXGetPropByName(HCTL control, LPSTR name, LPVOID value);
  107. int    WINAPI VBXGetPropIndex(HCTL control, LPCSTR name);
  108. int    WINAPI VBXGetPropNameBuf(HCTL control, int index, LPSTR buffer, int len);
  109. USHORT WINAPI VBXGetPropType(HCTL control, int index);
  110. BOOL   WINAPI VBXIsArrayProp(HCTL control, int index);
  111. BOOL   WINAPI VBXSetArrayProp(HCTL control, int index, int element, LONG value);
  112. BOOL   WINAPI VBXSetArrayPropByName(HCTL control, LPSTR name, int element, LONG value);
  113. BOOL   WINAPI VBXSetProp(HCTL control, int index, LONG value);
  114. BOOL   WINAPI VBXSetPropByName(HCTL control, LPSTR name, LONG value);
  115.  
  116. /* Events */
  117. int    WINAPI VBXGetEventIndex(HCTL control, LPCSTR name);
  118. int    WINAPI VBXGetEventNameBuf(HCTL control, int index, LPSTR buffer, int len);
  119. int    WINAPI VBXGetNumEvents(HCTL control);
  120.  
  121. /* Methods */
  122. BOOL   WINAPI VBXMethodAddItem(HCTL control, int index, LPCSTR item);
  123. BOOL   WINAPI VBXMethodClear(HCTL control);
  124. BOOL   WINAPI VBXMethodDrag(HCTL control, int action);
  125. BOOL   WINAPI VBXMethodLinkSend(HCTL control);
  126. BOOL   WINAPI VBXMethodMove(HCTL control, long x, long y, long w, long h);
  127. BOOL   WINAPI VBXMethodRefresh(HCTL control);
  128. BOOL   WINAPI VBXMethodRemoveItem(HCTL control, int item);
  129. BOOL   WINAPI VBXMethodZOrder(HCTL control, int position);
  130.  
  131. /* Pixel/twips conversions */
  132. SHORT  WINAPI VBXTwp2PixY(LONG twips);
  133. SHORT  WINAPI VBXTwp2PixX(LONG twips);
  134. LONG   WINAPI VBXPix2TwpY(SHORT pixels);
  135. LONG   WINAPI VBXPix2TwpX(SHORT pixels);
  136.  
  137. /* Dynamic strings (HSZ) */
  138. HSZ    WINAPI VBXCreateCString(HANDLE segment, LPSTR string);
  139. HSZ    WINAPI VBXDestroyCString(HSZ string);
  140. int    WINAPI VBXGetCStringBuf(HSZ string, LPSTR buffer, int len);
  141. int    WINAPI VBXGetCStringLength(HSZ string);
  142. int    WINAPI VBXLockCStringBuf(HSZ string, LPSTR buffer, int len);
  143. VOID   WINAPI VBXUnlockCString(HSZ string);
  144.        
  145. /* Color properties */
  146. #define COLOR_SYSCOLOR          0x80000000L
  147. #define MAKESYSCOLOR(iColor)    ((COLORREF)((iColor)|COLOR_SYSCOLOR))
  148.  
  149. #ifndef NO_VBX_PICTURES
  150. /* Pictures */
  151. typedef struct PICTURE {
  152.   BYTE Type;
  153.   union {
  154.     struct {
  155.       HBITMAP  Bitmap;
  156.       HPALETTE Palette;
  157.     } Bitmap;
  158.     struct {
  159.       HANDLE Metafile;
  160.       int xExtent;
  161.       int yExtent;
  162.     } Metafile;
  163.     struct {
  164.       HICON Icon;
  165.     } Icon;
  166.   } Data;
  167.   BYTE unused0;
  168.   BYTE unused1;
  169.   BYTE unused2;
  170.   BYTE unused3;
  171. } PICTURE, NEAR * NPPICTURE;
  172.  
  173. #if !defined(NO_VBX_LPPICTURE)
  174. typedef PICTURE FAR* LPPICTURE;
  175. #endif
  176.  
  177. #define PICTURE_EMPTY       0
  178. #define PICTURE_BMP         1
  179. #define PICTURE_META        2
  180. #define PICTURE_ICON        3
  181.  
  182. HPIC   WINAPI VBXCreatePicture(PICTURE FAR* picture);
  183. VOID   WINAPI VBXDestroyPicture(HPIC pic);
  184. HPIC   WINAPI VBXGetPicture(HPIC pic, PICTURE FAR* picture);
  185. ERR    WINAPI VBXGetPictureFromClipboard(HPIC FAR *pic, HANDLE data, WORD format);
  186. HPIC   WINAPI VBXReferencePicture(HPIC pic);
  187. #endif
  188.  
  189. /* Basic language strings (HLSTR) */
  190. HLSTR  WINAPI VBXCreateBasicString(LPVOID buffer, USHORT len);
  191. VOID   WINAPI VBXDestroyBasicString(HLSTR string);
  192. int    WINAPI VBXGetBasicStringBuf(HLSTR string, LPSTR buffer, int len);
  193. USHORT WINAPI VBXGetBasicStringLength(HLSTR string);
  194. ERR    WINAPI VBXSetBasicString(HLSTR far *string, LPVOID buffer, USHORT len);
  195.  
  196. /* Form files */
  197. HFORMFILE WINAPI VBXCreateFormFile(LONG len, LPVOID data);
  198. BOOL      WINAPI VBXDeleteFormFile(HFORMFILE file);
  199.  
  200. /* Errors */
  201. BOOL      WINAPI VBXGetErrorMessage( ERR FAR * lpErr, LPSTR lpszBuf, int nMax );
  202.  
  203. /* Miscellaneous */
  204. BOOL      WINAPI VBXCopy( HCTL hCtl );
  205. BOOL      WINAPI VBXPaste( HCTL hCtl );
  206. HCTL      WINAPI VBXGetDataSourceControl( HCTL hCtl, BOOL FAR * pbIsRegistered );
  207.  
  208. /*
  209.  * obsolete functions - these functions are limited to 16-bit only
  210.  * and should be replaced as follows:
  211.  *
  212.  * Old (16-bit only)          New (16-bit and 32-bit)
  213.  * -----------------          -----------------------
  214.  * VBXGetBasicStringPtr       VBXGetBasicStringBuf
  215.  * VBXGetCStringPtr           VBXGetCStringBuf
  216.  * VBXGetEventName            VBXGetEventNameBuf
  217.  * VBXGetPropName             VBXGetPropNameBuf
  218.  * VBXLockCString             VBXLockCStringBuf
  219.  * VBXGetProp w/ELEMENTSTRUCT VBXGetArrayProp            
  220.  * VBXSetProp w/ELEMENTSTRUCT VBXSetArrayProp
  221.  * VBXMethod                  not supported
  222.  *
  223.  */
  224.  
  225. #if !defined(__FLAT__)
  226.  
  227. LPSTR  WINAPI VBXGetBasicStringPtr(HLSTR string);
  228. LPSTR  WINAPI VBXGetCStringPtr(HSZ string);
  229. LPCSTR WINAPI VBXGetEventName(HCTL control, int index);
  230. LPCSTR WINAPI VBXGetPropName(HCTL control, int index);
  231. LPSTR  WINAPI VBXLockCString(HSZ string);
  232. BOOL   WINAPI VBXMethod(HCTL control, int method, long far * args);
  233.  
  234. typedef struct ELEMENTSTRUCT {
  235.   LONG   Value;
  236.   USHORT NumElems;
  237.   struct {
  238.     USHORT Type;
  239.     LONG   Index;
  240.   } Element[1];
  241. } ELEMENTSTRUCT, FAR * LPELEMENTSTRUCT, NEAR * NPELEMENTSTRUCT;
  242.  
  243. #endif
  244.  
  245. #include <poppack.h>
  246.  
  247. #ifdef __cplusplus
  248.   }
  249. #endif
  250.  
  251. #endif  /* __BIVBX_H */
  252.  
  253.