home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************}
- { }
- { Delphi Visual Component Library }
- { }
- { Copyright (c) 1995 Borland International }
- { }
- {*******************************************************}
-
- { bivbx.pas
- Defines structs and functions for dealing with VBX controls. }
-
- unit BIVBX;
-
- interface
-
- uses Messages, WinTypes;
-
- type
- { VBX Base Types }
- Err = Word;
- HPic = 0..65535;
- HSZ = ^Char;
- HLStr = ^Word;
- HCTL = ^Byte;
- HFormFile = THandle;
-
- { VBX Event Structure }
- PVBXEvent = ^TVBXEvent;
- TVBXEvent = record
- Control: HCTL;
- Window: HWND;
- ID: Integer;
- EventIndex: Integer;
- EventName: PChar;
- NumParams: Integer;
- ParamList: Pointer;
- end;
-
- PEventInfo = ^TEventInfo;
- TEventInfo = record
- Name: Word;
- cParms: Word;
- cwParms: Word;
- ParmTypes: Word;
- ParmProf: Word;
- Flags: Longint;
- end;
-
- PPropInfo = ^TPropInfo;
- TPropInfo = record
- Name: Word;
- Flags: Longint;
- offsetData: Byte;
- infoData: Byte;
- dataDefault: Longint;
- ByteList: Word;
- ByteMax: Byte;
- end;
-
- TWMVBXFireEvent = record
- Msg: Cardinal;
- Unused: Word;
- VBXEvent: PVBXEvent;
- Result: Longint;
- end;
-
- TBmp = record
- hBmp: HBITMAP;
- hpal: HPALETTE;
- end;
-
- TWmf = record
- hmeta: THandle;
- xExt, yExt: Integer;
- end;
-
- TIcn = record
- hicon: HICON;
- end;
-
- TPicData = record
- case Byte of
- 0: (bmp: TBmp);
- 1: (wmf: TWmf);
- 2: (icon: TIcn)
- end;
-
- PVBPicture = ^TVBPicture;
- TVBPicture = record
- picType: Byte;
- picData: TPicData;
- picReserved: array[0..3] of Byte;
- end;
-
- TArrayRec = record
- DataType: Word; { Type of element (Must be PTYPE_SHORT) }
- Index: Longint; { Index of array element }
- end;
-
- PElementStruct = ^TElementStruct;
- TElementStruct = record
- Value: Longint; { Value to be transfered }
- NumElems: Word; { Number of elements }
- Element: array[0..0] of TArrayRec;
- end;
-
- TVBXType = (vbxInteger, vbxLong, vbxSingle, vbxDouble, vbxControl, vbxForm,
- vbxString, vbxCurrency, vbxUnknown, vbxSelf);
-
- const
- PICTURE_NONE = 0;
- PICTURE_BITMAP = 1;
- PICTURE_METAFILE = 2;
- PICTURE_ICON = 3;
-
- PICTURE_INVALID = $FFFF;
- PICTURE_NULL = 0;
-
- PTYPE_CSTRING = $01; { HSZ }
- PTYPE_SHORT = $02; { short }
- PTYPE_LONG = $03; { LONG }
- PTYPE_BOOL = $04; { BOOL }
- PTYPE_COLOR = $05; { COLORREF or DWORD }
- PTYPE_ENUM = $06; { BYTE }
- PTYPE_REAL = $07; { float }
- PTYPE_XPOS = $08; { LONG (twips) }
- PTYPE_XSIZE = $09; { LONG (twips) }
- PTYPE_YPOS = $0A; { LONG (twips) }
- PTYPE_YSIZE = $0B; { LONG (twips) }
- PTYPE_PICTURE = $0C; { HPIC }
- PTYPE_BSTRING = $0D; { HLSTR }
-
- { Initialization }
- function VBXInit(hInst: THandle; Prefix: PChar): Bool;
- function VBXInitHost(hInst: THandle; Prefix: PChar; uMode: Word; Title: PChar;
- HelpFile: PChar; Flags: Longint): Bool;
- procedure VBXTerm;
- function VBXEnableDLL(InstApp: THandle; InstDLL: THandle): Bool;
- function VBXSetWndProc(lpfnWndProc: TFarProc): TFarProc;
- function VBXGetDialogParent: HWND;
- function VBXSetDialogParent(Wnd: HWND): HWND;
- function VBXLoadVBX(lpszFile: PChar): Pointer;
- function VBXCtrlWndProc(Wnd: HWND; wMsg: Word; wParam: Word; lParam: Longint): Longint;
-
- { Controls }
- function VBXAllocControl(lpszClassName: PChar): HCTL;
- function VBXGetHctl(Wnd: HWND): HCTL;
- function VBXGetHwnd(Ctl: HCTL): HWND;
- function VBXCreate(hWndParent: HWND; ID: Word; lpszDLL, lpszClass,
- lpszTitle: PChar; dwStyle: Longint; x, y, cx, cy, hFile: Integer): HCTL;
- function VBXCreateEx(hWndParent: HWND; ID: Word; lpszDLL, lpszClass,
- lpszTitle: PChar; dwStyle: Longint; x, y, cx, cy, hFile: Integer;
- lpfnWndProc: TFarProc): HCTL;
- procedure VBXDestroyControl(Ctl: HCTL);
- function VBXInitControlEx(Ctl: HCTL; hWndParent: HWND; lpszCaption: PChar;
- dwStyle: Longint; const Rect: TRect; wID: Word; hF: HFormFile;
- lpfnWndProc: TFarProc): Err;
-
- { Dialogs }
- function VBXInitDialog(Wnd: HWND; hInst: THandle; lpID: PChar): Bool;
-
- { Properties }
- function VBXGetArrayProp(Ctl: HCTL; Index, Element: Integer;
- var Value: Longint): Bool;
- function VBXSetArrayProp(Ctl: HCTL; Index, Element: Integer;
- Value: Longint): Bool;
- function VBXGetNumProps(Ctl: HCTL): Integer;
- function VBXGetProp(Ctl: HCTL; iProp: Integer; lpValue: Pointer): Bool;
- function VBXGetPropByName(Ctl: HCTL; lpszName: PChar; lpValue: Pointer): Err;
- function VBXGetPropIndex(Ctl: HCTL; lpszName: PChar): Integer;
- function VBXGetPropName(Ctl: HCTL; iProp: Integer): PChar;
- function VBXIsArrayProp(Ctl: HCTL; iProp: Integer): Bool;
- function VBXSetProp(Ctl: HCTL; iProp: Integer; lValue: Longint): Bool;
- function VBXSetPropByName(Ctl: HCTL; lpszName: PChar; lVal: Longint): Err;
- function VBXGetPropInfo(Ctl: HCTL; iProp: Integer): Pointer;
- function VBXGetStdPropIndex(Ctl: HCTL; iProp: Integer): Integer;
- function VBXGetPropText(Ctl: HCTL; iProp: Integer): HSZ;
- function VBXGetIndexOfStdProp(Ctl: HCTL; iStdProp: Integer): Integer;
- function VBXGetArrayPropByName(Ctl: HCTL; Name: PChar; Element: Integer;
- var Value: Longint): Bool;
- function VBXSetArrayPropByName(Ctl: HCTL; Name: PChar; Element: Integer;
- Value: Longint): Bool;
-
- { Events }
- function VBXGetEventIndex(Ctl: HCTL; lpszName: PChar): Integer;
- function VBXGetEventName(Ctl: HCTL; iEvent: Integer): PChar;
- function VBXGetNumEvents(Ctl: HCTL): Integer;
- function VBXGetEventInfo(Ctl: HCTL; iEvent: Integer): Pointer;
-
- { methods }
- function VBXMethod(Ctl: HCTL; iMethod: Integer; var lpArgs: Longint): Bool;
- function VBXMethodAddItem(Ctl: HCTL; iItem: Integer; item: PChar): Bool;
- function VBXMethodDrag(Ctl: HCTL; iAction: Integer): Bool;
- function VBXMethodMove(Ctl: HCTL; x, y, w, h: Longint): Bool;
- function VBXMethodRefresh(Ctl: HCTL): Bool;
- function VBXMethodRemoveItem(Ctl: HCTL; iItem: Integer): Bool;
-
- { dynamic strings (HSZ) }
- function VBXCreateCString(Seg: THandle; lpszString: PChar): HSZ;
- function VBXGetCStringPtr(AHsz: HSZ): PChar;
- function VBXDestroyCString(AHsz: HSZ): HSZ;
- function VBXLockCString(AHsz: HSZ): HSZ;
- procedure VBXUnlockCString(AHsz: HSZ);
-
- { Basic language strings (HLSTR) }
- function VBXCreateBasicString(pb: Pointer; cbLen: Word): HLSTR;
- function VBXGetBasicStringPtr(Ahlstr: HLSTR): PChar;
- procedure VBXDestroyBasicString(Ahlstr: HLSTR);
- function VBXGetBasicStringLength(Ahlstr: HLSTR): Word;
- function VBXSetBasicString(var Ahlstr: HLSTR; pb: Pointer; cbLen: Word): Err;
-
- { pixel/twips conversions }
- function VBXTwp2PixY(Twips: Longint): Integer;
- function VBXTwp2PixX(Twips: Longint): Integer;
- function VBXPix2TwpY(Pixels: Integer): Longint;
- function VBXPix2TwpX(Pixels: Integer): Longint;
-
- { pictures }
- function VBXCreatePicture(const APic: TVBPicture): HPic;
- procedure VBXDestroyPicture(APic: HPic);
- function VBXGetPicture(APic: HPic; var APic: TVBPicture): HPic;
- function VBXGetPictureFromClipboard(var APic: HPic; hData: THandle; wFormat: Word): Err;
- function VBXReferencePicture(APic: HPic): HPic;
- function VBXGetPicFromFile(var APic: TVBPicture; PicFile: PChar): Err;
-
- { Form file io }
- function VBXCreateFormFile(lLength: Longint; pData: Pointer): HFormFile;
- function VBXSaveProperties(Ctl: HCTL): HFormFile;
- function VBXGetFormFileLength(hF: HFormFile): Longint;
- function VBXDeleteFormFile(hF: HFormFile): Bool;
- function VBXWriteProp(Ctl: HCTL; hF: HFormFile; index: Integer): Err;
-
- implementation
-