home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************
- File apigid32.h
-
- APIgid32 main header file for Visual Basic Programmer's Guide to Win32 API
-
- Written By Daniel Appleman
- Copyright (c) 1995 by Desaware - All rights reserved
-
- You have a royalty-free right to use, modify, reproduce and distribute
- this file (and/or any modified version) in any way you find useful,
- provided that you agree that Desaware and Ziff-Davis Press has no
- warranty, obligation or liability for its contents, and provided that you change
- the name of file before distributing any modified version of this file.
-
- This file is provided "As-Is". No support is provided for the contents
- or use of this file by Ziff-Davis Press, Daniel Appleman or Desaware.
-
- Refer to the Ziff-Davis Visual Basic Programmer's Guide to the
- Win32 API for further information.
-
-
-
- ************************************************************************/
-
- #ifndef __AFXWIN_H__
- #error include 'stdafx.h' before including this file for PCH
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CApigid32App
- // See apigid32.cpp for the implementation of this class
- //
-
- class CApigid32App : public CWinApp
- {
- public:
- CApigid32App();
-
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CApigid32App)
- //}}AFX_VIRTUAL
-
- //{{AFX_MSG(CApigid32App)
- // NOTE - the ClassWizard will add and remove member functions here.
- // DO NOT EDIT what you see in these blocks of generated code !
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
-
-
- /////////////////////////////////////////////////////////////////////////////
-
-
- //--------------- Global Variables ------------------
-
- extern HMODULE LibHandle;
-
- //--------------- ApiGid32 Utility Functions -----------------
-
- // String related functions
- STDAPI_(LONG) agGetAddressForVBString(BSTR *);
- STDAPI_(BSTR) agGetStringFromLPSTR(LPSTR);
-
- // Address related functions
- STDAPI_(LONG) agGetAddressForObject(LPVOID);
-
- //extern "C" WORD agGetControlHwnd(HCTL);
- //extern "C" DWORD EXPORTAPI agGetControlID(HCTL);
- STDAPI_(HANDLE) agGetInstance();
- STDAPI_(HANDLE) agGetWndInstance(HWND hwnd);
-
- STDAPI_(WORD) agSwapBytes(WORD sb);
- STDAPI_(DWORD) agSwapWords(DWORD sb);
- STDAPI_(VOID) agCopyData(LPVOID source, LPVOID dest, DWORD size);
- STDAPI_(VOID) agDWORDto2Integers(LONG l, LPWORD x, LPWORD y);
- STDAPI_(DWORD) agPOINTStoLong(POINTS *pt);
-
- STDAPI_(BSTR) agGetStringFrom2NullBuffer(LPSTR);
- STDAPI_(DWORD) agMakeROP4(DWORD foreground, DWORD background);
-
- STDAPI_(VOID) agSubtractFileTimes(FILETIME *f1, FILETIME *f2, FILETIME *f3);
- STDAPI_(VOID) agAddFileTimes(FILETIME *f1, FILETIME *f2, FILETIME *f3);
- STDAPI_(double) agConvertFileTimeToDouble(FILETIME *f1);
- STDAPI_(VOID) agConvertDoubleToFileTime(double dbl, FILETIME *f1);
- STDAPI_(VOID) agNegateFileTime(FILETIME *f1);
-
- STDAPI_(short) agInp(WORD portid);
- STDAPI_(short) agInpw(WORD portid);
- STDAPI_(DWORD) agInpd(WORD portid);
- STDAPI_(VOID) agOutp(WORD portid, WORD val);
- STDAPI_(VOID) agOutpw(WORD portid, WORD val);
- STDAPI_(VOID) agOutpd(WORD portid, DWORD val);
-
-
-
- //--------------- ApiGid32 VB DLL Interface examples -----------------
-
-
- // Some type definitions
-
- /* Currency is a special 8 byte data type. Fortunately, Microsoft C
- (and probably others) can pass structures as parameters by value,
- and return them. You'll need to make sure that your compiler uses
- the Microsoft C calling convention on structures for this to work.
- In practice, you will need to build your own complete library of
- currency data type math to use this data type.
- Refer to the article text for details.
- */
-
- typedef struct currencystruct {
- char cbuf[8];
- } currency;
-
- typedef struct usertypestruct {
- char a; // Matches VB integer type
- short b;
- short c;
- short d;
- BSTR hs;
- short e[6];
- char s2[4];
- short st;
- } usertype;
-
-
-
- STDAPI_(short) ReceivesInteger(short x);
- STDAPI_(BYTE) ReceivesBytes(BYTE a, BYTE b);
- STDAPI_(long) ReceivesLong(long y);
- STDAPI_(float) ReceivesSingle(float f);
- STDAPI_(double) ReceivesDouble(double d);
- STDAPI_(VOID) Add5ToInteger(short FAR *x);
- STDAPI_(VOID) Add5ToLong(long FAR *y);
- STDAPI_(VOID) Add5ToSingle(float FAR *f);
- STDAPI_(VOID) Add5ToDouble(double FAR *d);
-
- STDAPI_(currency) ReceivesCurrency(currency curr);
- STDAPI_(VOID) AddPennyToCurrency(currency FAR *curptr);
- STDAPI_(VOID) ReceivesString(LPSTR tptr);
- STDAPI_(VOID) ChangesString(LPSTR tptr);
- STDAPI_(VOID) ReceivesVBString(BSTR *sptr);
- STDAPI_(VOID) ChangesVBString(BSTR *sptr);
- STDAPI_(BSTR) ReturnsVBString();
-
-
- STDAPI_(VOID) ReceivesUserType(usertype FAR *u);
- STDAPI_(VOID) AddUserString(usertype FAR *u);
- STDAPI_(usertype) ReturnUserType();
- STDAPI_(VOID) ReceivesIntArray(short FAR *iptr);
- STDAPI_(short) ReceivesVBArray(SAFEARRAY **xa);
- STDAPI_(short) ReceivesVariantByVal(VARIANTARG vr);
- STDAPI_(VARIANTARG) ReceivesVariant(VARIANTARG *pvr);
- STDAPI_(double) UsesDate(double d);
- STDAPI_(VOID) ReceivesObject(LPUNKNOWN lpv);
- STDAPI_(LPUNKNOWN) ReceivesObject2(LPUNKNOWN lpv);
- STDAPI_(VOID) ChangesObject(LPUNKNOWN lpv1, LPUNKNOWN *lpv2);
-
-
- STDAPI_(LONG) ShowAddress(LPVOID lp);
- STDAPI_(VOID) DumpValues(LPVOID lp, short cnt);
- STDAPI_(VOID) ChangeValues(LPBYTE lp, LPBYTE newval, short cnt);
-
-