home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / apigid32 / apigid32.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-28  |  5.3 KB  |  164 lines

  1. /***********************************************************************
  2.    File apigid32.h
  3.  
  4.    APIgid32 main header file for Visual Basic Programmer's Guide to Win32 API
  5.  
  6.    Written By Daniel Appleman
  7.    Copyright (c) 1995 by Desaware - All rights reserved
  8.  
  9.    You have a royalty-free right to use, modify, reproduce and distribute
  10.    this file (and/or any modified version) in any way you find useful,
  11.    provided that you agree that Desaware and Ziff-Davis Press has no
  12.    warranty, obligation or liability for its contents, and provided that you change
  13.    the name of file before distributing any modified version of this file.
  14.    
  15.    This file is provided "As-Is". No support is provided for the contents
  16.    or use of this file by Ziff-Davis Press, Daniel Appleman or Desaware.
  17.  
  18.    Refer to the Ziff-Davis Visual Basic Programmer's Guide to the
  19.    Win32 API for further information.
  20.  
  21.  
  22.  
  23. ************************************************************************/
  24.  
  25. #ifndef __AFXWIN_H__
  26.     #error include 'stdafx.h' before including this file for PCH
  27. #endif
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CApigid32App
  31. // See apigid32.cpp for the implementation of this class
  32. //
  33.  
  34. class CApigid32App : public CWinApp
  35. {
  36. public:
  37.     CApigid32App();
  38.  
  39. // Overrides
  40.     // ClassWizard generated virtual function overrides
  41.     //{{AFX_VIRTUAL(CApigid32App)
  42.     //}}AFX_VIRTUAL
  43.  
  44.     //{{AFX_MSG(CApigid32App)
  45.         // NOTE - the ClassWizard will add and remove member functions here.
  46.         //    DO NOT EDIT what you see in these blocks of generated code !
  47.     //}}AFX_MSG
  48.     DECLARE_MESSAGE_MAP()
  49. };
  50.  
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53.  
  54.  
  55. //---------------  Global Variables  ------------------
  56.  
  57. extern HMODULE LibHandle;
  58.  
  59. //---------------  ApiGid32 Utility Functions  -----------------
  60.  
  61. // String related functions
  62. STDAPI_(LONG) agGetAddressForVBString(BSTR *);
  63. STDAPI_(BSTR) agGetStringFromLPSTR(LPSTR);
  64.  
  65. // Address related functions
  66. STDAPI_(LONG) agGetAddressForObject(LPVOID);
  67.  
  68. //extern "C" WORD agGetControlHwnd(HCTL);
  69. //extern "C" DWORD EXPORTAPI agGetControlID(HCTL);
  70. STDAPI_(HANDLE) agGetInstance();
  71. STDAPI_(HANDLE) agGetWndInstance(HWND hwnd);
  72.  
  73. STDAPI_(WORD) agSwapBytes(WORD sb);
  74. STDAPI_(DWORD) agSwapWords(DWORD sb);
  75. STDAPI_(VOID) agCopyData(LPVOID source, LPVOID dest, DWORD size);
  76. STDAPI_(VOID) agDWORDto2Integers(LONG l, LPWORD x, LPWORD y);
  77. STDAPI_(DWORD) agPOINTStoLong(POINTS *pt);
  78.  
  79. STDAPI_(BSTR) agGetStringFrom2NullBuffer(LPSTR);
  80. STDAPI_(DWORD) agMakeROP4(DWORD foreground, DWORD background);
  81.  
  82. STDAPI_(VOID) agSubtractFileTimes(FILETIME *f1, FILETIME *f2, FILETIME *f3);
  83. STDAPI_(VOID) agAddFileTimes(FILETIME *f1, FILETIME *f2, FILETIME *f3);
  84. STDAPI_(double) agConvertFileTimeToDouble(FILETIME *f1);
  85. STDAPI_(VOID) agConvertDoubleToFileTime(double dbl, FILETIME *f1);
  86. STDAPI_(VOID) agNegateFileTime(FILETIME *f1);
  87.  
  88. STDAPI_(short) agInp(WORD portid);
  89. STDAPI_(short) agInpw(WORD portid);
  90. STDAPI_(DWORD) agInpd(WORD portid);
  91. STDAPI_(VOID) agOutp(WORD portid, WORD val);
  92. STDAPI_(VOID) agOutpw(WORD portid, WORD val);
  93. STDAPI_(VOID) agOutpd(WORD portid, DWORD val);
  94.  
  95.  
  96.  
  97. //---------------  ApiGid32 VB DLL Interface examples  -----------------
  98.  
  99.  
  100. // Some type definitions
  101.  
  102. /* Currency is a special 8 byte data type.  Fortunately, Microsoft C
  103.    (and probably others) can pass structures as parameters by value,
  104.    and return them.  You'll need to make sure that your compiler uses
  105.    the Microsoft C calling convention on structures for this to work.
  106.    In practice, you will need to build your own complete library of
  107.    currency data type math to use this data type.
  108.    Refer to the article text for details.
  109. */
  110.  
  111. typedef struct currencystruct {
  112.    char cbuf[8];
  113. } currency;
  114.  
  115. typedef struct usertypestruct {
  116.    char a;    // Matches VB integer type
  117.    short b;
  118.    short c;
  119.    short d;
  120.    BSTR hs;
  121.    short e[6];
  122.     char s2[4];
  123.     short st;
  124. } usertype;
  125.  
  126.  
  127.  
  128. STDAPI_(short) ReceivesInteger(short x);
  129. STDAPI_(BYTE) ReceivesBytes(BYTE a, BYTE b);
  130. STDAPI_(long) ReceivesLong(long y);
  131. STDAPI_(float) ReceivesSingle(float f);
  132. STDAPI_(double) ReceivesDouble(double d);
  133. STDAPI_(VOID) Add5ToInteger(short FAR *x);
  134. STDAPI_(VOID) Add5ToLong(long FAR *y);
  135. STDAPI_(VOID) Add5ToSingle(float FAR *f);
  136. STDAPI_(VOID) Add5ToDouble(double FAR *d);
  137.  
  138. STDAPI_(currency) ReceivesCurrency(currency curr);
  139. STDAPI_(VOID) AddPennyToCurrency(currency FAR *curptr);
  140. STDAPI_(VOID) ReceivesString(LPSTR tptr);
  141. STDAPI_(VOID) ChangesString(LPSTR tptr);
  142. STDAPI_(VOID) ReceivesVBString(BSTR *sptr);
  143. STDAPI_(VOID) ChangesVBString(BSTR *sptr);
  144. STDAPI_(BSTR) ReturnsVBString();
  145.  
  146.  
  147. STDAPI_(VOID) ReceivesUserType(usertype FAR *u);
  148. STDAPI_(VOID) AddUserString(usertype FAR *u);
  149. STDAPI_(usertype) ReturnUserType();
  150. STDAPI_(VOID) ReceivesIntArray(short FAR *iptr);
  151. STDAPI_(short) ReceivesVBArray(SAFEARRAY **xa);
  152. STDAPI_(short) ReceivesVariantByVal(VARIANTARG vr);
  153. STDAPI_(VARIANTARG) ReceivesVariant(VARIANTARG *pvr);
  154. STDAPI_(double) UsesDate(double d);
  155. STDAPI_(VOID) ReceivesObject(LPUNKNOWN lpv);
  156. STDAPI_(LPUNKNOWN) ReceivesObject2(LPUNKNOWN lpv);
  157. STDAPI_(VOID) ChangesObject(LPUNKNOWN lpv1, LPUNKNOWN *lpv2);
  158.  
  159.  
  160. STDAPI_(LONG) ShowAddress(LPVOID lp);
  161. STDAPI_(VOID) DumpValues(LPVOID lp, short cnt);
  162. STDAPI_(VOID) ChangeValues(LPBYTE lp, LPBYTE newval, short cnt);
  163.  
  164.