FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Error compilando con Bcc582 menu.c
Posts: 392
Joined: Tue Jul 29, 2008 01:55 PM
Error compilando con Bcc582 menu.c
Posted: Wed Oct 19, 2011 11:20 PM
Hola FiveWinners.

Este programa en C pasa bien la compialcion con Borlan C++ 5.5, sin embargo con Borland 582 NO, me arroja los siguientes errores.

Agadezco su ayuda

Saludos


Code (fw): Select all Collapse
#define OEMRESOURCE

#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>

BOOL bStrAt( BYTE bChar, LPSTR szText );
LPSTR StrToken( LPSTR szText, WORD wOcurrence, BYTE bSeparator, LPWORD pwLen );

void WindowBoxIn( HDC hDC, RECT * pRect );
void WndDrawBox( HDC hDC, RECT * rct, HPEN hPUpLeft, HPEN hPBotRit );
void WindowInset( HDC hDC, RECT * pRect );
void WindowRaised( HDC hDC, RECT * pRect );
void DrawBitmap( HDC, HBITMAP, WORD, WORD, WORD, WORD, DWORD );
void DrawMasked( HDC, HBITMAP, WORD, WORD );
void DrawGrayed( HDC, HBITMAP, int, int );
void RectDisable( HDC, LPRECT);
void DegardeFill( HDC hDC, RECT * rori, COLORREF cFrom, COLORREF cTo, int nDegType ) ;
void DegradColor( HDC hDC, RECT * rori, COLORREF cFrom, COLORREF cTo, int nDegType, int iRound ) ;

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_CREATEMENU( PARAMS )
{
   _retnl( ( LONG ) CreateMenu() );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_CREATEPOPUPMENU( PARAMS )
{
   _retnl( ( LONG ) CreatePopupMenu() );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_TRACKPOPUP( PARAMS )
{
  _retl( TrackPopupMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 4 ),
         _parni( 3 ), _parni( 5 ), ( HWND ) _parni( 6 ), NULL ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_ENABLEMENUITEM( PARAMS )
{
   _retl( EnableMenuItem( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_CHECKMENUITEM( PARAMS )   // ()
{
   _retl( CheckMenuItem( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETMITEMCOUNT( PARAMS )   // ()
{
   _retni( GetMenuItemCount( ( HMENU ) _parnl( 1 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETMITEMID( PARAMS )    // hMenu, nPos
{
   _retni( GetMenuItemID( ( HMENU ) _parnl( 1 ), _parni( 2 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETSYSTEMMENU( PARAMS )    // ()
{
   _retnl( ( LONG ) GetSystemMenu( ( HWND ) _parnl( 1 ), _parl( 2 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_DESTROYMENU( PARAMS )   //  ()   hMenu
{
   _retl( DestroyMenu( ( HMENU ) _parnl( 1 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETSUBMENU( PARAMS )    // hMenu, nPos
{
   _retnl( ( LONG ) GetSubMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETMENUSTRING( PARAMS )    // ()   hMenu, nId, nPosOrValue
{
   BYTE bBuffer[ 200 ];
   WORD wLen = GetMenuString( ( HMENU ) _parnl( 1 ), _parni( 2 ), ( char * ) bBuffer,
                              199, _parni( 3 ) );

   _retclen( ( char * ) bBuffer, wLen );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETMENUSTATE( PARAMS )    // ()   hMenu, nId, nFlags
{
   _retni( GetMenuState( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_DRAWMENUBAR( PARAMS )    // ()    hWnd
{
   DrawMenuBar( ( HWND ) _parnl( 1 ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_HILITEMENUITEM( PARAMS )  // ()  hWnd, hMenu, idItem, nHiliteFlags
{
   _retl( HiliteMenuItem( ( HWND ) _parnl( 1 ), ( HMENU ) _parnl( 2 ),
                          _parni( 3 ), _parni( 4 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_LOADMENU( PARAMS )
{
   _retnl( ( LONG ) LoadMenu( ( HINSTANCE ) _parnl( 1 ),
                     ( LPSTR ) IF( ISCHAR( 2 ), _parc( 2 ),
                                   MAKEINTRESOURCE( _parni( 2 ) ) ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_APPENDMENU( PARAMS )
{
   _retl( AppendMenu( ( HMENU ) _parnl( 1 ), ( UINT ) _parnl( 2 ), _parnl( 3 ),
                       IF( ISCHAR( 4 ), _parc( 4 ), ( LPSTR ) _parnl( 4 ) ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_SETMENU( PARAMS )
{
   _retl( SetMenu( ( HWND ) _parnl( 1 ), ( HMENU ) _parnl( 2 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_MODIFYMENU( PARAMS )
{
   _retl( ModifyMenu( ( HMENU ) _parnl( 1 ), ( UINT ) _parni( 2 ),
          _parni( 3 ), ( UINT ) _parni( 4 ),
          IF( ISCHAR( 5 ), _parc( 5 ), ( LPSTR ) _parnl( 5 ) ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_INSERTMENU( PARAMS ) // ( hMenu, nIdItem, nFlags, nNewItem, cPrompt ) --> lSuccess
{
   _retl( InsertMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ),
                      _parni( 4 ), _parc( 5 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_REMOVEMENU( PARAMS ) // ( hMenu, nItem, nFlags ) --> lSuccess
{
   _retl( RemoveMenu( ( HMENU ) _parnl( 1 ),
                      ( UINT ) _parni( 2 ),
                      ( UINT ) _parni( 3 ) ) );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_ATMENUDRAWITEM( PARAMS ) // ( pDrawItemStruct, cPrompt, lTop, hBitmap,lSeparator,acolor,lbar )
{
   LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
   LPSTR szPrompt = _parc( 2 );
   BOOL bTab = bStrAt( 9, szPrompt );
   WORD wLen;
   BOOL lSeparator = _parl( 5 );
   BOOL lBar       = _parl( 7 );
   HPEN hNormal,hOldPen;
   HBRUSH hBrush;
   LOGBRUSH lb;
   RECT rct;
   RECT rctdg;
   RECT rctsep;
   RECT rctshd;
   COLORREF nClrMenu     =  _parnl(6,1);
   COLORREF nClrMenuTxt  =  _parnl(6,2);
   COLORREF nClrBack     =  _parnl(6,3);
   COLORREF nClrTo       =  _parnl(6,4);
   COLORREF nClrHighBai  =  _parnl(6,5);
   COLORREF nClrHighBaf  =  _parnl(6,6);
   COLORREF nClrHighTxt  =  _parnl(6,7);
   COLORREF nClrHighBar  =  _parnl(6,8);

   HBITMAP hBmp = ( HBITMAP ) _parnl( 4 );
   switch( lpdis->itemAction )
   {
      case ODA_DRAWENTIRE:
      case ODA_SELECT:
           lb.lbStyle = BS_SOLID;
           lb.lbColor = nClrMenu;
           hBrush = CreateBrushIndirect( &lb );
           FillRect( lpdis->hDC, &lpdis->rcItem, hBrush );
           DeleteObject( hBrush );

           SetBkColor( lpdis->hDC, nClrMenu );
           SetBkMode( lpdis->hDC, TRANSPARENT );
           SetTextColor( lpdis->hDC, nClrMenuTxt);

           if( lpdis->itemState & ODS_SELECTED &&
               ! ( lpdis->itemState & ODS_GRAYED ) && !lSeparator )
           {
              lb.lbColor = nClrHighBai;
              SetBkColor( lpdis->hDC, nClrHighBai );
              SetTextColor( lpdis->hDC, nClrHighTxt );
              if( !lBar )
                 lpdis->rcItem.left += 22;
           }
           else
              lb.lbColor = nClrMenu;


           hBrush = CreateBrushIndirect( &lb );
           FillRect( lpdis->hDC, &lpdis->rcItem, hBrush );
           DeleteObject( hBrush );
           if( lpdis->itemState & ODS_SELECTED &&
              ! ( lpdis->itemState & ODS_GRAYED ) )
           {
             if( !lBar )
                lpdis->rcItem.left -= 22;
           }

           if(!lBar)
           {
             rct.top    = lpdis->rcItem.top       ;
             rct.left   = lpdis->rcItem.left  +23 ;
             rct.right  = lpdis->rcItem.right - 1 ;
             rct.bottom = lpdis->rcItem.bottom- 1 ;
           }
           else
           {
             rct.top    = lpdis->rcItem.top      ;
             rct.left   = lpdis->rcItem.left  + 1 ;
             rct.right  = lpdis->rcItem.right - 4 ;
             rct.bottom = lpdis->rcItem.bottom- 1 ;

             rctshd.top    = lpdis->rcItem.top  +3;
             rctshd.left   = lpdis->rcItem.right-3;
             rctshd.right  = lpdis->rcItem.right  ;
             rctshd.bottom = lpdis->rcItem.bottom ;

           }

           rctdg.top    = lpdis->rcItem.top   -1;
           rctdg.left   = lpdis->rcItem.left    ;
           rctdg.right  = 22;
           rctdg.bottom = lpdis->rcItem.bottom+1;

           if( !lBar )
              DegradColor( lpdis->hDC, &rctdg, nClrBack, nClrTo, 2, 1 ) ;

           if( lpdis->itemState & ODS_SELECTED )
              if( ! ( lpdis->itemState & ODS_GRAYED ) ) //&&
                {
                     hNormal = CreatePen(PS_SOLID,0,nClrHighBar);
                     hOldPen = SelectObject(lpdis->hDC,hNormal);
//                   Rectangle(lpdis->hDC,rct.left-1,rct.top-1,rct.right+1,rct.bottom+1);
                     SelectObject(lpdis->hDC,hOldPen);
                     DeleteObject( hNormal );
                     DegradColor( lpdis->hDC, &rct, nClrHighBai, nClrHighBaf, 1, 1 ) ;
                     if(lBar)
                     {
                       lb.lbColor = GetSysColor(16);
                       hBrush = CreateBrushIndirect( &lb );
                       FillRect( lpdis->hDC, &rctshd, hBrush );
                       DeleteObject( hBrush );
                       rctshd.top    = lpdis->rcItem.top;
                       rctshd.left   = lpdis->rcItem.right-3;
                       rctshd.right  = lpdis->rcItem.right;
                       rctshd.bottom = lpdis->rcItem.top+3;
                       lb.lbColor = nClrMenu;
                       hBrush = CreateBrushIndirect( &lb );
                       FillRect( lpdis->hDC, &rctshd, hBrush );
                       DeleteObject( hBrush );

                     }
                }
if(!lBar)
{

           if( lpdis->itemState & ODS_CHECKED )
           {
              HBITMAP hBmp = LoadBitmap( 0, MAKEINTRESOURCE( OBM_CHECK ) );

              if( ! ( lpdis->itemState & ODS_SELECTED ) )
                 DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
                             lpdis->rcItem.left + 4 );
              else
                 DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
                             lpdis->rcItem.left + 4 );
              DeleteObject( hBmp );
           }

           if( hBmp  && !( (int) hBmp == 1 )  )
           {
              if( ! ( lpdis->itemState & ODS_CHECKED ) )
                 DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3, //ojo
                            lpdis->rcItem.left + 2 );
              else
                 if( ! ( lpdis->itemState & ODS_SELECTED ) )
                    DrawGrayed( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
                                lpdis->rcItem.left + 2 );
                 else
                    DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
                                lpdis->rcItem.left + 2 );
           }
}
           if(!lBar)
           {
             lpdis->rcItem.top  +=  2;  //  2
             lpdis->rcItem.left += 27;  // 26
           }
           else
           {
             lpdis->rcItem.top  += 2;
             lpdis->rcItem.left += 3;
           }
           if( !bTab )
           {
              if( lSeparator )
              {
                 rctsep.top    = lpdis->rcItem.top  +1 ;
                 rctsep.left   = lpdis->rcItem.left -3;
                 rctsep.right  = lpdis->rcItem.right+5;
                 rctsep.bottom = lpdis->rcItem.bottom - 4;
                 lb.lbStyle = BS_SOLID;
                 lb.lbColor = nClrHighBar ;
                 hBrush = CreateBrushIndirect( &lb );
                 FillRect( lpdis->hDC, &rctsep, hBrush );
                 DeleteObject( hBrush );
              }
              else
              {
              if(!lBar)
                {
                   DrawText( lpdis->hDC, szPrompt, -1, &lpdis->rcItem, DT_LEFT );
                }
                else
                {
                   lpdis->rcItem.left -= 5;
                   DrawText( lpdis->hDC, szPrompt, -1, &lpdis->rcItem, DT_CENTER );
                   lpdis->rcItem.left += 5;
                }
              }
           }
           else
           {
              lpdis->rcItem.right -= 26;
              StrToken( szPrompt, 1, 9, &wLen ); // 32 bits does not fill wLen before
              DrawText( lpdis->hDC, StrToken(szPrompt, 1, 9, &wLen), wLen, &lpdis->rcItem, DT_LEFT );
              StrToken( szPrompt, 2, 9, &wLen ); // 32 bits does not fill wLen before
              DrawText( lpdis->hDC, StrToken(szPrompt, 2, 9, &wLen), wLen, &lpdis->rcItem, DT_RIGHT );
              lpdis->rcItem.right += 26;
           }
           if(!lBar)
           {
             /*
              if( !lSeparator )
                {
                if( lpdis->itemState & ODS_GRAYED )
                   RectDisable( lpdis->hDC, &lpdis->rcItem );
                }
             */
             lpdis->rcItem.top  -=  2;
             lpdis->rcItem.left -= 26;
           }
           else
           {
             lpdis->rcItem.top  -= 2;
             lpdis->rcItem.left -= 4;
           }



           _retl( TRUE );
           break;

      case ODA_FOCUS:
           _retl( FALSE );
           break;
   }
}

//----------------------------------------------------------------------------//
/*
#ifdef __HARBOUR__
   CLIPPER MENUMEASUREITEM( PARAMS ) // ( pMeasureItemStruct, nLen )
#else
   CLIPPER MENUMEASUR( PARAMS ) // EITEM( pMeasureItemStruct, nLen )
#endif
{
   LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
   lp->itemWidth  = _parni( 2 );
   lp->itemHeight = GetSystemMetrics( SM_CYMENU ); //18
}
*/
//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETMEAITEM( PARAMS ) // ( pMeasureItemStruct ) --> nMenuItemID
{
   LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );

   _retnl( lp->itemID );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETDRAWITEM( PARAMS ) // ( pDrawItemStruct ) --> nMenuItemID
{
   LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );

   _retnl( lpdis->itemID );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_GETDRAWMENU( PARAMS ) // ( pDrawItemStruct ) --> hMenu
{
   LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );

   _retnl( ( LONG ) lpdis->hwndItem );
}

//----------------------------------------------------------------------------//

HARBOUR HB_FUN_ISMENU( PARAMS )
{
   _retl( IsMenu( ( HMENU ) _parnl( 1 ) ) );
}

//----------------------------------------------------------------------------//

HB_FUNC( _GETMENUID)
{
    _retnl((LONG)GetMenu((HWND)_parnl(1)));
}

//----------------------------------------------------------------------------//

HB_FUNC ( _COLORMENU )
{
   HMENU      iMenu;
   MENUINFO   iMenuInfo ;
   COLORREF lColor = _parnl(2);
   BOOL  lSubMenu = _parl(3);
   HWND  himage ;

   himage = (HWND)LoadImage(0,_parc(4),IMAGE_BITMAP ,0,0,LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT );

   if (himage==NULL)
     {
       himage = (HWND)LoadImage(GetModuleHandle(NULL),_parc(4),IMAGE_BITMAP ,0,0, LR_LOADMAP3DCOLORS    | LR_LOADTRANSPARENT );
     }
   iMenu              = GetMenu((HWND) _parnl(1));
   GetMenuInfo(iMenu, &iMenuInfo);
   iMenuInfo.cbSize   = sizeof(MENUINFO);
   iMenuInfo.dwStyle  = GetWindowLongPtr( (HWND) _parnl(1), GWL_STYLE );

   if (lSubMenu)
    {
      iMenuInfo.fMask    = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS ;
    }
   else
    {
      iMenuInfo.fMask    = MIM_BACKGROUND;
    }

   if (himage==NULL)
    {
       iMenuInfo.hbrBack = CreateSolidBrush(lColor);
    }
   else
    {
       iMenuInfo.hbrBack = CreatePatternBrush( (HBITMAP) himage);
    }

   SetMenuInfo(iMenu, &iMenuInfo);
   DrawMenuBar((HWND) _parnl(1));

}

//----------------------------------------------------------------------------//

HB_FUNC ( _COLORSUBMENU )
{
   HMENU      iMenu;
   MENUINFO   iMenuInfo ;
   COLORREF lColor = _parnl(2);
   iMenu              = GetMenu((HWND) _parnl(1));
   GetMenuInfo(iMenu, &iMenuInfo);
   iMenuInfo.cbSize   = sizeof(MENUINFO);
   iMenuInfo.fMask    = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS;
   iMenuInfo.hbrBack  = CreateSolidBrush(lColor);
   SetMenuInfo(iMenu, &iMenuInfo);
//   DrawMenuBar((HWND) _parnl(1));
}

//----------------------------------------------------------------------------//
HB_FUNC( CHGMENUMEA ) // pMeasureItemStruct, nWidth, nHeight
{
   LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
   lp->itemWidth  = _parni( 2 ) ;
   lp->itemHeight = _parni( 3 ) ;
}

HB_FUNC( GETDRAWISR ) // ( pDrawitemstruct )
{
   LPDRAWITEMSTRUCT lp = ( LPDRAWITEMSTRUCT ) _parnl( 1 );

   _reta( 12 );

   _storni( lp->CtlType      ,    -1, 1  );
   _storni( lp->CtlID        ,    -1, 2  );
   _storni( lp->itemID       ,    -1, 3  );
   _storni( lp->itemAction   ,    -1, 4  );
   _storni( lp->itemState    ,    -1, 5  );
   _storni( ( LONG ) lp->hwndItem     ,    -1, 6  );
   _storni( ( LONG ) lp->hDC          ,    -1, 7  );
   _storni( lp->rcItem.top   ,    -1, 8  );
   _storni( lp->rcItem.left  ,    -1, 9  );
   _storni( lp->rcItem.bottom,    -1, 10 );
   _storni( lp->rcItem.right ,    -1, 11 );
   _stornd( lp->itemData     ,    -1, 12 );

}

HB_FUNC( GETMEAUSUR ) // ( pMeasureItemStruct )
{
   LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );

   _reta( 6 );

   _storni( lp->CtlType      ,    -1, 1  );
   _storni( lp->CtlID        ,    -1, 2  );
   _storni( lp->itemID       ,    -1, 3  );
   _storni( lp->itemWidth    ,    -1, 4  );
   _storni( lp->itemHeight   ,    -1, 5  );
   _stornd( lp->itemData     ,    -1, 12 );

}

//----------------------------------------------------------------------------//


    C:\ALib\MENUS.C:
    Warning W8075 C:\ALib\MENUS.C 180: Suspicious pointer
    conversion in function HB_FUN_ATMENUDRAWITEM
    Warning W8065 C:\ALib\MENUS.C 526: Call to function
    '_reta' with no prototype in function HB_FUN_GETDRAWISR
    Warning W8065 C:\ALib\MENUS.C 547: Call to function
    '_reta' with no prototype in function HB_FUN_GETMEAUSUR
    Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland

    [/list:u]
Visite Chiapas, el paraiso de México.

Continue the discussion