Error a complicar tsbrowse con BCC582
Posted: Thu Aug 19, 2010 10:03 pm
Al compilar con bcc582
Warning W8075 c:\tsbrowse\source\function\tsbfuncs.c 53: Suspicious pointer
Warning W8075 c:\tsbrowse\source\function\tsbfuncs.c 53: Suspicious pointer
Code: Select all
/***************************************************************
This file contains the special painting routines used by TSBrowse Class
Last update: September 15th, 2004
***************************************************************/
#ifdef __HARBOUR__
#include <hbApi.h> /* set your own path if needed */
#endif
#include <WinTen.h> /* set your own path if needed */
#include <Windows.h>
#include <ClipApi.h> /* set your own path if needed */
#include <shellapi.h>
#include <StdLib.h>
void WndBoxDraw( HDC, LPRECT, HPEN, HPEN, int, BOOL ) ;
void cDrawCursor( HWND, LPRECT, long, COLORREF ) ;
void DrawCheck( HDC, LPRECT, HPEN, int, BOOL ) ;
DWORD GetTextExtent( HDC, LPCSTR, int ) ;
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster ) ;
extern void DrawMasked( HDC hdc, HBITMAP hbm, WORD y, WORD x ) ;
extern void MaskRegion( HDC hDC, RECT * rct, COLORREF cTransparent ,
COLORREF cBackground ) ;
static void GoToPoint( HDC, int, int ) ;
static void DegradColor( HDC, RECT *, COLORREF, COLORREF ) ;
//---------------------------------------------------------------------------//
#ifndef __HARBOUR__
CLIPPER TSDrawCell( PARAMS ) // ( hWnd, hDC, nRow, nColumn , nWidth ,
// uData, nAlign , nClrFore, nClrBack ,
// hFont, nBitmap, nHeightCell,
// b3DLook, nLineStyle, nClrLine, nHeadFoot,
// nHeightHead, nHeightFoot, hHeightSuper,
// lAdjBmpl, lMultiLine, nVAlign, nVertText,
// nClrTo, lDegrad, hBrush )
#else
HARBOUR HB_FUN_TSDRAWCELL( PARAMS )
#endif
{
HWND hWnd = (HWND) _parni( 1 ) ;
HDC hDC = (HDC) _parni( 2 ) ;
int nRow = _parni( 3 ) ;
int nColumn = _parni( 4 ) ;
int nWidth = _parni( 5 ) ;
LPSTR cData = _parc( 6 ) ;
int nLen = _parclen( 6 ) ;
DWORD nAlign = _parnl( 7 ) ;
COLORREF clrFore = _parnl( 8 ) ;
COLORREF clrBack = _parnl( 9 ) ;
HFONT hFont = (HFONT) _parni( 10 ) ;
HBITMAP hBitMap = (HBITMAP) _parni( 11 ) ;
int nHeightCell = _parni( 12 ) ;
BOOL b3DLook = _parl( 13 ) ;
int nLineStyle = _parni( 14 ) ;
COLORREF clrLine = _parnl( 15 ) ;
int nHeadFoot = _parni( 16 ) ;
int nHeightHead = _parni( 17 ) ;
int nHeightFoot = _parni( 18 ) ;
int nHeightSuper = _parni( 19 ) ;
BOOL bAdjBmp = _parl( 20 ) ;
BOOL bMultiLine = _parl( 21 ) ;
int nVAlign = _parni( 22 ) ;
int nVertText = _parni( 23 ) ;
COLORREF clrTo = _parnl( 24 ) ;
BOOL bOpaque = _parl( 25 ) ;
HBRUSH wBrush = (HBRUSH) _parnl( 26 ) ;
BOOL b3DInv = ( ISLOGICAL( 27 ) ? ! _parl( 27 ) : FALSE ) ;
BOOL b3D = ( ISLOGICAL( 27 ) ? TRUE : FALSE ) ;
COLORREF nClr3DL = _parnl( 28 ) ;
COLORREF nClr3DS = _parnl( 29 ) ;
long lCursor = _parnl( 30 ) ;
int ixLayOut = HIWORD( nAlign ) ;
int iAlign = LOWORD( nAlign ) ;
int iTxtW = LOWORD( GetTextExtent( hDC, cData, nLen ) ) ;
BOOL bGrid = ( nLineStyle > 0 ? TRUE : FALSE ) ;
BOOL bHeader = ( nHeadFoot == 1 ? TRUE : FALSE ) ;
BOOL bFooter = ( nHeadFoot == 2 ? TRUE : FALSE ) ;
BOOL bSuper = ( nHeadFoot == 3 ? TRUE : FALSE ) ;
BOOL bChecked = ( nVertText == 3 ? TRUE : FALSE ) ;
BOOL bBrush = ( wBrush > 0 ? TRUE : FALSE ) ;
BOOL bDegrad = ( clrTo == clrBack ? FALSE : TRUE ) ;
HFONT hOldFont ;
BOOL bDestroyDC = FALSE ;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, clrLine );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ) ;
RECT rct ;
BITMAP bm ;
int nTop, nLeft, nBkOld, iFlags ;
if( ! hDC )
{
bDestroyDC = TRUE ;
hDC = GetDC( hWnd ) ;
}
if( hFont )
hOldFont = SelectObject( hDC, hFont ) ;
GetClientRect( hWnd, &rct ) ;
SetTextColor( hDC, clrFore ) ;
SetBkColor( hDC, clrBack ) ;
if( nRow == 0 )
rct.top = ( bHeader ? nHeightSuper - ( nHeightSuper ? 1 : 0 ) : 0 ) ;
else
rct.top = ( bFooter ? rct.bottom - nHeightFoot + 1 :
nHeightHead + nHeightSuper - ( nHeightSuper ? 1 : 0 ) +
( nHeightCell * ( nRow - 1 ) ) ) ;
rct.bottom = rct.top + ( bHeader ? nHeightHead :( bSuper ? nHeightSuper : nHeightCell ) - 1 ) ;
/* Don't let left side go beyond rct.right of Client Rect. */
if( nColumn - ( rct.right - rct.left ) <= 0 )
{
rct.left = nColumn ;
/* if nWidth == -1 or -2, it indicates the last column so go to limit,
Don't let right side go beyond rct.right of Client Rect. */
if( ( nWidth >= 0 ) && ((rct.left + nWidth - rct.right) <= 0) ) // negative values have different meanings
rct.right = rct.left + nWidth ;
if( ! bDegrad )
{
rct.bottom += ( bHeader ? 0 : 1 ) ;
rct.right += 1 ;
if( ! bBrush )
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED, &rct, "", 0, 0 ) ;
else
FillRect( hDC, &rct, wBrush ) ;
rct.bottom -= ( bHeader ? 0 : 1 ) ;
rct.right -= 1 ;
}
else
DegradColor( hDC, &rct, clrBack, clrTo ) ;
if( hBitMap )
{
if( ! bAdjBmp )
{
GetObject( hBitMap, sizeof( BITMAP ), ( LPSTR ) &bm ) ;
nTop = rct.top + ( ( rct.bottom - rct.top + 1 ) / 2 ) - ( bm.bmHeight / 2 ) ;
switch( ixLayOut ) // bitmap layout x coordinate
{
case 0: // column left
nLeft = rct.left ;
break ;
case 1: // column center (text -if any- may overwrite the bitmap)
nLeft = rct.left + ( ( rct.right - rct.left + 1 ) / 2 ) -
( bm.bmWidth / 2 ) - 1 ;
break ;
case 2: // column right
nLeft = rct.right - ( bm.bmWidth + 2 ) ;
break ;
case 3: // left of centered text
nLeft = max( rct.left, rct.left + ( ( rct.right - rct.left + 1 ) / 2 ) -
( iTxtW / 2 ) - bm.bmWidth - 2 ) ;
break ;
case 4: // right of centered text
nLeft = rct.left + ( ( rct.right - rct.left + 1 ) / 2 ) +
( iTxtW / 2 ) + 2 ;
break ;
default: // a value > 4 means specific pixel location from column left
nLeft = rct.left + ixLayOut ;
break ;
}
}
else
{
nTop = rct.top ;
nLeft = rct.left ;
}
if( b3DLook )
{
if( bAdjBmp )
{
nTop = rct.top + 1 ;
DrawBitmap( hDC, hBitMap, nTop, rct.left - 1, rct.right - rct.left + 1,
rct.bottom - rct.top - 1, 0 ) ;
hBitMap = 0 ;
if( ! bOpaque )
MaskRegion( hDC, &rct, GetPixel( hDC, nLeft, nTop ), GetBkColor( hDC ) ) ;
}
else
if( bOpaque )
DrawBitmap( hDC, hBitMap, nTop, nLeft, 0, 0, 0 ) ;
else
DrawMasked( hDC, hBitMap, nTop, nLeft ) ;
}
else
{
if( bAdjBmp)
{
DrawBitmap( hDC, hBitMap, rct.top, rct.left - 2,
rct.right - rct.left + 3,
rct.bottom - rct.top - 1, 0 ) ;
hBitMap = 0 ;
if( ! bOpaque )
MaskRegion( hDC, &rct, GetPixel( hDC, nLeft, nTop ), GetBkColor( hDC ) ) ;
}
else
if( bOpaque )
DrawBitmap( hDC, hBitMap, nTop, nLeft, 0, 0, 0 ) ;
else
DrawMasked( hDC, hBitMap, nTop, nLeft ) ;
}
}
if( nLen > 0 )
{
if( iAlign == DT_LEFT )
rct.left += ( 2 + ( hBitMap && ixLayOut == 0 ? bm.bmWidth + 1 : 0 ) ) ;
if( iAlign == DT_RIGHT )
rct.right -= ( 2 + ( hBitMap && ixLayOut == 2 ? bm.bmWidth + 1 : 0 ) ) ;
if( nVertText == 1 )
{
rct.right += ( 4 * nLen ) ;
rct.bottom += 8 ;
}
iFlags = iAlign | DT_NOPREFIX | nVAlign * 4 |
( bMultiLine && nVAlign < 2 ? 0 : DT_SINGLELINE ) ;
if( ( nVertText == 3 || nVertText == 4 ) )
DrawCheck( hDC, &rct, hWhitePen, iAlign, bChecked ) ;
else
{
nBkOld = SetBkMode( hDC, TRANSPARENT ) ;
if( b3D )
{
rct.top -= 1 ;
rct.left -= 1 ;
rct.bottom -= 1 ;
rct.right -= 1 ;
SetTextColor( hDC, b3DInv ? nClr3DS : nClr3DL ) ;
DrawText( hDC, cData, nLen, &rct, iFlags ) ;
rct.top += 2 ;
rct.left += 2 ;
rct.bottom += 2 ;
rct.right += 2 ;
SetTextColor( hDC, b3DInv ? nClr3DL : nClr3DS ) ;
DrawText( hDC, cData, nLen, &rct, iFlags ) ;
rct.top -= 1 ;
rct.left -= 1 ;
rct.bottom -= 1 ;
rct.right -= 1 ;
SetTextColor( hDC, clrFore ) ;
}
DrawText( hDC, cData, nLen, &rct, iFlags ) ;
SetBkMode( hDC, nBkOld ) ;
}
if( iAlign == DT_LEFT )
rct.left -= ( 2 + ( hBitMap && ixLayOut == 0 ? bm.bmWidth + 1 : 0 ) ) ;
if( iAlign == DT_RIGHT )
rct.right += ( 2 + ( hBitMap && ixLayOut == 2 ? bm.bmWidth + 1 : 0 ) ) ;
if( nVertText == 1 )
{
rct.right -= ( 4 * nLen ) ;
rct.bottom -= 8 ;
}
}
if( b3DLook )
{
bHeader = ( bSuper ? bSuper : bHeader ) ;
if( ( nWidth != -2 ) && bGrid ) // -1 draw gridline in phantom column; -2 don't draw gridline in phantom column
WndBoxDraw( hDC, &rct, hWhitePen, hGrayPen, b3DLook ? 4 : nLineStyle, bHeader ) ;
if( lCursor > 0 )
cDrawCursor( hWnd, &rct, lCursor, clrFore ) ;
}
else
{
bHeader = ( bFooter ? bFooter : ( bHeader || bSuper ) ) ;
if( ( nWidth != -2 ) && bGrid ) // -1 draw gridline in phantom column; -2 don't draw gridline in phantom column
WndBoxDraw( hDC, &rct, hGrayPen, hGrayPen, nLineStyle, bHeader ) ;
if( lCursor > 0 )
cDrawCursor( hWnd, &rct, lCursor, clrFore ) ;
}
}
.....