File:  [OS/2 SDKs] / pmsdk / samples / newcard / pmbind.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:28:12 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: pmsdk-1988, HEAD
Microsoft OS/2 SDK PM 08-08-1988

#define  INCL_DOS
#define  INCL_WIN
#define  INCL_GPI
#include "os2.h"
#include "pmbind1.h"


/*********************************************************************/
/*  Windows/PM Cardfile Shared Code                                  */
/*                                                                   */
/*  (c) Copyright Microsoft Corp. 1987,1988 - All Rights Reserved    */
/*********************************************************************/


/*********************************************************************/
/* Internal variables used by binding system.                        */
/*********************************************************************/

extern HAB     hAB;              /* Holds the anchor block handle */
extern HMQ     hMQ;              /* Holds the message queue handle */
extern int     temp;             /* Temp Var, used for many mappings */
extern POINTL  Point;            /* Temp Var, used for many mappings */
extern WPOINT  pt;               /* Temp Var, used for many mappings */
extern HHEAP   hLocalHeap;       /* Holds the cardfile's local heap */
extern int     WinHeight;        /* Holds the current translate value */
extern int     b_CharHeight;     /* Character height, default is 0 */
extern WRECT   TempRect;         /* Temp Var, used for many mappings */
extern PWRECT  lTempRect;        /* Temp Var, used for many mappings */
extern HWND    hwndTemp;         /* Temp Var, used for many mappings */
extern POINTL  PointArray[];     /* Temp Var, used for many mappings */



/*********************************************************************/
/* Internal functions called by binding system.                      */
/*********************************************************************/

int   FAR PASCAL  lstrlen( PSZ );
PSZ   FAR PASCAL  lstrcpy( PSZ, PSZ );
PSZ   FAR PASCAL  lstrcat( PSZ, PSZ );
PSZ   FAR PASCAL  lmemcpy( PSZ, PSZ, unsigned );
int   CheckScrollBars( HWND, unsigned, int );


/*********************************************************************/
/* Internal defines accessed only in binding system                  */
/*********************************************************************/

/* These resolve type conflicts with the MPARAM type */

#define  NewSendMsg( a, b, c, d )   \
            LONGFROMMR( WinSendMsg( a, b, MPFROMLONG(c), MPFROMLONG(d) ))

#define  NewSendDlgItemMsg( a, b, c, d, e ) \
            LONGFROMMR(WinSendDlgItemMsg( a, b, c, \
                                          MPFROMLONG(d), MPFROMLONG(e) ))

#define  NewDefWindowProc( a, b, c, d )   \
      LONGFROMMR( WinDefWindowProc( a, b, MPFROMLONG(c), MPFROMLONG(d) ))


/*********************************************************************/
/* Exeternal functions available to the application                  */
/*********************************************************************/

int      DlgDirList( HWND, PSZ, unsigned, unsigned, unsigned );
unsigned DlgDirSelect( HWND, PSZ, unsigned );
int      OpenFile( PSZ, LPOFSTRUCT, WORD );


/********************************************************************/
/* Various symbol defines                                           */
/********************************************************************/


/* Message box id's */

#define  IDOK              MBID_OK
#define  IDCANCEL          MBID_CANCEL
#define  IDABORT           MBID_ABORT
#define  IDRETRY           MBID_RETRY
#define  IDIGNORE          MBID_IGNORE
#define  IDYES             MBID_YES
#define  IDNO              MBID_NO

/* Scroll bar notification messages */

#define  SB_THUMBTRACK     SB_SLIDERTRACK
#define  SB_THUMBPOSITION  SB_SLIDERPOSITION


/* Window styles (CreateWindow mapping)       */

#define  WS_HSCROLL	   FCF_HORZSCROLL
#define  WS_VSCROLL	   FCF_VERTSCROLL

/* At last check, FCF_STANDARD included: title bar, sys menu, min-max, */
/*  and sizeborder.  */

#define  WS_TILEDWINDOW    FCF_STANDARD

/* GetWindowLong indices */

#define  GWL_WNDPROC	   QWP_PFNWP

/* Mix Modes, raster ops */

#define  R2_NOTXORPEN      FM_NOTXORSRC

#define  TRANSPARENT       FM_LEAVEALONE
#define  OPAQUE            FM_OVERPAINT

#define  WHITENESS         ROP_ONE

/* Cursors.  Use POINTER_FLAG to indicate     */
/*  that a PM constant is a system pointer    */
/*  When calling Cursor functions, strip off  */
/*  flag.                                     */

#define  POINTER_FLAG      0x4000
#define  POINTER_MASK      ~POINTER_FLAG

#define  IDC_ARROW         SPTR_ARROW | POINTER_FLAG
#define  IDC_WAIT          SPTR_WAIT | POINTER_FLAG

/* Menu flags */

#define  MF_CHECKED        MIA_CHECKED
#define  MF_UNCHECKED      0

#define  MF_ENABLED        0
#define  MF_GRAYED         MIA_DISABLED

/* Scroll bar id's */

#define  SB_HORZ           FID_HORZSCROLL
#define  SB_VERT           FID_VERTSCROLL

/* Show Window commands */

#define  SHOW_OPENWINDOW   TRUE
#define  HIDE_WINDOW       FALSE

/* GetSysColor constant */

#define  COLOR_WINDOW      SYSCLR_WINDOW

/* Virtual Keys */

#define  VK_NEXT	   VK_PAGEDOWN
#define  VK_PRIOR	   VK_PAGEUP
#define  VK_LBUTTON        VK_BUTTON1


/********************************************************************/
/* Messages                                                         */
/********************************************************************/

#define  WM_KEYFIRST       WM_CHAR
#define  WM_KEYLAST        WM_CHAR

#define  WM_INITDIALOG     WM_INITDLG

#define  WM_LBUTTONUP      WM_BUTTON1UP
#define  WM_LBUTTONDOWN    WM_BUTTON1DOWN
#define  WM_LBUTTONDBLCLK  WM_BUTTON1DBLCLK

/* This message is will cause problems if applications try to use */
/* it in the same way as the Windows message.  Should probably  */
/* take it out. */

#define  WM_ERASEBKGND     WM_ERASEBACKGROUND

#define  WM_CUT            EM_CUT
#define  WM_COPY           EM_COPY
#define  WM_PASTE          EM_PASTE

#define  EM_LIMITTEXT      EM_SETTEXTLIMIT
#define  EM_GETMODIFY      EM_QUERYCHANGED
#define  EM_GETSEL         EM_QUERYSEL

#define  LBN_SELCHANGE     LN_SELECT
#define  LBN_DBLCLK        LN_ENTER



/********************************************************************/
/* General Utility Defines                                          */
/********************************************************************/

#define  BLUE_COLOR	CLR_BLUE
#define  RED_COLOR	CLR_RED
#define  WHITE_COLOR	CLR_WHITE
#define  BLACK_COLOR	CLR_BLACK

/* Min/Max may not be in the PM include files  */
#ifndef  min
#define  min( x, y )             ((x) < (y) ? x : y )
#endif

#ifndef  max
#define  max( x, y )             ((x) > (y) ? x : y )
#endif


/********************************************************************/
/* Translations                                                     */
/********************************************************************/


/* The RGB format is reversed in PM */

#define  CONVERT_RGB( x )        ((((DWORD)(x) & 0xff) << 16) | \
                                   ((DWORD)(x) & 0x00ff00) | \
                                   ((DWORD)(x) >> 16))


/* This define sets up main to initialize and call WinMain */

#define  ENTRYPROCEDURE()  int cdecl main( void );  \
                           int cdecl main() {  \
                              hAB = WinInitialize( NULL ); \
                              INIT_APP(); \
                              WinMain( hAB, 0, "", SHOW_OPENWINDOW ); \
                              TERMINATE_APP(); \
                              WinTerminate( hAB ); \
                              return( 0 ); \
                           }

/* Create message queue, local heap.  Internal to pmbind.h */

#define  INIT_APP()        hMQ = WinCreateMsgQueue( hAB, 0 ); \
                           hLocalHeap = WinCreateHeap( 0, 0, 0,  \
                                                       0, 0, HM_MOVEABLE )

/* Destroy message queue, local heap.  Internal to pmbind.h */

#define  TERMINATE_APP()   WinDestroyHeap( hLocalHeap );    \
                           WinDestroyMsgQueue( hMQ )

/* Get frame from window */

#define  FRAME( a )              WinQueryWindow( a, QW_PARENT, FALSE )


/**********************************************************/
/* Defines used for coordinate transformations            */
/**********************************************************/

/* External defines */

#define  TRANSLATE_Y( x )        (WinHeight - x)
#define  TRANSLATE_RECT( x )     x.yTop = WinHeight - x.yTop; \
                                 x.yBottom = WinHeight - x.yBottom;

#define  SET_CHARHEIGHT( x )     b_CharHeight = x

#define  TRANSLATE_COORDS( x )   WinHeight = x

#define  MAKEPOINT( a )          (pt.x = LOUSHORT( a ), \
                                 pt.y = HIUSHORT( a ), pt)

/* Internal defines */

#define  TRANSY( y )             (WinHeight ? (WinHeight - (y)) : (y)) 

#define  STUFFPOINT( a, b )      Point.x = (long) a; \
                                 Point.y = (long) TRANSY(b)


/*********************************************************************/
/* Control Window Mappings                                           */
/*                                                                   */
/* Mappings:                                                         */
/*    GetMenu( hWnd )                                                */
/*    EnableMenuItem( hMenu, wId, fEnableOn )                        */
/*    CheckMenuItem( hMenu, wId, fCheckOn )                          */
/*    SROLL_RANGE( hWnd, wId, wPos, wHigh, wLow )                    */
/*    SetScrollPos( hWnd, wId, wPos, fRedraw )                       */
/*********************************************************************/

/*********/
/* Menus */
/*********/

#define  GetMenu( a )         WinWindowFromID( FRAME( a ), FID_MENU )

#define  EnableMenuItem( a, b, c )  NewSendMsg( a, MM_SETITEMATTR, \
                              MAKELONG( b, TRUE ), \
                              MAKELONG( MIA_DISABLED, c ) )

#define  CheckMenuItem( a, b, c )   NewSendMsg( a, MM_SETITEMATTR, \
                              MAKELONG( b, TRUE ), \
                              MAKELONG( MIA_CHECKED, c ) )
/***************/
/* Scroll Bars */
/***************/

/* Scroll_Range( hwnd, Id value, Pos, First, Last ) */

#define  SCROLL_RANGE( a, b, c, d, e ) { if \
      (CheckScrollBars( FRAME(a), b, d != e )) \
                NewSendDlgItemMsg( FRAME(a), b, SBM_SETSCROLLBAR, \
                                   c, MAKELONG( d, e ) ); }

#define  SetScrollPos( a, b, c, d )    \
        NewSendDlgItemMsg( FRAME(a), b, SBM_SETPOS, \
                           c, 0 )


/*********************************************************************/
/* Window DC Mappings                                                */
/*                                                                   */
/*    In most cases that an IC should be created, the app. just      */
/* wants system font information.  In PM, just return PS of the      */
/* desktop.                                                          */
/*                                                                   */
/* Mappings:                                                         */
/*    GetDC( hWnd )                                                  */
/*    ReleaseDC( hDC )                                               */
/*    CreateIC( lpDriv, lpDevice, lpOutput, lpInit )                 */
/*    DeleteDC( hDC )                                                */
/*********************************************************************/

#define  GetDC( x )              WinGetPS( x )
#define  ReleaseDC( x, y )       WinReleasePS( (HPS) y )
#define  CreateIC( a, b, c, d )  WinGetPS( HWND_DESKTOP )
#define  DeleteDC( x )           WinReleasePS( (HPS) x )




/*********************************************************************/
/* Memory Management Mappings                                        */
/*                                                                   */
/*                                                                   */
/*    Here's a good chance to test the flexibility of this system.   */
/* GlobalAlloc maps to DosAllocSeg which creates a Global ID for     */
/* each call.  For applications making many global allocs of a       */
/* small size (like Cardfile), it's probably better to use           */
/* DosSubAlloc for some of these.                                    */
/*                                                                   */
/* Mappings:                                                         */
/*    LocalAlloc( wFlags, wSize )                                    */
/*    LocalFree( wBlock )                                            */
/*    GlobalAlloc( wFlags, wSize )                                   */
/*    GlobalReAlloc( wHandle, wSize, wFlags )                        */
/*    GlobalUnlock( wHandle );                                       */
/*    GlobalFree( wHandle );                                         */
/*    GlobalLock( wHandle );                                         */
/*********************************************************************/

#define  LocalAlloc( x, y )   WinAllocMem( hLocalHeap, y )
#define  LocalFree( x )       WinFreeMem( hLocalHeap, (char *) x, 0 )

#define  GlobalAlloc( x, y )  (DosAllocSeg( (unsigned) y, \
                                 (PSEL)&temp, 0 ), temp)
#define  GlobalReAlloc( Han, Size, x ) !DosReallocSeg( \
                                         (USHORT) Size, (SEL)Han )
#define  GlobalUnlock( x )       
#define  GlobalFree( x )      DosFreeSeg( (SEL) x )
#define  GlobalLock( x )      MAKEP( x, 0 )



/*********************************************************************/
/* Dialog Management Mappings                                        */
/*                                                                   */
/*    MAKEINTRESOURCE is not needed because PM resources are always  */
/* ints.  The mapping for GetDlgItemInt doesn't take lpfSuccess      */
/* into account.                                                     */
/*                                                                   */
/* Mappings:                                                         */
/*    MAKEINTRESOURCE( x )                                           */
/*    MessageBeep( wBeepType )                                       */
/*    MessageBox( hWnd, lpText, lpCaption, wType )                   */
/*    DialogBox( hInst, lpTemplate, hParent, lpFunc )                */
/*    EndDialog( hDlg, wResult )                                     */
/*    SendDlgItemMessage( hDlg, wId, wMsg, wParam, lParam )          */
/*    GetDlgItem( hDlg, wId )                                        */
/*    SetDlgItemText( hDlg, wId, lpBuf )                             */
/*    GetDlgItemText( hDlg, wId, lpBuf, wMax )                       */
/*    GetDlgItemInt( hDlg, wId, lpfSuccess, fSigned )                */
/*    SetDlgItemInt( hDlg, wId, wValue, fSigned )                    */
/*********************************************************************/

/*******************************/
/* Dialog Creation/Destruction */
/*******************************/

#define  MAKEINTRESOURCE( x )       x
#define  MessageBeep( a )           WinAlarm( HWND_DESKTOP, WA_WARNING )
#define  MessageBox( a, b, c, d )   WinMessageBox( HWND_DESKTOP, a, b, \
                                                   c, 0, d )
#define  DialogBox( a, b, c, d )    WinDlgBox( HWND_DESKTOP, c, d, \
                                               NULL, b, NULL )
#define  EndDialog( x, y )          WinDismissDlg( x, y )

/*******************/
/* Dialog messages */
/*******************/

#define  SendDlgItemMessage( a, b, c, d, e ) \
                  NewSendDlgItemMsg( a, b, c, d, e )

/***************************************/
/* Dialog: Setting/Getting information */
/***************************************/

#define  GetDlgItem( x, y )            WinWindowFromID( x, y )

#define  GetDlgItemText( a, b, c, d )  \
		   WinQueryDlgItemText( a, b , d, c )

#define  SetDlgItemText( x, y, z )     \
		   WinSetDlgItemText( x, y , z )

#define  GetDlgItemInt( a, b, c, d ) \
               ( WinQueryDlgItemShort( a, b, &temp, d ), temp )

#define  SetDlgItemInt( a, b, c, d )   WinSetDlgItemShort( a, b, c, d )



/*********************************************************************/
/* Rectangle Mappings                                                */
/*                                                                   */
/*    Application should call TRANSLATE_RECT after most SetRect's.   */
/*                                                                   */
/* Mappings:                                                         */
/*    SetRect( lpRect, left, top, right, bottom )                    */
/*    InflateRect( lpRect, dx, dy )                                  */
/*    PtInRect( lpRect, pt )                                         */
/*********************************************************************/

#define  SetRect( a, b, c, d, e )   WinSetRect( hAB, a, b, e, d, c )
#define  InflateRect( a, b, c )     WinInflateRect( hAB, a, b, c )
#define  PtInRect( a, b )           WinPtInRect( hAB, a, (PPOINTL) &b )


/*********************************************************************/
/* Window Attribute Mappings                                         */
/*                                                                   */
/*    GetWindowLong is available for a minimal number of indices.    */
/*                                                                   */
/* Mappings:                                                         */
/*    SetWindowText( hWnd, lpText )                                  */
/*    GetWindowText( hWnd, lpBuf, wMax )                             */
/*    GetWindowTextLength( hWnd )                                    */
/*    GetClientRect( hWnd, lpRect )                                  */
/*    GetWindowLong( hWnd, wIndex )                                  */
/*    SetWindowLong( hWnd, wIndex, lValue )                          */
/*********************************************************************/

#define  SetWindowText( x, y )      WinSetWindowText( x, y )
#define  GetWindowText( x, y, z )   WinQueryWindowText( x, z, y )
#define  GetWindowTextLength( a )   WinQueryWindowTextLength( a )   
#define  GetClientRect( x, y )      WinQueryWindowRect( x, y )
#define  GetWindowLong( a, b )      WinQueryWindowULong( a, b )
#define  SetWindowLong( a, b, c )   WinSetWindowULong( a, b, c )




/*********************************************************************/
/* Window Painting Mappings                                          */
/*                                                                   */
/*    For the time being, punt on the issues of brushes.  Treat      */
/* brushes as colors in PM version.  This should eventually be       */
/* changed to treat a brush as a pointer to some BUNDLESTRUCT        */
/*                                                                   */
/* Mappings:                                                         */
/*    BeginPaint( hWnd, lpPaintStruct )                              */
/*    EndPaint( hWnd, lpPaintStruct )                                */
/*    UpdateWindow( hWnd )                                           */
/*    InvalidateRect( hWnd, lpRect, fErase )                         */
/*    ShowWindow( hWnd, fShow )                                      */
/*    FillRect( hWnd, lpRect, hBrush )                               */
/*    InvertRect( hWnd, lpRect )                                     */
/*    FrameRect( hWnd, lpRect, hBrush )                              */
/*    ScrollWindow( hWnd, dx, dy, lpRect, lpClipRect )               */
/*********************************************************************/


/* The BeginPaint mapping utilizes the PAINTSTRUCT defined in  */
/* PmBind.h.  This is not valid for applications which own the */
/* PS. */

#define  BeginPaint( a, b )   \
     (b)->hdc = WinBeginPaint( a, (HPS) NULL, (PRECTL) &(b)->rcPaint )

#define  EndPaint( a, b )     WinEndPaint( (b)->hdc )


#define  UpdateWindow( x )    WinUpdateWindow( x )
#define  InvalidateRect( x, y, z )  WinInvalidateRect( x, y, TRUE )
#define  ShowWindow( x, y )   WinShowWindow( x, y )

#define  FillRect( x, y, z )  WinFillRect( x, y, z )
#define  InvertRect( a, b )   WinInvertRect( a, b )

/* Assume with is 5 units for PM mapping */
#define  FrameRect( a, b, c ) \
      WinDrawBorder( a, b, 1, 1, c, 0L, DB_PATCOPY )

#define  ScrollWindow( a, b, c, d, e ) \
     WinScrollWindow( a, b, - c, d, e, NULL, NULL, SW_INVALIDATERGN )


/*********************************************************************/
/* Window Manipulation Mappings                                      */
/*                                                                   */
/*    CreateWindow only works for the Main Window!  When creating    */
/* child windows, use separate compilation.  None of these           */
/* routines operate automatically on the frame.  In the source       */
/* code, use the frame macro (I think ScrollWindow is the only       */
/* routine which retrieves the frame window automatically).          */
/*                                                                   */
/* Mappings:                                                         */
/*    CreateWindow( lpClass, lpCaption, dwStyle, x, y, width, height,*/
/*                  hParent, hMenu, hInst, lpParam )                 */
/*    DestroyWindow( hWnd )                                          */
/*    MoveWindow( hWnd, x, y, Width, Height, fRePaint )              */
/*    GetFocus()                                                     */
/*    SetFocus( hWnd )                                               */
/*    IsWindowEnabled( hWnd )                                        */
/*    EnableWindow( hWnd, fEnable )                                  */
/*********************************************************************/

#define  CreateWindow( a, b, c, d, e, f, g, h, i, j, k ) \
     (ctlData=c, \
     WinCreateStdWindow( HWND_DESKTOP, WS_VISIBLE | FS_ICON, \
			 &ctlData, a, b, 0L, NULL, 1, \
			 (HWND FAR *) &hwndTemp ), \
      hwndTemp )

#define  DestroyWindow( a )   WinDestroyWindow( a )

#define  MoveWindow( a, b, c, d, e, f ) \
      WinSetWindowPos( a, NULL, b, TRANSY(c) - e, d, \
                       e, SWP_SIZE | SWP_MOVE )


#define  GetFocus()           WinQueryFocus( HWND_DESKTOP, FALSE )
#define  SetFocus( x )        WinSetFocus( hAB, x )


#define  IsWindowEnabled( a )          WinIsWindowEnabled( a )
#define  EnableWindow( a, b )          WinEnableWindow( a, b )



/*********************************************************************/
/* Ansi Mappings                                                     */
/*                                                                   */
/*    Another chance to prove the system flexibility!  These         */
/* functions will eventually accept call the functions with the      */
/* code pages.                                                       */
/*                                                                   */
/* Mappings:                                                         */
/*    AnsiNext( lpStr )                                              */
/*    AnsiPrev( lpStr )                                              */
/*    AnsiUpper( lpStr )                                             */
/*    ANSICHARUP( lpStr ) - (High word is 0)                         */
/*********************************************************************/

#define  LOWERCHAR( a )    ( (a <= 'z') && (a >= 'a') )

#define  AnsiNext( a )     (a + 1)
#define  AnsiPrev( a, b )  (b - 1)
#define  AnsiUpper( Str )  \
   { for (temp = 0; (Str)[temp]; temp++ ) \
         if (LOWERCHAR((Str)[temp]))   \
              (Str)[temp] = (Str)[temp] & 0xdf; }

#define  ANSICHARUP( a )   ( ((BYTE)((DWORD)(a))) & 0xdf)



/*********************************************************************/
/* Clipboard Mappings                                                */
/*                                                                   */
/* Mappings:                                                         */
/*    EnumClipbrdFmts( wFormat )                                     */
/*    OpenClipboard( hWnd )                                          */
/*    CloseClipboard( hWnd )                                         */
/*    EnumClipboardFormats( hWnd )                                   */
/*********************************************************************/

#define  EnumClipbrdFmts( x )          WinEnumClipbrdFmts( hAB, x )
#define  OpenClipboard( a )            WinOpenClipbrd( hAB )
#define  CloseClipboard()              WinCloseClipbrd( hAB )
#define  EnumClipboardFormats( a )  WinEnumClipbrdFmts( hAB, a )



/*********************************************************************/
/* Messaging Mappings                                                */
/*                                                                   */
/*    The accelerator mapping may need to be changed.                */
/*                                                                   */
/* Mappings:                                                         */
/*    SendMessage( hWnd, wMsg, wParam, lParam )                      */
/*    GetMessage( lpMsg, hWnd, wMin, wMax )                          */
/*    DispatchMessage( lpMsg )                                       */
/*    TranslateAccelerator( hWnd, hAccel, lpMsg )                    */
/*    TranslateMessage( lpMsg )                                      */
/*    PeekMessage( lpMsg, hWnd, wMin, wMax, fRemove )                */
/*********************************************************************/

#define  SendMessage( a, b, c, d )  \
               NewSendMsg( a, b, c, d )

#define  GetMessage( a, b, c, d )   WinGetMsg( hAB, a, b, c, d )
#define  DispatchMessage( a )       WinDispatchMsg( hAB, a )
#define  TranslateAccelerator( a, b, c )  FALSE
#define  TranslateMessage( a )      

#define  PeekMessage( a, b, c, d, e ) \
    WinPeekMsg( hAB, a, b, c, d, e ? PM_REMOVE : PM_NOREMOVE )


/*********************************************************************/
/* Cursor Mappings                                                   */
/*                                                                   */
/*    The LoadCursor mapping must distinguish between the system     */
/* pointer and a resource.  Therefore, the constants used for the    */
/* system pointers include a bit, POINTER_FLAG.  If this is found    */
/* in the index, it is masked off and the system pointer is          */
/* retrieved.  This method runs the risk of collision of             */
/* POINTER_FLAG with the constants used for the system pointers      */
/* (they may change) as well as the values in the user resource      */
/* file.                                                             */
/*                                                                   */
/* Mappings:                                                         */
/*    SetCapture( hWnd )                                             */
/*    ReleaseCapture( hWnd )                                         */
/*    SetCursor( hCurs )                                             */
/*    LoadCursor( hCurs )                                            */
/*********************************************************************/

#define  SetCapture( a )   WinSetCapture( hAB, a )
#define  ReleaseCapture()  WinSetCapture( hAB, NULL )

#define  SetCursor( a )    WinSetPointer( HWND_DESKTOP, a )
#define  LoadCursor( a, b ) \
   ( b & POINTER_FLAG ? \
    WinQuerySysPointer( HWND_DESKTOP, b & ~POINTER_MASK, TRUE ) : \
    WinLoadPointer( HWND_DESKTOP, NULL, b ) )


/*********************************************************************/
/* Misc Mappings                                                     */
/*********************************************************************/



#define  LoadString( a, b, c, d )  \
            WinLoadString( hAB, NULL, b, (SHORT) d, c )

#define  DefWindowProc( a, b, c, d )   NewDefWindowProc( a, b, c, d )

/* Originally, there was a problem is GpiCharStringAt was called   */
/*  with 0 chars to write.  Hence the if statement. */

#define  TextOut( a, b, c, d, e )   \
      { if (e) { STUFFPOINT( b, c ); \
            Point.y -= b_CharHeight; \
            GpiCharStringAt( a, &Point, (LONG) e, d ); } }

#define  SetBkMode( a, b )             GpiSetBackMix( a, b )

#define  LoadAccelerators( a, b )      NULL
#define  LoadIcon( a, b )              NULL

/* For the time being, don't worry about this one  */
#define  GetTempFileName( a, b, c, d ) (lstrcpy( d, "cardfile.tmp" ), 1)

/* Neither of these functions is available or necessary in PM */
#define  MakeProcInstance( a, b )   (PFNWP) (a)
#define  GetInstanceData( a, b, c ) 

#define  MoveTo( a, b, c ) {STUFFPOINT( b, c ); GpiMove( a, &Point );}
#define  LineTo( a, b, c ) {STUFFPOINT( b, c ); GpiLine( a, &Point );}

#define  SetROP2( a, b )   GpiSetMix( a, b )

#define  PatBlt( a, b, c, d, e, f ) \
      { PointArray[0].x = b; \
        PointArray[0].y = TRANSY( c + e ); \
        PointArray[1].x = b + d; \
        PointArray[1].y = TRANSY( c ); \
        GpiBitBlt( a, a, 2L, PointArray, f, BLTMODE_NOSCALE ); }

#define  DPtoLP( a, b, c )    \
      GpiConvert( a, CVTC_DEVICE, CVTC_WORLD, (long) c, (PPOINTL) b );

/* Only a few of the fields in the TEXTMETRICS structure are mapped  */
/* onto the FONTMETRICS structure (see pmbind1.h) */

#define  GetTextMetrics( a, b )  \
      GpiQueryFontMetrics( a, (LONG) sizeof( FONTMETRICS ), b )

#define  CallWindowProc( a, b, c, d, e )  \
            LONGFROMMR(a( b, c, MPFROMLONG(d), MPFROMLONG(e) ))

#define  GetKeyState( a )	 WinGetKeyState( HWND_DESKTOP, a )

#define  GetSysColor( a )        WinQuerySysColor( HWND_DESKTOP, a, 0L )

#define  CreateSolidBrush( a )   a


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.