home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / BOLEUI.PAK / COMMON.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  6KB  |  172 lines

  1. //
  2. /*
  3.  * COMMON.H
  4.  *
  5.  * Structures and definitions applicable to all OLE 2.0 UI dialogs.
  6.  *
  7.  */
  8.  
  9. /*
  10.  *      C/C++ Run Time Library - Version 6.5
  11.  *
  12.  *      Copyright (c) 1994 by Borland International
  13.  *      All Rights Reserved.
  14.  *
  15.  */
  16.  
  17. #ifndef _COMMON_H_
  18. #define _COMMON_H_
  19.  
  20.  
  21. //Macros to handle control message packing between Win16 and Win32
  22. #ifdef WIN32
  23.  
  24. #ifndef COMMANDPARAMS
  25. #define COMMANDPARAMS(wID, wCode, hWndMsg)                          \
  26.     WORD        wID     = LOWORD(wParam);                           \
  27.     WORD        wCode   = HIWORD(wParam);                           \
  28.     HWND        hWndMsg = (HWND)(UINT)lParam;
  29. #endif  //COMMANDPARAMS
  30.  
  31. #ifndef SendCommand
  32. #define SendCommand(hWnd, wID, wCode, hControl)                     \
  33.             SendMessage(hWnd, WM_COMMAND, MAKELONG(wID, wCode)      \
  34.                         , (LPARAM)hControl)
  35. #endif  //SendCommand
  36.  
  37. #else   //Start !WIN32
  38.  
  39. #ifndef COMMANDPARAMS
  40. #define COMMANDPARAMS(wID, wCode, hWndMsg)                          \
  41.     WORD        wID     = LOWORD(wParam);                           \
  42.     WORD        wCode   = HIWORD(lParam);                           \
  43.     HWND        hWndMsg = (HWND)(UINT)lParam;
  44. #endif  //COMMANDPARAMS
  45.  
  46. #ifndef SendCommand
  47. #define SendCommand(hWnd, wID, wCode, hControl)                     \
  48.             SendMessage(hWnd, WM_COMMAND, wID                       \
  49.                         , MAKELONG(hControl, wCode))
  50. #endif  //SendCommand
  51.  
  52. #endif  //
  53.  
  54.  
  55.  
  56. //Property labels used to store dialog structures and fonts
  57. #define STRUCTUREPROP       "Structure"
  58. #define FONTPROP            "Font"
  59.  
  60.  
  61. /*
  62.  * Standard structure for all dialogs.  This commonality lets us make
  63.  * a single piece of code that will validate this entire structure and
  64.  * perform any necessary initialization.
  65.  */
  66.  
  67. typedef struct tagOLEUISTANDARD
  68.     {
  69.     //These IN fields are standard across all OLEUI dialog functions.
  70.     DWORD           cbStruct;       //Structure Size
  71.     DWORD           dwFlags;        //IN-OUT:  Flags
  72.     HWND            hWndOwner;      //Owning window
  73.     LPCSTR          lpszCaption;    //Dialog caption bar contents
  74.     LPFNOLEUIHOOK   lpfnHook;       //Hook callback
  75.     LPARAM          lCustData;      //Custom data to pass to hook
  76.     HINSTANCE       hInstance;      //Instance for customized template name
  77.     LPCSTR          lpszTemplate;   //Customized template name
  78.     HRSRC           hResource;      //Customized template handle
  79.  
  80.     DWORD           dwIBApplication;  //Bolero app ptr for help
  81.     HHOOK           hHook;            //Bolero F1 hook
  82.     HTASK           hTask;            //Bolero task for F1 hook
  83.     } OLEUISTANDARD, *POLEUISTANDARD, FAR *LPOLEUISTANDARD;
  84.  
  85.  
  86.  
  87. //Function prototypes
  88. //COMMON.C
  89. UINT  WINAPI  UStandardValidation(const LPOLEUISTANDARD, const UINT, const HGLOBAL FAR *);
  90. UINT  WINAPI  UStandardInvocation(DLGPROC, LPOLEUISTANDARD, HGLOBAL, LPCSTR);
  91. LPVOID WINAPI LpvStandardInit(HWND, UINT, BOOL, HFONT FAR *);
  92. LPVOID WINAPI LpvStandardEntry(HWND, UINT, WPARAM, LPARAM, UINT FAR *);
  93. UINT WINAPI   UStandardHook(LPVOID, HWND, UINT, WPARAM, LPARAM);
  94. void WINAPI   StandardCleanup(LPVOID, HWND);
  95. void WINAPI   StandardShowDlgItem(HWND hDlg, int idControl, int nCmdShow);
  96.  
  97. //DRAWICON.C
  98.  
  99. //Structure for label and source extraction from a metafile
  100. typedef struct tagLABELEXTRACT
  101.     {
  102.     LPSTR       lpsz;
  103.     UINT        Index;      // index in lpsz (so we can retrieve 2+ lines)
  104.     DWORD       PrevIndex;  // index of last line (so we can mimic word wrap)
  105.  
  106.     union
  107.         {
  108.         UINT    cch;        //Length of label for label extraction
  109.         UINT    iIcon;      //Index of icon in source extraction.
  110.         } u;
  111.  
  112.     //For internal use in enum procs
  113.     BOOL        fFoundIconOnly;
  114.     BOOL        fFoundSource;
  115.     BOOL        fFoundIndex;
  116.     } LABELEXTRACT, FAR * LPLABELEXTRACT;
  117.  
  118.  
  119. //Structure for extracting icons from a metafile (CreateIcon parameters)
  120. typedef struct tagICONEXTRACT
  121.     {
  122.     HICON       hIcon;          //Icon created in the enumeration proc.
  123.  
  124.     /*
  125.      * Since we want to handle multitasking well we have the caller
  126.      * of the enumeration proc instantiate these variables instead of
  127.      * using statics in the enum proc (which would be bad).
  128.      */
  129.     BOOL        fAND;
  130.     HGLOBAL     hMemAND;        //Enumeration proc allocates and copies
  131.     } ICONEXTRACT, FAR * LPICONEXTRACT;
  132.  
  133.  
  134. //Structure to use to pass info to EnumMetafileDraw
  135. typedef struct tagDRAWINFO
  136.     {
  137.     RECT     Rect;
  138.     BOOL     fIconOnly;
  139.     } DRAWINFO, FAR * LPDRAWINFO;
  140.  
  141.  
  142. int CALLBACK EXPORT EnumMetafileIconDraw(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPARAM);
  143. int CALLBACK EXPORT EnumMetafileExtractLabel(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  144. int CALLBACK EXPORT EnumMetafileExtractIcon(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPICONEXTRACT);
  145. int CALLBACK EXPORT EnumMetafileExtractIconSource(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  146.  
  147.  
  148. //Shared globals:  our instance, registered messages used from all dialogs and clipboard
  149. // formats used by the PasteSpecial dialog
  150. extern HINSTANCE  ghInst;
  151.  
  152. extern UINT       uMsgHelp;
  153. extern UINT       uMsgEndDialog;
  154. extern UINT       uMsgBrowse;
  155. extern UINT       uMsgChangeIcon;
  156. extern UINT       uMsgFileOKString;
  157. extern UINT       uMsgCloseBusyDlg;
  158.  
  159. extern UINT       cfObjectDescriptor;
  160. extern UINT       cfLinkSrcDescriptor;
  161. extern UINT       cfEmbedSource;
  162. extern UINT       cfEmbeddedObject;
  163. extern UINT       cfLinkSource;
  164. extern UINT       cfOwnerLink;
  165. extern UINT       cfFileName;
  166.  
  167. //Standard control identifiers
  168. #define ID_NULL                         98
  169.  
  170. #endif //_COMMON_H_
  171.  
  172.