Hi Pritpal, Viktor,

Il 05/02/2009 0.58, Pritpal Bedi ha scritto:
Hi

wapi_gdi32.c  OR  wapi_gdi.c ( removing 32, may contain gdi32 or gdi++
functions )

the name I proposed is related to MSDN syntax and to ms libs.
To be clear in MSDN function:
CreateCompatibleDC() is defined:

Requirements
  Windows NT/2000/XP/Vista: Included in Windows NT 3.1 and later.
  Windows 95/98/Me: Included in Windows 95 and later.
  Header: Declared in Wingdi.h; include Windows.h.
  Library: Use Gdi32.lib.


Instead GetPixelFormatSize() is defined:

Function Information
Header Declared in GdiplusPixelFormats.h, include gdiplus.h
Import library gdiplus.lib
Minimum availability GDI+ 1.1
Minimum operating systems Windows 98, Windows XP, Windows 2000, Windows NT 4.0 SP6

so following ms docs you can know where they have to be included and filename to be adopted (in above samples first is wapi_gdi32.c, the second is wapi_gdiplus.c).

So I repeat my proposal to follow MS docs in file names.


hbwapi.h
=======
#define wapi_parwparam( n )  ( ( WPARAM )  ( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parlparam( n )  ( ( LPARAM )  ( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parhandle( n )  ( ( HANDLE )  ( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parhwnd( n )    ( ( HWND )    ( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parwndproc( n ) ( ( WNDPROC ) ( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parhdc( n )     ( ( HDC )     ( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parcolor( n )   ( ( COLORREF )( HB_PTRDIFF ) hb_parnint( n ) )
#define wapi_parstruct( n ) ( hb_parc( n ) )

#define wapi_rethandle( n )  ( hb_retnint( ( HB_PTRDIFF ) n ) )
#define wapi_retstruct( x )  ( hb_retc( x ) )

#define wapi_more_most_often_used_types( x ) (...)

#define HB_HWND        HWND
#define HB_COLORREF  COLORREF
#define HB_HDC          HDC
// etc.

/*      IMO, we must avoid the direct API types at the API level       */


wapi_gdi.c
========
/*
All functions prefixed with WAPI_* will accept parameters in the same order and types, including structures. Only in cases
   where a complex structure is involved, an array of same number
   of elements corresponding members of the structure. If both
   can be implemented, the better it could be.
*/

What it means "will accept parameters in the same order and types, including structures" ? Referring to ms docs or between them ?
I suppose ms docs.

One problem I recall in mind is about length parameters.
There are some win functions that have length parameters (mostly with string parameters) that, in many wrappers I have seen, is dropped because we have hb_parclen() that returns string length. In this case I prefer to follow ms syntax checking presence of above parameters using i.e.:
dwLen = ( ISNIL( 6 ) ? hb_parclen( 5 ) : hb_parnl( 6 ) )

#include <windows.h>
#include <gdi32.h>
#include "hbwapi.h"

HB_FUNC( WAPI_PRINTDLG )
{
   PRINTDLG *pd = hb_parc( 1 );  // structure WHEREEVER possible
   ...
   wapi_retstruct( pd );
}


Ah, following above naming convention, PrintDlg() fits in wapi_comdlg32.c and not in wapi_gdi.c:

Function Information
Minimum DLL Version comdlg32.dll
Header Declared in Commdlg.h, include Windows.h
Import library Comdlg32.lib
Minimum operating systems Windows 95, Windows NT 3.1
Unicode Implemented as ANSI and Unicode versions.


To be continued ...

Best regards

Francesco
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to