예제 #1
0
파일: wvgwing.c 프로젝트: NaldoDj/core
LRESULT CALLBACK ControlWindowProcedure( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
   PHB_ITEM pBlock = ( PHB_ITEM ) GetProp( hwnd, TEXT( "BLOCKCALLBACK" ) );
   long     lRet;

   if( pBlock )
   {
      if( hb_itemType( pBlock ) == HB_IT_POINTER )
      {
         hb_vmPushSymbol( hb_dynsymSymbol( ( ( PHB_SYMB ) pBlock )->pDynSym ) );
         hb_vmPushNil();
      }
      else
      {
         hb_vmPushEvalSym();
         hb_vmPush( pBlock );
      }
      hb_vmPushNumInt( ( HB_PTRUINT ) hwnd );
      hb_vmPushInteger( msg );
      hb_vmPushNumInt( ( HB_PTRUINT ) wParam );
      hb_vmPushNumInt( ( HB_PTRUINT ) lParam );
      hb_vmDo( 4 );
      lRet = ( long ) hb_parnint( -1 );
      return lRet;
   }
   return DefWindowProc( hwnd, msg, wParam, lParam );
}
예제 #2
0
파일: iousr.c 프로젝트: AmericoBalboa/core
static int s_fileLockTest( PHB_FILE pFile, HB_FOFFSET nStart,
                           HB_FOFFSET nLen, int iType )
{
   PHB_IOUSR pIO = ( PHB_IOUSR ) pFile->pFuncs;

   s_pushMethod( pIO, IOUSR_LOCKTEST );
   hb_vmPush( pFile->pFileItm );
   hb_vmPushNumInt( ( HB_MAXINT ) nStart );
   hb_vmPushNumInt( ( HB_MAXINT ) nLen );
   hb_vmPushInteger( iType );
   hb_vmDo( 4 );

   return hb_parni( -1 );
}
예제 #3
0
파일: iousr.c 프로젝트: AmericoBalboa/core
static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * buffer,
                             HB_SIZE nSize, HB_FOFFSET nOffset )
{
   PHB_IOUSR pIO = ( PHB_IOUSR ) pFile->pFuncs;
   HB_SIZE nResult;
   int iOffset;

   iOffset = ( int ) ( hb_stackTopOffset() - hb_stackBaseOffset() );
   memset( buffer, 0, nSize );
   hb_vmPushString( ( const char * ) buffer, nSize );

   s_pushMethod( pIO, IOUSR_READAT );
   hb_vmPush( pFile->pFileItm );
   hb_xvmPushLocalByRef( ( HB_SHORT ) iOffset );
   hb_vmPushSize( nSize );
   hb_vmPushNumInt( ( HB_MAXINT ) nOffset );
   hb_vmDo( 4 );

   nResult = hb_parns( -1 );
   if( nResult > 0 )
   {
      nSize = hb_itemGetCLen( hb_stackItemFromBase( iOffset ) );
      if( nResult > nSize )
         nResult = nSize;
      memcpy( buffer, hb_itemGetCPtr( hb_stackItemFromBase( iOffset ) ), nSize );
   }
   hb_stackPop();

   return nResult;
}
예제 #4
0
/* Control handler function */
static VOID WINAPI hbwin_SvcControlHandler( DWORD fdwControl )
{
    if( s_pHarbourControlFunc )
    {
        if( hb_vmRequestReenterExt() )
        {
            hb_vmPushEvalSym();
            hb_vmPush( s_pHarbourControlFunc );
            hb_vmPushNumInt( ( HB_MAXINT ) fdwControl );
            hb_vmSend( 1 );
            hb_vmRequestRestore();
        }
        else
            HB_TRACE( HB_TR_DEBUG, ( "HVM stack not available" ) );
        return;
    }

    switch( fdwControl )
    {
    case SERVICE_CONTROL_STOP:
        s_ServiceStatus.dwWin32ExitCode = 0;
        s_ServiceStatus.dwCurrentState  = SERVICE_STOPPED;
        break;

    case SERVICE_CONTROL_SHUTDOWN:
        s_ServiceStatus.dwWin32ExitCode = 0;
        s_ServiceStatus.dwCurrentState  = SERVICE_STOPPED;
        break;

    default:
        return;
    }

    SetServiceStatus( s_hStatus, &s_ServiceStatus );  /* Report current status */
}
예제 #5
0
파일: iousr.c 프로젝트: AmericoBalboa/core
static HB_BOOL s_fileTruncAt( PHB_FILE pFile, HB_FOFFSET nOffset )
{
   PHB_IOUSR pIO = ( PHB_IOUSR ) pFile->pFuncs;

   s_pushMethod( pIO, IOUSR_TRUNCAT );
   hb_vmPush( pFile->pFileItm );
   hb_vmPushNumInt( ( HB_MAXINT ) nOffset );
   hb_vmDo( 2 );

   return hb_parl( -1 );
}
예제 #6
0
파일: iousr.c 프로젝트: AmericoBalboa/core
static HB_FOFFSET s_fileSeek( PHB_FILE pFile, HB_FOFFSET nOffset,
                              HB_USHORT uiFlags )
{
   PHB_IOUSR pIO = ( PHB_IOUSR ) pFile->pFuncs;

   s_pushMethod( pIO, IOUSR_SEEK );
   hb_vmPush( pFile->pFileItm );
   hb_vmPushNumInt( ( HB_MAXINT ) nOffset );
   hb_vmPushInteger( uiFlags );
   hb_vmDo( 3 );

   return ( HB_FOFFSET ) hb_parnint( -1 );
}
예제 #7
0
파일: wvgwing.c 프로젝트: NaldoDj/core
BOOL CALLBACK WvgDialogProcChooseFont( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
   HB_BOOL  bret  = HB_FALSE;
   HB_BOOL  binit = HB_FALSE;
   PHB_ITEM block;

   if( msg == WM_INITDIALOG )
   {
      CHOOSEFONT * cf     = ( CHOOSEFONT * ) lParam;
      PHB_ITEM     pBlock = ( PHB_ITEM ) hb_itemNew( ( PHB_ITEM ) cf->lCustData );
      SetProp( hwnd, TEXT( "DIALOGPROC" ), pBlock );
      binit = HB_TRUE;
   }

   block = ( PHB_ITEM ) GetProp( hwnd, TEXT( "DIALOGPROC" ) );

   if( block )
   {
      hb_vmPushEvalSym();
      hb_vmPush( block );
      hb_vmPushNumInt( ( HB_PTRUINT ) hwnd );
      hb_vmPushInteger( msg );
      hb_vmPushNumInt( ( HB_PTRUINT ) wParam );
      hb_vmPushNumInt( ( HB_PTRUINT ) lParam );
      hb_vmDo( 4 );
      bret = hb_parnl( -1 );

      if( msg == WM_NCDESTROY )
      {
         RemoveProp( hwnd, TEXT( "DIALOGPROC" ) );
         hb_itemRelease( block );
      }
   }
   if( binit )
      return HB_TRUE;

   return bret;
}
예제 #8
0
파일: iousr.c 프로젝트: AmericoBalboa/core
static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * buffer,
                              HB_SIZE nSize, HB_FOFFSET nOffset )
{
   PHB_IOUSR pIO = ( PHB_IOUSR ) pFile->pFuncs;

   s_pushMethod( pIO, IOUSR_WRITEAT );
   hb_vmPush( pFile->pFileItm );
   hb_vmPushString( ( const char * ) buffer, nSize );
   hb_vmPushSize( nSize );
   hb_vmPushNumInt( ( HB_MAXINT ) nOffset );
   hb_vmDo( 4 );

   return hb_parns( -1 );
}
예제 #9
0
파일: iousr.c 프로젝트: AmericoBalboa/core
static HB_SIZE s_fileWrite( PHB_FILE pFile, const void * data,
                            HB_SIZE nSize, HB_MAXINT timeout )
{
   PHB_IOUSR pIO = ( PHB_IOUSR ) pFile->pFuncs;

   s_pushMethod( pIO, IOUSR_WRITE );
   hb_vmPush( pFile->pFileItm );
   hb_vmPushString( ( const char * ) data, nSize );
   hb_vmPushSize( nSize );
   hb_vmPushNumInt( timeout );
   hb_vmDo( 4 );

   return hb_parns( -1 );
}
예제 #10
0
파일: hbgihb.c 프로젝트: fongoses/hbgi
static void
hbgi_hb_clsAddMsgNative(HB_USHORT uiClass, const char *szMessage, HB_USHORT uiType, HB_USHORT uiScope, PHB_ITEM pFuncOrOffset, PHB_ITEM pInit)
{
   PHB_ITEM pInitCopy;
   HB_BOOL allocated = !pInit;
   pInitCopy = allocated ? hb_itemNew(NULL) : pInit;
   if (!s_pDyns__CLSADDMSG) {
      hbgihb_init(NULL);
   }
   hb_vmPushDynSym(s_pDyns__CLSADDMSG);
   hb_vmPushNil();
   hb_vmPushNumInt(uiClass);
   hb_vmPushString(szMessage, strlen(szMessage));
   hb_vmPush(pFuncOrOffset);
   hb_vmPushNumInt(uiType);
   hb_vmPush(pInitCopy);
   hb_vmPushNumInt(uiScope);
   hb_vmProc(6);
   if (allocated)
   {
      hb_itemRelease(pInitCopy);
   }
}
예제 #11
0
파일: hbgihb.c 프로젝트: fongoses/hbgi
HB_USHORT
hbgi_hb_clsNew(const char *szClassName, int nDatas, PHB_ITEM pSuperArray)
{
   if (!s_pDyns__CLSNEW) {
      hbgihb_init(NULL);
   }
   hb_vmPushDynSym(s_pDyns__CLSNEW);
   hb_vmPushNil();
   hb_vmPushString(szClassName, strlen(szClassName));
   hb_vmPushNumInt(nDatas);
   if (!pSuperArray)
   {
      hb_vmPushNil();
   }
   else
   {
      hb_vmPush(pSuperArray);
   }
   hb_vmProc(3);
   return hb_itemGetNI(hb_stackReturnItem());
}
예제 #12
0
static INT_PTR CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
   PHB_GTWVT _s      = hb_wvt_gtGetWVT();
   INT_PTR   lReturn = 0;

   if( _s )
   {
      int      iIndex, iType;
      PHB_ITEM pFunc  = NULL;
      int      iFirst = ( int ) lParam;

      if( iFirst > 0 && iFirst <= ( int ) HB_SIZEOFARRAY( _s->hDlgModal ) )
      {
         _s->hDlgModal[ iFirst - 1 ] = hDlg;
         SendMessage( hDlg, WM_INITDIALOG, 0, 0 );
         return lReturn;
      }

      iType = 0;

      for( iIndex = 0; iIndex < ( int ) HB_SIZEOFARRAY( _s->hDlgModal ); iIndex++ )
      {
         if( _s->hDlgModal[ iIndex ] != NULL && _s->hDlgModal[ iIndex ] == hDlg )
         {
            if( _s->pFuncModal[ iIndex ] != NULL )
            {
               pFunc = _s->pFuncModal[ iIndex ];
               iType = _s->iTypeModal[ iIndex ];
            }
            break;
         }
      }

      if( pFunc )
      {
         switch( iType )
         {
            case 1: /* Function Name */
               if( hb_vmRequestReenter() )
               {
                  hb_vmPushDynSym( ( PHB_DYNS ) pFunc );
                  hb_vmPushNil();
                  hbwapi_vmPush_HANDLE( hDlg );
                  hb_vmPushNumInt( message );
                  hb_vmPushNumInt( wParam );
                  hb_vmPushNumInt( lParam );
                  hb_vmDo( 4 );
                  lReturn = ( INT_PTR ) hbwapi_par_RESULT( -1 );
                  hb_vmRequestRestore();
               }
               break;

            case 2: /* Block */
               /* eval the codeblock */
               if( HB_IS_EVALITEM( pFunc ) )
               {
                  if( hb_vmRequestReenter() )
                  {
                     hb_vmPushEvalSym();
                     hb_vmPush( pFunc );
                     hbwapi_vmPush_HANDLE( hDlg );
                     hb_vmPushNumInt( message );
                     hb_vmPushNumInt( wParam );
                     hb_vmPushNumInt( lParam );
                     hb_vmSend( 4 );
                     lReturn = ( INT_PTR ) hbwapi_par_RESULT( -1 );
                     hb_vmRequestRestore();
                  }
               }
               else
               {
                  /* TODO: internal error: missing codeblock */
               }
               break;
         }

         switch( message )
         {
            case WM_COMMAND:
               switch( LOWORD( wParam ) )
               {
                  case IDOK:
                     EndDialog( hDlg, IDOK );
                     lReturn = 0;
                     break;

                  case IDCANCEL:
                     EndDialog( hDlg, IDCANCEL );
                     lReturn = 0;
                     break;
               }
               break;

#if ! defined( HB_OS_WIN_CE )
            case WM_NCDESTROY:
#else
            case WM_DESTROY:
#endif
               if( _s->pFuncModal[ iIndex ] != NULL && _s->iTypeModal[ iIndex ] == 2 )
                  hb_itemRelease( ( PHB_ITEM ) _s->pFuncModal[ iIndex ] );
               _s->hDlgModal[ iIndex ]  = NULL;
               _s->pFuncModal[ iIndex ] = NULL;
               _s->iTypeModal[ iIndex ] = 0;
               lReturn = 0;
               break;
         }
      }
   }

   return lReturn;
}