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

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