예제 #1
0
static PHB_ITEM hbamf_cls_externalizable_instance( PHB_ITEM pClassFuncStr )
{
   PHB_DYNS pSymbol = hb_dynsymGet( hb_itemGetCPtr( pClassFuncStr ) );

   if( pSymbol )
   {
      PHB_ITEM pRetCopy = hb_itemNew( NULL );
      PHB_ITEM pNewItem = hb_itemNew( NULL );
      hb_itemMove( pRetCopy, hb_stackReturnItem() );

      hb_vmPushDynSym( pSymbol );
      hb_vmPushNil();
      hb_vmDo( 0 );

      hb_objSendMsg( hb_stackReturnItem(), "NEW", 0 );

      hb_itemMove( pNewItem, hb_stackReturnItem() );
      hb_itemMove( hb_stackReturnItem(), pRetCopy );

      hb_itemRelease( pRetCopy );

      if( pNewItem )
      {
         if( ! HB_IS_OBJECT( pNewItem ) )
         {
            hb_itemRelease( pNewItem );
            pNewItem = NULL;
         }
      }

      return pNewItem;
   }

   return NULL;
}
예제 #2
0
파일: hbcls.c 프로젝트: jiangxilong/core
HB_BOOL hbamf_is_cls_externalizable( HB_USHORT uiClass )
{
    PHB_DYNS pSymbol = hb_dynsymGet( "__CLSMSGTYPE" );
    HB_BOOL  result  = HB_FALSE;

    /* as far as i know, there is no exported Harbour C level api for this */

    if( uiClass && pSymbol )
    {
        PHB_ITEM pRetCopy = hb_itemNew( NULL );

        hb_itemMove( pRetCopy, hb_stackReturnItem() );

        hb_vmPushDynSym( pSymbol );
        hb_vmPushNil();
        hb_vmPushInteger( uiClass );
        hb_vmPushString( "EXTERNALIZABLE", 14 );
        hb_vmDo( 2 );

        if( hb_itemGetNI( hb_stackReturnItem() ) == HB_OO_MSG_CLASSDATA )
            result = HB_TRUE;

        hb_itemMove( hb_stackReturnItem(), pRetCopy );
        hb_itemRelease( pRetCopy );
    }

    return result;
}
예제 #3
0
/*
 * Call specific driver function to load any configuration needed...
 * 14/12/2008 - 20:05:26
 */
static
void SQLSYS_LOADINFO( const char *DriverName, SQLSYS_INFO *pStruct )
{
   PHB_DYNS pDynSym = hb_dynsymFind( DriverName );

   if ( pDynSym && hb_dynsymIsFunction( pDynSym ) )
   {
      HB_TRACE(HB_TR_DEBUG,(" SQLSYS_LOADINFO( '%s', %p ) ... (LOADing)", DriverName, pStruct ));
      hb_vmPushDynSym( pDynSym );
      hb_vmPushNil();
      hb_vmPushPointer( ( void * ) pStruct );
      hb_vmDo( 1 );
   } else {
      HB_TRACE(HB_TR_DEBUG,(" SQLSYS_LOADINFO( '%s', %p ) ... ERROR: DRIVER NOT FOUND!!! ###", DriverName, pStruct ));      
      memset( pStruct, '\0', sizeof( SQLSYS_INFO ) );  
   }
}
예제 #4
0
static void hb_pp_StdRules( PHB_ITEM ppItem )
{
   static HB_BOOL s_fInit = HB_TRUE;
   static PHB_DYNS s_pDynSym;

   if( s_fInit )
   {
      s_pDynSym = hb_dynsymFind( "__PP_STDRULES" );
      s_fInit = HB_FALSE;
   }

   if( s_pDynSym )
   {
      hb_vmPushDynSym( s_pDynSym );
      hb_vmPushNil();
      hb_vmPush( ppItem );
      hb_vmProc( 1 );
   }
}
예제 #5
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());
}
예제 #6
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);
   }
}
예제 #7
0
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, PVOID pvReserved )
#endif
{
   static HB_BOOL s_fInit = HB_FALSE;
   BOOL fResult = TRUE;

   HB_SYMBOL_UNUSED( pvReserved );

   switch( dwReason )
   {
      case DLL_PROCESS_ATTACH:
         s_hInstDll = ( HINSTANCE ) hInstance;
         s_lLockCount = s_lObjectCount = 0;
         s_IClassFactoryObj.lpVtbl = ( IClassFactoryVtbl * )
                                     &IClassFactory_Vtbl;

         DisableThreadLibraryCalls( ( HMODULE ) hInstance );

         s_fInit = ! hb_vmIsActive();
         if( s_fInit )
            hb_vmInit( HB_FALSE );

         hb_oleInit();

         if( ! s_fServerReady )
         {
            PHB_DYNS pDynSym = hb_dynsymFind( "DLLMAIN" );

            if( pDynSym && hb_dynsymIsFunction( pDynSym ) &&
                hb_vmRequestReenter() )
            {
               hb_vmPushDynSym( pDynSym );
               hb_vmPushNil();
               hb_vmProc( 0 );
               hb_vmRequestRestore();
            }
         }
         fResult = s_fServerReady ? TRUE : FALSE;
         break;

      case DLL_PROCESS_DETACH:
         s_fServerReady = HB_FALSE;
         if( s_pAction )
         {
            hb_itemRelease( s_pAction );
            s_pAction = NULL;
         }
         if( s_pMsgHash )
         {
            hb_itemRelease( s_pMsgHash );
            s_pMsgHash = NULL;
         }
         if( s_fInit )
         {
            hb_vmQuit();
            s_fInit = HB_FALSE;
         }
         break;
   }

   return fResult;
}
예제 #8
0
파일: toolbar.c 프로젝트: emazv72/core
static void hb_gt_wvw_TBMouseEvent( PWVW_WIN wvw_win, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
   POINT xy, colrow;
   SHORT keyCode  = 0;
   SHORT keyState = 0;

   PWVW_GLO wvw = hb_gt_wvw();

   HB_SYMBOL_UNUSED( hWnd );
   HB_SYMBOL_UNUSED( wParam );

   if( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE )
   {
      if( ! wvw_win->MouseMove )
         return;
   }

   xy.x = LOWORD( lParam );
   xy.y = HIWORD( lParam );

   colrow = hb_gt_wvw_TBGetColRowFromXY( wvw_win, xy.x, xy.y );

   hb_gt_wvw_SetMouseX( wvw_win, colrow.x );
   hb_gt_wvw_SetMouseY( wvw_win, colrow.y );

   switch( message )
   {
      case WM_LBUTTONDBLCLK:
         keyCode = K_LDBLCLK;
         break;

      case WM_RBUTTONDBLCLK:
         keyCode = K_RDBLCLK;
         break;

      case WM_LBUTTONDOWN:
      {
         HWND hWndFocus = GetFocus();

         if( hb_gt_wvw_GetControlClass( wvw_win, hWndFocus ) > 0 )
            SetFocus( hWnd );

         keyCode = K_LBUTTONDOWN;
         break;
      }

      case WM_RBUTTONDOWN:
         keyCode = K_RBUTTONDOWN;
         break;

      case WM_LBUTTONUP:
         keyCode = K_LBUTTONUP;
         break;

      case WM_RBUTTONUP:

         if( wvw_win->hPopup )
         {
            int nPopupRet;
            GetCursorPos( &xy );
            nPopupRet = ( int ) TrackPopupMenu( wvw_win->hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, xy.x, xy.y, 0, hWnd, NULL );
            if( nPopupRet )
               hb_gt_wvw_AddCharToInputQueue( nPopupRet );
            return;
         }
         else
         {
            keyCode = K_RBUTTONUP;
            break;
         }

      case WM_MBUTTONDOWN:
         keyCode = K_MBUTTONDOWN;
         break;

      case WM_MBUTTONUP:
         keyCode = K_MBUTTONUP;
         break;

      case WM_MBUTTONDBLCLK:
         keyCode = K_MDBLCLK;
         break;

      case WM_MOUSEMOVE:
         keyState = ( SHORT ) wParam;

         if( keyState == MK_LBUTTON )
            keyCode = K_MMLEFTDOWN;
         else if( keyState == MK_RBUTTON )
            keyCode = K_MMRIGHTDOWN;
         else if( keyState == MK_MBUTTON )
            keyCode = K_MMMIDDLEDOWN;
         else
            keyCode = K_MOUSEMOVE;
         break;

      case WM_MOUSEWHEEL:
         keyState = HIWORD( wParam );

         if( keyState > 0 )
            keyCode = K_MWFORWARD;
         else
            keyCode = K_MWBACKWARD;

         break;

      case WM_NCMOUSEMOVE:
         keyCode = K_NCMOUSEMOVE;
         break;
   }

   if( wvw->a.pSymWVW_TBMOUSE && keyCode != 0 && hb_vmRequestReenter() )
   {
      hb_vmPushDynSym( wvw->a.pSymWVW_TBMOUSE );
      hb_vmPushNil();
      hb_vmPushInteger( wvw_win->nWinId );
      hb_vmPushInteger( keyCode );
      hb_vmPushInteger( colrow.y );
      hb_vmPushInteger( colrow.x );
      hb_vmPushInteger( keyState );
      hb_vmDo( 5 );

      hb_vmRequestRestore();
   }

   hb_gt_wvw_AddCharToInputQueue( keyCode );
}
예제 #9
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;
}