예제 #1
0
파일: ZdCtlTim.cpp 프로젝트: DeegC/10d
UINT
fnTimerThreadProc( zPVOID p )
{
   ZTimer  *pZTimer = (ZTimer *) p;
   HWND    hWnd = pZTimer->m_hWnd;
   zUSHORT uInterval = (zUSHORT) pZTimer->m_lInterval;
// DWORD   dwStart = GetTickCount( );

   // Stop if this has taken too long
// if( GetTickCount() - dwStart >= TIMELIMIT )
//     Cancel();

#ifdef DEBUG_ALL
   TraceLineI( "Starting Thread: ", (zLONG) AfxGetThread( ) );
#endif

   while ( mIs_hWnd( hWnd ) && pZTimer->m_bEnabled )
   {
      SysWait( uInterval );
      if ( mIs_hWnd( hWnd ) )
         ProcessImmediateEvent( pZTimer, 1, 0 );
   }

#ifdef DEBUG_ALL
   TraceLineI( "All Done!!! Exiting Thread: ", (zLONG) AfxGetThread( ) );
#endif

   if ( mIs_hWnd( hWnd ) )
      pZTimer->m_pThread = 0;

   return( 0 );

} // fnTimerThreadProc
예제 #2
0
파일: ZdCtlTim.cpp 프로젝트: DeegC/10d
// ZTime - ctor
ZTime::ZTime( ZSubtask *pZSubtask,
              CWnd     *pWndParent,
              ZMapAct  *pzmaComposite,
              zVIEW    vDialog,
              zSHORT   nOffsetX,
              zSHORT   nOffsetY,
              zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
       CWnd( ),
       ZMapAct( pZSubtask,             // base class ctor
                pzmaComposite,
                pWndParent,
                this,
                vDialog,
                nOffsetX,
                nOffsetY,
                pCtrlDef,
                "Time" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for ZTime", (zLONG) this );
#endif

   // Localize settings from XWD.

   CreateZ( );
}
예제 #3
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
TZPainterCtrl *
TZNoteBook::GetRealCtrl( )
{
   zSHORT nTabIdx = GetCurSel( );

#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::GetRealParent nActiveTab = ", nTabIdx );
#endif

   TZNotePage *pNotePage = m_pZNotePage;
   while ( pNotePage )
   {
      if ( pNotePage && pNotePage->m_nTabIdx == nTabIdx )
      {
//       TraceLineS( "TZNoteBook::GetRealParent located Caption: ",
//                   ((TZNoteBook *) pCtrl->m_pWndCtrl)->m_pchCaption );

         // set the TZNotePage as the real parent
         return( pNotePage );
      }

//    TraceLineI( ((TZNoteBook *) pCtrl->m_pWndCtrl)->m_pchCaption,
//                   ((TZNoteBook *) pCtrl->m_pWndCtrl)->m_nTabIdx );

      pNotePage = pNotePage->m_pNext;
   }

   return( this );
}
예제 #4
0
파일: ZDrCtl.cpp 프로젝트: arksoftgit/10c
zOPER_EXPORT void OPERATION
TraceRect( zCPCHAR cpcMessage,
           RECT&   rect )
{
   zCHAR  szBuffer[ 256 ];
   zSHORT nLth;

   nLth = zstrlen( cpcMessage );
   if ( nLth < sizeof( szBuffer ) - 32 )
      zstrcpy( szBuffer, cpcMessage );
   else
      nLth = 0;

   zstrcpy( szBuffer + nLth, " X:" );
   zltoa( rect.left, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " Y:" );
   zltoa( rect.top, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " W:" );
   zltoa( rect.right - rect.left, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " H:" );
// zltoa( rect.bottom - rect.top, szBuffer + nLth + 3 );
   TraceLineI( szBuffer, rect.bottom - rect.top );
}
예제 #5
0
파일: ZDrOpt.cpp 프로젝트: arksoftgit/10c
// Function to process the options in order.
void
fnOrderedOptions( const ZOption *pZOption,
                  WPARAM wParam,
                  LPARAM lParam )
{
   TraceLineI( *(pZOption->m_pzsTag), pZOption->m_uOptionID );
}
예제 #6
0
파일: ZdCtl.cpp 프로젝트: DeegC/ZeidonTools
/////////////////////////////////////////////////////////////////////////////
// ZTitleTip
//
ZTitleTip::ZTitleTip( zLONG lHoverDelay )
{
#ifdef DEBUG_ALL
   TraceLineI( "ZTitleTip::ctor Delay: ", lHoverDelay );
#endif

   // Register the window class if it has not already been registered.
   WNDCLASS wndcls;
   HINSTANCE hInst = AfxGetInstanceHandle( );

   if ( ::GetClassInfo( hInst, ZTITLETIP_CLASSNAME, &wndcls ) == 0 )
   {
      // Otherwise we need to register a new class.
      wndcls.style         = CS_SAVEBITS;
      wndcls.lpfnWndProc   = ::DefWindowProc;
      wndcls.cbClsExtra    = wndcls.cbWndExtra = 0;
      wndcls.hInstance     = hInst;
      wndcls.hIcon         = 0;
      wndcls.hCursor       = LoadCursor( hInst, IDC_ARROW );
      wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1);
      wndcls.lpszMenuName  = 0;
      wndcls.lpszClassName = ZTITLETIP_CLASSNAME;
      if ( AfxRegisterClass( &wndcls ) == 0 )
         AfxThrowResourceException( );
   }

   m_dwLastLButtonDown  = ULONG_MAX;
   m_ulDblClickInterval = GetDoubleClickTime( );
   m_bCreated           = FALSE;
   m_pParentWnd         = 0;
   m_lHoverDelay        = lHoverDelay;
}
예제 #7
0
// Function to process the controls in order.
void
fnOrderedCtrls( const ZMapAct *pzma,
                WPARAM wParam,
                LPARAM lParam )
{
   zCHAR szBuffer[ 64 ];
   zstrcpy( szBuffer, *(pzma->m_pzsTag) );
   zstrcat( szBuffer, ": " );
   TraceLineI( szBuffer, pzma->m_nIdNbr );
}
예제 #8
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
void
TZNotePage::RealizeCtrl( zBOOL bCreate )
{
#ifdef DEBUG_ALL
   TraceLineI( "TZNotePage::RealizeCtrl", bCreate );
#endif
   if ( bCreate )
      TZPainterCtrl::RealizeCtrl( TRUE );

   if ( m_pWndCtrl && mIs_hWnd( m_pWndCtrl->m_hWnd ) )
      m_pWndCtrl->ShowWindow( bCreate ? SW_SHOW : SW_HIDE );
}
예제 #9
0
파일: ZdCtlTim.cpp 프로젝트: DeegC/10d
// ZTimer - ctor
ZTimer::ZTimer( ZSubtask *pZSubtask,
                CWnd     *pWndParent,
                ZMapAct  *pzmaComposite,
                zVIEW    vDialog,
                zSHORT   nOffsetX,
                zSHORT   nOffsetY,
                zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
        CStatic( ),
        ZMapAct( pZSubtask,             // base class ctor
                 pzmaComposite,
                 pWndParent,
                 this,
                 vDialog,
                 nOffsetX,
                 nOffsetY,
                 pCtrlDef,
                 "Timer" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for ZTimer", (zLONG) this );
#endif

   m_ulMapActFlags &= ~zMAPACT_FOCUS_ENABLED;

   // Make it a hidden window.
   Attr.Style &= ~(WS_TABSTOP | WS_VISIBLE );
   Attr.Style |= WS_DISABLED;
   Attr.X = 0;
   Attr.Y = 0;
   Attr.W = 0;
   Attr.H = 0;

   // Localize settings from XWD.
   m_lInterval = pCtrlDef->StyleX;
   m_bEnabled = TRUE;
   m_pThread = 0;

// TraceLineI( "Timer interval --> ", m_lInterval );
// TraceLineS( "string interval -> ", pCtrlDef->Text );
// TraceLineI( "Timer enabled ---> ", m_bEnabled );

#ifdef zREMOTE_SERVER
   zCHAR szInterval[ 32 ];

   _ltoa_s( m_lInterval, szInterval );
   SetRemoteZCtrlAttribute( this, "Timer", "Interval", szInterval );
#endif

   CreateZ( );
}
예제 #10
0
void
ZMLE::OnKeyDown( UINT uKey, UINT uRepeatCnt, UINT uFlags )
{
#ifdef DEBUG_ALL
   TraceLineI( "ZMLE::OnKeyDown - ", uKey );
#endif
   if ( uKey == VK_TAB )
   {
// do special method in driver for this???
//      m_pZSubtask->m_pZFWnd->SendMessage( WM_COMMAND,
//                                          zPROCESS_ZEIDON_TAB, 0 );
   }

// CEdit::OnKeyDown( uKey, uRepeatCnt, uFlags );
   Default( );             // pass it along to parent
}
예제 #11
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
void
TZNoteBook::SelChanging( NMHDR *pNMHDR, LRESULT *pResult )
{
// Default( );

   zSHORT nCurrIdx = GetCurSel( );
#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::SelChanging: ", nCurrIdx );
#endif

   *pResult = 0;
   TZNotePage *pCurrNotePage = GetActivePage( );
   if ( pCurrNotePage )
   {
      pCurrNotePage->ShowWindow( SW_HIDE );
   }
}
예제 #12
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
void
TZNoteBook::SelChange( NMHDR *pNMHDR, LRESULT *pResult )
{
// Default( );

   zSHORT nCurrIdx = GetCurSel( );
#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::SelChange: ", nCurrIdx );
#endif

   *pResult = 0;
   TZNotePage *pCurrNotePage = GetActivePage( );
   if ( pCurrNotePage )
   {
      ActivateTab( pCurrNotePage->m_nTabNbr );
   }
}
예제 #13
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
void
TZNoteBook::RealizeCtrl( zBOOL bCreate )
{
#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::RealizeCtrl bCreate = ", bCreate );
#endif
   if ( bCreate )
   {
      TZPainterCtrl::RealizeCtrl( TRUE );
   // TZNotePage *pCurrNotePage = GetActivePage( );
   // if ( pCurrNotePage )
   // {
   //    ActivateTab( pCurrNotePage->m_nTabNbr );
   // }
   }

   if ( m_pWndCtrl && mIs_hWnd( m_pWndCtrl->m_hWnd ) )
      m_pWndCtrl->ShowWindow( bCreate ? SW_SHOW : SW_HIDE );
}
예제 #14
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
TZNotePage *
TZNoteBook::GetActivePage( )
{
   zSHORT nCurrIdx = GetCurSel( );
#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::GetActivePage: ", nCurrIdx );
#endif

   TZNotePage *pCurrNotePage = m_pZNotePage;
   while ( pCurrNotePage )
   {
      if ( pCurrNotePage->m_nTabIdx == nCurrIdx )
         break;

      pCurrNotePage = pCurrNotePage->m_pNext;
   }

   return( pCurrNotePage );
}
예제 #15
0
파일: ZDrCtl.cpp 프로젝트: arksoftgit/10c
zOPER_EXPORT void OPERATION
TraceSize( zCPCHAR cpcMessage,
           SIZE&   size )
{
   zCHAR  szBuffer[ 256 ];
   zSHORT nLth;

   nLth = zstrlen( cpcMessage );
   if ( nLth < sizeof( szBuffer ) - 32 )
      zstrcpy( szBuffer, cpcMessage );
   else
      nLth = 0;

   zstrcpy( szBuffer + nLth, " cX=" );
   zltoa( size.cx, szBuffer + nLth + 4 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " cY=" );
// zltoa( size.cy, szBuffer + nLth + 4 );
   TraceLineI( szBuffer, size.cy );
}
예제 #16
0
파일: ZDrCtl.cpp 프로젝트: arksoftgit/10c
zOPER_EXPORT void OPERATION
TracePoint( zCPCHAR cpcMessage,
            POINT&  pt )
{
   zCHAR  szBuffer[ 256 ];
   zSHORT nLth;

   nLth = zstrlen( cpcMessage );
   if ( nLth < sizeof( szBuffer ) - 32 )
      zstrcpy( szBuffer, cpcMessage );
   else
      nLth = 0;

   zstrcpy( szBuffer + nLth, " X=" );
   zltoa( pt.x, szBuffer + nLth + 3 );
   nLth = zstrlen( szBuffer );
   zstrcpy( szBuffer + nLth, " Y=" );
// zltoa( pt.y, szBuffer + nLth + 3 );
   TraceLineI( szBuffer, pt.y );
}
예제 #17
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
TZNotePage *
TZNoteBook::GetPage( zSHORT nPageNbr )
{
#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::GetPage: ", nPageNbr );
#endif
   TZNotePage *pCurrNotePage = 0;
   if ( nPageNbr > 0 && nPageNbr <= m_nPageCnt )
   {
      pCurrNotePage = m_pZNotePage;
      while ( pCurrNotePage )
      {
         if ( pCurrNotePage->m_nTabNbr == nPageNbr )
            break;

         pCurrNotePage = pCurrNotePage->m_pNext;
      }
   }

   return( pCurrNotePage );
}
예제 #18
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
void
TZNoteBook::EndPaint( )
{
   if ( mIs_hWnd( m_hWnd ) )
   {
      CString cs = "Sel." + m_csTag;
      zLONG lCurrSel = GetProfileNbr( m_pPainterWindow->m_vDialog, "Design",
                                      m_pPainterWindow->m_csDlgTag,
                                      m_pPainterWindow->m_csWndTag, cs );
#ifdef DEBUG_ALL
      TraceLineI( "TZNoteBook::EndPaint: ", lCurrSel );
#endif

      m_bInitialized = TRUE;
      SetCurSel( 0 );
      PostMoveCtrl( );

      SetVisibility( 0x0100, -1, 1 );  // set all children invisible
      SetVisibility( 0x0101, 0, -1 );  // set self (only) visible/selectable

      if ( m_pCtrlCover )
         m_pCtrlCover->SetWindowPos( 0, 0, 0, 0, 0,
                                     SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW |
                                       SWP_NOZORDER | SWP_HIDEWINDOW );

      Invalidate( );
      if ( lCurrSel > 0 )
         ActivateTab( (zSHORT) lCurrSel );
      else
         ActivateTab( 1 );

      UpdateWindow( );
   }

// if ( m_pCtrlCover )
//    m_pCtrlCover->SetWindowPos( 0, 0, 0, 0, 0,
//                                SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW |
//                                   SWP_NOZORDER | SWP_SHOWWINDOW );
}
예제 #19
0
//***********************************************************************
//
//  ENTRY:       zNetReceive
//
//  PURPOSE:     To retrieve a block of data from the network.
//
//  DESCRIPTION: Zeidon Core call this operation when it is expecting data
//               from the network.
//
//               Core expects zNetReceive to create a buffer to hold the data
//               and set ppszReturnBuffer to point to the buffer.  The created
//               buffer need be valid only until the next zNet... call--
//               zNetReceive does not have to worry about keeping track of
//               data that has previously been retrieved.
//
//               uLth specifies the number of bytes Core is expecting.  If
//               there is not enough data from the network to satisfy Core,
//               then zNetReceive must return( zCALL_ERROR ).
//
//  PARAMETERS:  pszNetworkName - Unique internal 'Zeidon' name of the
//                                network.
//               ppHandle       - Network pointer to buffer created in
//                                zNetStartup.
//               ppvConnPtr     - Connection pointer to buffer created in
//                                zNetOpenConnection.
//               ppszReturnBuff - Pointer to a pointer that will point to the
//                                retrieved data.
//               uLth           - Number of bytes Core is expecting to receive.
//               cDataType      - Specifies whether data is a string
//                                (zTYPE_STRING) or a blob (zTYPE_BLOB).
//                                NOTE: Ignored for WinSock implementation.
//
//  RETURNS:     0           - Data received OK.
//               zCALL_ERROR - Error.
//
//***********************************************************************
int    PASCAL
zNetReceive( LPSTR    pszNetworkName,
             LPVOID  * ppHandle,
             LPVOID  * ppvConnPtr,
             LPSTR  * ppszReturnBuffer,
             UINT     uLth,
             char     cDataType )
{
   LONG         lTickCount = GetTickCount( );
   LPSOCKETS    lpSockets = (LPSOCKETS) *ppHandle;
   LPCONNECTION lpConn = (LPCONNECTION) *ppvConnPtr;

   if ( lpConn->nTraceLevel > 1 )
   {
      TraceLineI( "(zwinsock) zNetReceive -- uLth = ", uLth );
   }

   // Check the flag to see if the last send/receive command was a send.  If
   // the last command was a send, then the send buffer might need to be
   // flushed.
   if ( !lpConn->bLastReceive )
   {
      if ( lpConn->nTraceLevel > 1 )
      {
         TraceLineS( "(zwinsock) flushing send buffer", "" );
      }

      if ( zNetSend( pszNetworkName, ppHandle, ppvConnPtr, 0, 0, 0 ) != 0 )
         return( zCALL_ERROR );

      lpConn->bLastReceive = TRUE;

      if ( lpConn->nTraceLevel > 1 )
      {
         TraceLineS( "(zwinsock) Done flushing send buffer", "" );
      }
   }

   // If the buffer lth is 0, then we need to fill it up with network data.
   if ( lpConn->usBufferLth == 0 )
   {
      int iBytes;

      if ( lpConn->nTraceLevel > 0 )
      {
         TraceLineS( "(zwinsock) Filling empty receive buffer", "" );
      }

      iBytes = recv( lpConn->sock, lpConn->pszBuffer, BUFFER_LTH, 0 );
      if ( iBytes == SOCKET_ERROR || iBytes == 0 )
      {
         TraceLineS( "(zwinsock) Error filling receive buffer", "" );
         fnShowError( "recv" );
         return( zCALL_ERROR );
      }

      if ( lpConn->nTraceLevel > 0 )
      {
         TraceLineI( "(zwinsock) Bytes read = ", iBytes );

         if ( lpConn->nTraceLevel > 1 )
         {
            TraceLineS( "(zwinsock) Tracing buffer...", "" );
            TraceBuffer( "(zwinsock)",  lpConn->pszBuffer, iBytes );
         }
      }

      lpConn->pszNextByte = lpConn->pszBuffer;
      lpConn->usBufferLth = iBytes;
   }

   // It is possible that the incoming line didn't fit into the current buffer
   // because the buffer contained multiple lines of data.  This means that
   // we need to consolidate the data from buffer with data that still hasn't
   // been retrieved.
   if ( uLth > lpConn->usBufferLth )
   {
      int iBytes;

      if ( lpConn->nTraceLevel > 0 )
      {
         TraceLineS( "(zwinsock) Trying to consolidate receive buffer", "" );
      }

      // Copy the unused data to the beginning of the buffer.  This should
      // free up room at the end of the buffer to retrieve data off the network.
      memcpy( lpConn->pszBuffer, lpConn->pszNextByte, lpConn->usBufferLth );

      // Now retrieve data from the network, appending it to the end of the
      // data in the buffer.
      iBytes = recv( lpConn->sock, &lpConn->pszBuffer[ lpConn->usBufferLth ],
                     BUFFER_LTH - lpConn->usBufferLth, 0 );
      if ( iBytes == SOCKET_ERROR || iBytes == 0 )
      {
         fnShowError( "recv" );
         TraceLineS( "(zwinsock) Error trying to extend buffer", "" );
         return( zCALL_ERROR );
      }

      if ( lpConn->nTraceLevel > 0 )
      {
         TraceLineI( "(zwinsock) Bytes read = ", iBytes );

         if ( lpConn->nTraceLevel > 1 )
         {
            TraceLineS( "(zwinsock) Tracing buffer...", "" );
            TraceBuffer( "(zwinsock)",
                         &lpConn->pszBuffer[ lpConn->usBufferLth ], iBytes );
         }
      }

      lpConn->pszNextByte  = lpConn->pszBuffer;
      lpConn->usBufferLth += iBytes;

      // Check again to see if the buffer contains all the data.  If not,
      // set error and get out.
      if ( uLth > lpConn->usBufferLth )
      {
         TraceLineS( "(zwinsock) Error -- buffer can't hold data", "" );
         return( zCALL_ERROR );
      }
   }

   *ppszReturnBuffer = lpConn->pszNextByte;
   lpConn->pszNextByte += uLth;
   lpConn->usBufferLth -= uLth;

   lpConn->lReceiveTickCount += GetTickCount( ) - lTickCount;

   return( 0 );

} // zNetReceive
예제 #20
0
파일: ZDrMsgQ.cpp 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: fnPushMsgQ_State
//
// PURPOSE: This routine sets the state of the message queue object
//          and pushes the state on the stack.  The stack is organized
//          as follows:
//
//             zLONG  lCurrentState;
//             zSHORT nEntryCnt;
//             zSHORT nEntryMax;
//             zLONG  lState[ 1 ];
//             zLONG  lState[ 2 ];
//                 .
//                 .
//                 .
//
//             zLONG  lState[ n ];  // same as lCurrentState
//
/////////////////////////////////////////////////////////////////////////////
void
fnPushMsgQ_State( zVIEW vMsgQ,
                  zLONG lState )
{
   zPCHAR  pStack;    // blob containing Status Stack
   zUSHORT uCnt;
   zUSHORT uMax;

#ifdef zREMOTE_SERVER
   // Protect this with a semaphore!!!
   SysMutexLock( vSubtask, "ZDm", 0, 0 );
// TraceLineS( "PushMsgQ_State Lock Mutex ZDm", "" );
// DisplayObjectInstance( vMsgQ, 0, 0 );
// ::MessageBox( 0, "PushMsgQ", "ZDr", MB_OK );
#endif

   GetAddrForAttribute( (zPCHAR *) &pStack, vMsgQ, szlTask, szlStatus );
   if ( pStack )
   {
      uCnt = *((zPSHORT) (pStack + sizeof( zLONG )));
      uMax = *((zPSHORT) (pStack + sizeof( zLONG ) + sizeof( zSHORT )));

      // If there is no more room on the stack ... make more room.
      if ( uCnt >= uMax )
      {
         zULONG ulBlobLth;
         zULONG ulLth;

         uMax += 10;
         ulLth = sizeof( zLONG ) + 2 * sizeof( zSHORT ) + uMax * sizeof( zLONG );
         ulBlobLth = ulLth;
         zPCHAR pch = new char[ ulLth ];
         GetBlobFromAttribute( pch, &ulBlobLth, vMsgQ, szlTask, szlStatus );
         if ( ulLth != ulBlobLth + 10 * sizeof( zLONG ) )
            OperatorSend( 0, szlDrvr, "PushMsgQ_State", TRUE );
         else
            TraceLineI( "Message queue stack expanded to ", ulLth );

         SetAttributeFromBlob( vMsgQ, szlTask, szlStatus, pch, ulLth );
         GetAddrForAttribute( (zPCHAR *) &pStack, vMsgQ, szlTask, szlStatus );
         *((zPSHORT) (pStack + sizeof( zLONG ) + sizeof( zSHORT ))) = uMax;
         delete [] pch;
      }

      (*((zPSHORT) (pStack + sizeof( zLONG ))))++;    // increment EntryCnt
      *((zPLONG) pStack) = lState;                    // set CurrentState
      *((zPLONG) (pStack + sizeof( zLONG ) +          // set State[ n ]
                   2 * sizeof( zSHORT ) +
                   uCnt * sizeof( zLONG ))) = lState; // (not incrementing
                                                      //  uCnt since not
                                                      //  used hereafter)
   }
   else
   {
      TraceLineS( "PushMsgQ_State Lock Mutex ZDm: ", "NULL Status?" );
      DisplayObjectInstance( vMsgQ, 0, 0 );
      ::MessageBox( 0, "PushMsgQ_State NULL Status?", "ZDr Error", MB_OK );
   }

#ifdef zREMOTE_SERVER
// TraceLineS( "PushMsgQ_State Unlock Mutex ZDm", "" );
   SysMutexUnlock( vSubtask, "ZDm", 0 );
#endif
}
예제 #21
0
// ZMLE - ctor
ZMLE::ZMLE( ZSubtask *pZSubtask,
            CWnd     *pWndParent,
            ZMapAct  *pzmaComposite,
            zVIEW    vDialog,
            zSHORT   nOffsetX,
            zSHORT   nOffsetY,
            zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
      CEdit( ),
      ZMapAct( pZSubtask,        // base class ctor
               pzmaComposite,
               pWndParent,
               this,
               vDialog,
               nOffsetX,
               nOffsetY,
               pCtrlDef,
               "MLE" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for ZMLE", (zLONG) this );
   if ( m_pzsVName )
   {
      TraceLineS( "ZMLE ViewName", *m_pzsVName );
      TraceLineS( "ZMLE Entity", *m_pzsEName );
      TraceLineS( "ZMLE Attribute", *m_pzsAName );
   }
#endif

   m_ulLth = 0;
   if ( m_ulMapActFlags & zMAPACT_USE_SUBTASK_BRUSH )
   {
      mDeleteInit( m_pBrush );
      m_clrBk = 0;
   }

   if ( pCtrlDef->Subtype & zCONTROL_SIZEABLEBORDER )
      Attr.Style |= WS_THICKFRAME;
   else
   if ( (pCtrlDef->Subtype & zCONTROL_BORDEROFF) )
      Attr.Style &= ~WS_BORDER;
   else
      Attr.Style |= WS_BORDER;

   if ( pCtrlDef->Subtype & zCONTROL_NOTABSTOP )
      Attr.Style &= ~WS_TABSTOP;
   else
      Attr.Style |= WS_TABSTOP;

   Attr.Style &= ~(WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL);
   Attr.Style |= ES_AUTOVSCROLL | WS_VSCROLL;
   Attr.Style |= ES_MULTILINE | ES_WANTRETURN;

   if ( pCtrlDef->Subtype & zEDITBOX_LOWERCASE )
      Attr.Style |= ES_LOWERCASE;

   if ( pCtrlDef->Subtype & zEDITBOX_UPPERCASE )
      Attr.Style |= ES_UPPERCASE;

#ifndef zREMOTE_SERVER
   if ( pzmaComposite == 0 ||
        (pzmaComposite->m_ulMapActFlag2 & zMAPACT_CREATE_CHILDREN) )
#endif
   {
      CreateZ( );
   }
}
예제 #22
0
파일: tzadwexp.c 프로젝트: arksoftgit/10c
/*************************************************************************************************
**
**    OPERATION: SetRptShapeFromBlob
**
*************************************************************************************************/
zOPER_EXPORT zLONG /*GLOBAL */  OPERATION
SetRptShapeFromBlob( zVIEW vReportDef )
{

   zCHAR   szBlob[ 8 + (6 * sizeof( zLONG )) ];
// zVIEW   vReport;
// zLONG   lSubtype;
   zULONG  ulPenColor = 0xFF000000;
   zULONG  ulShapeColor = 0xFF000000;
   zULONG  ulLth = sizeof( szBlob );

   zmemset( szBlob, 0, ulLth );
   GetBlobFromAttribute( szBlob, &ulLth, vReportDef, "Control", "CtrlBOI" );
// TraceLineI( "Shape control blob lth = ", ulLth );
   if ( ulLth == sizeof( szBlob ) ||
        ulLth == sizeof( szBlob ) - (1 * sizeof( zLONG )) || // remove this soon
        ulLth == sizeof( szBlob ) - (2 * sizeof( zLONG )) )
   {
      zLONG   lPenWidth;
      zLONG   lPenType;
      zLONG   lRoundValue;
      zLONG   lFlags = 0;

      if ( szBlob[ 4 ] == TRUE )
      {
         TraceLineI( "****   Horizontal Line    **** ", szBlob[ 4 ] );
         SetAttributeFromInteger( vReportDef, "Control", "BorderBottom", szBlob[ 4 ] );
      }

/*
      SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED,
                    szBlob[ 0 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "RoundRect", zCONTROL_STATUS_CHECKED,
                    szBlob[ 1 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "Ellipse", zCONTROL_STATUS_CHECKED,
                    szBlob[ 2 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "Diamond", zCONTROL_STATUS_CHECKED,
                    szBlob[ 3 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "HorizontalLine", zCONTROL_STATUS_CHECKED,
                    szBlob[ 4 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "VerticalLine", zCONTROL_STATUS_CHECKED,
                    szBlob[ 5 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "DiagonalDescend", zCONTROL_STATUS_CHECKED,
                    szBlob[ 6 ] ? TRUE : FALSE );
      SetCtrlState( vSubtask, "DiagonalAscend", zCONTROL_STATUS_CHECKED,
                    szBlob[ 7 ] ? TRUE : FALSE );
*/

      lPenWidth = *((zPLONG) (szBlob + 8));
      lPenType = *((zPLONG) (szBlob + 8 + sizeof( zLONG )));
      ulPenColor = *((zPLONG) (szBlob + 8 + (2 * sizeof( zLONG ))));
      lRoundValue = *((zPLONG) (szBlob + 8 + (3 * sizeof( zLONG ))));
      if ( ulLth == sizeof( szBlob ) )
      {
         ulShapeColor = *((zPULONG) (szBlob + 8 + (4 * sizeof( zLONG ))));
         lFlags = *((zPLONG) (szBlob + 8 + (5 * sizeof( zLONG ))));
      }

      zltoa( ulPenColor, szBlob );
      SetAttributeFromString( vReportDef, "Control", "wLineColorText", szBlob );
      SetAttributeFromInteger( vReportDef, "Control", "wLineColorInt", ulPenColor );
      SetAttributeFromInteger( vReportDef, "Control", "BorderWidth", lPenWidth );
      switch ( lPenType )
      {
         case 1:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 1 );
            break;

         case 2:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 2 );
            break;

         case 3:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 3 );
            break;

         case 4:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 4 );
            break;

         default:
            SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 0 );
            break;
      }


      zltoa( lRoundValue, szBlob );
      //SetCtrlText( vSubtask, "RoundValue", szBlob );
   }
   else
   {
      //SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED, TRUE );
      //SetCtrlText( vSubtask, "PenWidth", "1" );
   }

   /*
   SetCtrlProperty( vSubtask, "__ColorLine",
                    zCONTROL_PROPERTY_INTEGER_DATA,
                    ulPenColor, 0 );
   SetCtrlProperty( vSubtask, "__ColorShape",
                    zCONTROL_PROPERTY_INTEGER_DATA,
                    ulShapeColor, 0 );
   */

   return( 0 );
} // SetRptShapeFromBlob
예제 #23
0
/*

   Dialog procedure to handle messages posted by WinSock stack.  Only used
   for sockets set up to Listen.

*/
LRESULT WINAPI fnWinsockDlgProc( HWND   hWnd,
                                 UINT   message,
                                 WPARAM wParam,
                                 LPARAM lParam )
{
   switch ( message )
   {
      case WM_CREATE:
         TraceLineI( "(zwinsock) Window created! hWnd = ", (LONG) hWnd );
         break;

      case WSA_READ:
         if ( WSAGETSELECTEVENT( lParam ) == FD_READ )
         {
            SOCKET sock;
            long   lBlockOff = FALSE;
            ConnectionRecord cr;
            LPVOID  pv;

            sock = (SOCKET) wParam;

            // We have received data from the client.  We must now
            // make the socket a blocking socket so that we can send AND
            // RECEIVE the data synchronously. ( If the sending socket is
            // not blocking, then the receiving socket is not blocking)
            //
            // To make the socket blocking we must turn off asynchronous
            // messages (via WSAASyncSelect) and then turn on blocking
            // (via ioctlsocket).
            if ( WSAAsyncSelect( sock, hWnd, 0, 0 ) == SOCKET_ERROR )
            {
               fnShowError( "WSAAsyncSelect" );
               closesocket( sock );
               return( 0 );
            }

            if ( ioctlsocket( sock, FIONBIO, &lBlockOff ) == SOCKET_ERROR )
            {
               fnShowError( "ioctlsocket" );
               MessageBox( 0, "ioctlsocket( ) failed", szlErrorTitle, MB_OK );
               closesocket( sock );
               return( 0 );
            }

            // We can now process the message synchronously.
            memset( &cr, 0, sizeof( ConnectionRecord ) );

            // Set up a buffer to receive network traffic.
            cr.hBufferMem = GlobalAlloc( GPTR, BUFFER_LTH );
            if ( cr.hBufferMem == 0 )
            {
               MessageBox( 0, "Out of memory", szlErrorTitle, MB_OK );
               return( 0 );
            }
            cr.pszBuffer = GlobalLock( cr.hBufferMem );

            // Init connection info.
            cr.sock        = sock;
            cr.pszNextByte = cr.pszBuffer;
            cr.usBufferLth = 0;
            cr.nTraceLevel = TRACELEVEL;

            if ( cr.nTraceLevel > 0 )
            {
               TraceLineS( "(zwinsock) A message has been received", "" );
            }

            pv = &cr;

            // HANDLING OF MESSAGE GOES HERE!!!!!!
            ReceiveBootstrapFile( &pv );

            GlobalUnlock( cr.hBufferMem );
            GlobalFree( cr.hBufferMem );

            closesocket( sock );
         }
         else
         {
            // Closing connection...
            TraceLineS( "(zwinsock) Closing connection.", "" );
         }

         return( 0 );

      case WSA_ACCEPT:
         if ( WSAGETSELECTERROR( lParam ) == 0 )
         {
            SOCKADDR_IN AcceptSocket;     // Accept socket addr - internet style
            int         iAcceptSocketLth; // Accept socket addr length
            SOCKET      sock;

            sock = (SOCKET) wParam;

            /*
            *   Accept the incoming connection.
            */
            iAcceptSocketLth = sizeof( AcceptSocket );
            sock = accept( sock, (struct sockaddr FAR *) &AcceptSocket,
                           (int FAR *) &iAcceptSocketLth );

            if ( sock < 0 )
            {
               fnShowError( "accept" );
               MessageBox( 0, "accept(sock) failed", szlErrorTitle, MB_OK );
               return( 0 ); // WSA_ACCEPT
            }

            /*
            *   Send main window a WSA_READ when either data is pending on
            *   the socket (FD_READ) or the connection is closed (FD_CLOSE)
            */
            if ( WSAAsyncSelect( sock, hWnd, WSA_READ,
                                 FD_READ | FD_CLOSE ) == SOCKET_ERROR )
            {
               fnShowError( "WSAAsyncSelect" );
               MessageBox( 0, "Select(sock) failed", szlErrorTitle, MB_OK );
               closesocket( sock );
               return( 0 );
            }

            TraceLineS( "(zwinsock) Connection accepted OK!", "" );
         }
         else
         {
            SOCKET sock = (SOCKET) wParam;

            fnShowError( "accept" );
            MessageBox( 0, "accept failed", szlErrorTitle, MB_OK );

            /*
            *   Cancel any further notifications.
            */
            WSAAsyncSelect( sock, hWnd, 0, 0 );
         }

         return( 0 ); // WSA_ACCEPT

   } // switch ( message )...

   return DefWindowProc( hWnd, message, wParam, lParam );

} // fnWinsockDlgProc
예제 #24
0
파일: ZDrCtl.cpp 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
//   bSubcontrol - TRUE  - add controls to existing pZSubtask->m_pZMIXCtrl
//                 FALSE - delete existing pZSubtask->m_pZMIXCtrl and start
//                         a new list
//
/////////////////////////////////////////////////////////////////////////////
void OPERATION
CreateZeidonCtrls( zVIEW    vSubobject,
                   ZSubtask *pZSubtask,
                   CWnd     *pWndParent,
                   ZMapAct  *pzmaComposite,
                   zSHORT   nOffsetX,
                   zSHORT   nOffsetY,
                   zBOOL    bSubcontrol )
{
   zKZWDLGXO_Ctrl_DEF CtrlDef;
   zFARPROC_CONTROL lpfnCtrlProc;
   LPLIBRARY hCCtlLibrary;
   zPCHAR    pchDLL_Name;
   zPCHAR    pchCOP;
   zSHORT    nRC;

#ifdef DEBUG_ALL
   TraceLineX( "CreateZeidonCtrls parent - ", (zLONG) pZSubtask );
#endif

   nRC = CheckExistenceOfEntity( vSubobject, szlCtrl );
   if ( bSubcontrol == FALSE )
   {
      mDeleteInit( pZSubtask->m_pZMIXCtrl );
      if ( nRC > zCURSOR_UNCHANGED )
      {
         zLONG  lTempCtrlCnt;       // just to get the long temporarily

         GetIntegerFromAttribute( &lTempCtrlCnt, pZSubtask->m_vDialog,
                                  szlWnd, "CtrlCnt" );
//       TraceLineI( "CreateZeidonCtrls count ", lTempCtrlCnt );
         pZSubtask->m_pZMIXCtrl =
                     new ZMultiIdxSet( (fnCOMPARE) fnCompareCtrlNodes,
                                       (fnCOMPARE) fnSeekCtrlNode,
                                       lTempCtrlCnt );
         // Instead of having ZMultiIdxSet delete the nodes itself, we call
         // a recursive routine (fnDeleteCtrls) to guarantee the child
         // controls are deleted before their parents.
      }
      else
         pZSubtask->m_pZMIXCtrl = 0;

      CreateViewFromViewForTask( &(pZSubtask->m_vPE),
                                 pZSubtask->m_pZTask->m_vPE,
                                 pZSubtask->m_vDialog );
   }

#ifdef DEBUG_LODSTRUCT
   zmemset( CtrlDef.Tag, 0xFE, sizeof( CtrlDef ) );
// CtrlDef.CheckByte = 0xFE;
#endif
   while ( nRC > zCURSOR_UNCHANGED )
   {
      // Get the structure of attributes for this control.
      zPCHAR pch = 0;   // for derived Text attribute

      GetStructFromEntityAttrs( (zPCHAR) CtrlDef.Tag, vSubobject, szlCtrl );
#ifdef DEBUG_LODSTRUCT
      if ( CtrlDef.CheckByte != 0xFE )
         MessageBox( 0, "CtrlDef Structure Length Error",
                     "GetStructFromEntityAttrs", MB_OK );
   // zPCHAR pchCheckByte = (zPCHAR) &(CtrlDef.CheckByte);
   // pchCheckByte--;
   // if ( *pchCheckByte == (char) 0xFE )
   //    TraceLineS( "zdrctl CtrlDef CheckByte error??", "" );
#endif
      GetAddrForAttribute( (zPCHAR *) &pch, vSubobject, szlCtrl, szlD_Text );
      if ( *pch )
         zstrcpy( CtrlDef.Text, pch );

#ifdef DEBUG_ALL
      TraceLineS( "Tag ", CtrlDef.Tag );
      TraceLineI( "Type ", CtrlDef.Type );
      TraceLineI( "IdNbr ", CtrlDef.IdNbr );
      TraceLineI( "PSDLG_X ", CtrlDef.PSDLG_X );
      TraceLineI( "PSDLG_Y ", CtrlDef.PSDLG_Y );
      TraceLineI( "SZDLG_X ", CtrlDef.SZDLG_X );
      TraceLineI( "SZDLG_Y ", CtrlDef.SZDLG_Y );
#endif

      // The token is validated by the painter and/or conversion to
      // the executable object, but we check here anyway.
      nRC = SetCursorFirstEntityByInteger( pZSubtask->m_pZTask->m_vPE,
                                           szlCtrl, szlKey,
                                           CtrlDef.Type, 0 );
      if ( nRC != zCURSOR_SET )
      {
         TraceLine( "(drvr) ID (%d) not found (%d) in PPE for Ctrl: %s.%s.%s",
                    CtrlDef.Type, nRC,
                    pZSubtask->m_pzsDlgTag ? *(pZSubtask->m_pzsDlgTag) : "?",
                    pZSubtask->m_pzsWndTag ? *(pZSubtask->m_pzsWndTag) : "?",
                    CtrlDef.Tag );
         DisplayEntityInstance( pZSubtask->m_pZTask->m_vPE, szlCtrl );
         DisplayObjectInstance( pZSubtask->m_pZTask->m_vPE, 0, 0 );

         // Skip this one and try the next.
         nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 );
         continue;
      }

      GetAddrForAttribute( (zPCHAR *) &pchDLL_Name,
                           pZSubtask->m_pZTask->m_vPE, szlCtrl, szlDLL );
      GetAddrForAttribute( (zPCHAR *) &pchCOP,
                           pZSubtask->m_pZTask->m_vPE, szlCtrl, szlCOP );

      // If the DLL name is added to the list, this is the first time it
      // has been encountered ... so call its initialization routine.
      pZSubtask->m_pZTask->AddApplicationDLL( pZSubtask, pchDLL_Name );

      hCCtlLibrary = 0;  // set to zero for GetOperationDynamicCallAddress

      lpfnCtrlProc = (zFARPROC_CONTROL)
           GetOperationDynamicCallAddress( pZSubtask->m_vDialog,
                                           (LPLPLIBRARY) &hCCtlLibrary,
                                           pchDLL_Name, pchCOP,
                                           "(drvr) Ctrl" );

      try
      {
         if ( lpfnCtrlProc ) // && (k % 2) == 0 )
         {
//          TraceLineS( "Create Control: ", pchCOP );
            (*lpfnCtrlProc)( pZSubtask, pWndParent, pzmaComposite,
                             vSubobject, nOffsetX, nOffsetY, &CtrlDef );
         }
      }
#if 0
      catch( CResourceException *e )
      {
         zCHAR szMsg[ 256 ];
         e->GetErrorMessage( szMsg, sizeof( szMsg ) );
         zstrcat( szMsg,
      }
#endif
      catch( CException *e )
      {
         zCHAR szMsg[ 256 ];

         e->GetErrorMessage( szMsg, sizeof( szMsg ) );
         MessageSend( pZSubtask->m_vDialog, 0, "Zeidon Control", szMsg,
                      zMSGQ_MODAL_ERROR, FALSE );
         break;
      }

      nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 );

   }  // end of: while ( nRC == zCURSOR_UNCHANGED )  looping thru controls

   if ( bSubcontrol == FALSE )
   {
      DropView( pZSubtask->m_vPE );
      pZSubtask->m_vPE = 0;  // using this to determine Ctrls have been created

      // Ctrl creation is complete ... notify each ctrl.
      if ( pZSubtask->m_pZMIXCtrl )
      {
         pZSubtask->m_pZMIXCtrl->VisitInorder( (fnVISIT_INORDER) fnPostCreateCtrls,
                                               0, 0, 0 );
      }
   }
}
예제 #25
0
//***********************************************************************
//
//  ENTRY:       zNetStart
//
//  PURPOSE:     To initialize a network protocol.
//
//  DESCR:       This operation allocates a buffer to keep track of WinSock
//               information and calls WSAStartup to start the network.
//
//  PARAMETERS:  pszNetworkName - Unique internal 'Zeidon' name of the
//                                network.
//               ppHandle       - Void pointer that has been initialized to
//                                null.  The value of this pointer is passed
//                                to all later network calls.  This allows
//                                initialization data to be passed to later
//                                calls.
//
//  RETURNS:     0           - Network started OK.
//               zCALL_ERROR - Error starting network.
//
//***********************************************************************
int    PASCAL
zNetStart( LPSTR     pszNetworkName,
           LPVOID *   ppHandle,
           HINSTANCE hInstance,
           HWND      hwndTrace )
{
   WSADATA   WSAData;
   int       status;
   HGLOBAL   hMemHandle;
   LPSOCKETS lpSockets;
   HWND      hwnd;

   ghwndTrace = hwndTrace;
   *ppHandle = 0;

   if ( (status = WSAStartup( 0x0101, &WSAData ) ) != 0 )
   {
      char szTemp[80];

      wsprintf(szTemp, "Error loading starting WinSock: %d", status);
      MessageBox( 0, szTemp, szlErrorTitle, MB_OK );
      return( zCALL_ERROR );
   }

   TraceLineX( "(zwinsock) Task ID             = ", (LONG) hInstance );
   TraceLineX( "(zwinsock) WinSock Version     = ", WSAData.wVersion );
   TraceLineX( "(zwinsock) WinSock HighVersion = ", WSAData.wHighVersion );
   TraceLineS( "(zwinsock) WinSock Description = ", WSAData.szDescription );
   TraceLineS( "(zwinsock) System status       = ", WSAData.szSystemStatus );
   TraceLineI( "(zwinsock) Max sockets         = ", WSAData.iMaxSockets );
   TraceLineI( "(zwinsock) Max UPD datagram    = ", WSAData.iMaxUdpDg );

   if ( gnNetworkCount == 0 )
   {
      WNDCLASS  wc;

      memset( &wc, 0, sizeof( wc ) );
      wc.style         = 0;
      wc.lpfnWndProc   = fnWinsockDlgProc;
      wc.hInstance     = hInstance;
      wc.lpszClassName = "WinsockClientWindow";
      if ( !RegisterClass( &wc ) )
      {
         MessageBox( 0, "Error trying to create WinsockClientWindow class",
                     szlErrorTitle, MB_OK );
         WSACleanup( );
         return( zCALL_ERROR );
      }
   }

   gnNetworkCount++;

   hwnd = CreateWindow( "WinsockClientWindow",
                        "Winsock Client Window",
                        0,                         // Window style.
                        0, 0, 100, 100,            // Pos & size.
                        HWND_DESKTOP,              // Parent,
                        0,                         // Menu bar.
                        hInstance,                 //
                        0 );
   if ( hwnd == 0 )
   {
      MessageBox( 0, "Error create Winsock Client Window", szlErrorTitle, MB_OK );
      UnregisterClass( "WinsockClientWindow", hInstance );
      WSACleanup( );
      return( zCALL_ERROR );
   }

   hMemHandle = GlobalAlloc( GPTR, sizeof( SocketsRecord ) );
   if ( hMemHandle == 0 )
   {
      char szTemp[ 80 ];

      UnregisterClass( "WinsockClientWindow", hInstance );
      DestroyWindow( hwnd );
      WSACleanup( );
      wsprintf( szTemp, "Out of memory starting network '%s'", pszNetworkName );
      MessageBox( 0, szTemp, szlErrorTitle, MB_OK );
      return( zCALL_ERROR );
   }
   *ppHandle = GlobalLock( hMemHandle );

   lpSockets = *ppHandle;
   lpSockets->hMemHandle = hMemHandle;
   lpSockets->hwndMain   = hwnd;
   lpSockets->hwndTrace  = hwndTrace;
   lpSockets->sockListen = INVALID_SOCKET;

   return( 0 );

} // zNetStart
예제 #26
0
//***********************************************************************
//
//  ENTRY:       zNetSend
//
//  PURPOSE:     To send a block of data over the network.
//
//  DESCRIPTION: Zeidon Core call this operation when it needs to send data
//               over the network.
//
//  PARAMETERS:  pszNetworkName - Unique internal 'Zeidon' name of the
//                                network.
//               ppHandle       - Network pointer to buffer created in
//                                zNetStartup.
//               ppvConnPtr     - Connection pointer to buffer created in
//                                zNetOpenConnection.
//               pszBuffer      - Pointer to send buffer.  If pszBuffer is 0,
//                                then flush (send) any local buffer.
//               uLth           - Length of buffer.  If uLth is 0, then
//                                pszBuffer points to a null-terminated str.
//               cDataType      - Specifies whether data is a string
//                                (zTYPE_STRING) or a blob (zTYPE_BLOB).
//                                NOTE: Ignored for WinSock implementation.
//
//  RETURNS:     0           - Data sent OK.
//               zCALL_ERROR - Error.
//
//***********************************************************************
int    PASCAL
zNetSend( LPSTR   pszNetworkName,
          LPVOID  * ppHandle,
          LPVOID  * ppvConnPtr,
          LPSTR   pszBuffer,
          UINT     uLth,
          char     cDataType )
{
   int   iBytesToSend;
   int   iBytesSent;
   LONG         lTickCount = GetTickCount( );
   LPSOCKETS    lpSockets = (LPSOCKETS) *ppHandle;
   LPCONNECTION lpConn = (LPCONNECTION) *ppvConnPtr;

   if ( lpConn->nTraceLevel > 1 )
   {
      TraceLineI( "(zwinsock) zNetSend -- uLth = ", uLth );
   }

   // If the last command was a receive (as opposed to a send) then we need
   // to reset the buffer for sending.
   if ( lpConn->bLastReceive )
   {
      if ( lpConn->nTraceLevel > 1 )
      {
         TraceLineS( "(zwinsock) Resetting buffer for sending", "" );
      }

      lpConn->bLastReceive = FALSE;
      lpConn->pszNextByte  = lpConn->pszBuffer;
      lpConn->usBufferLth  = 0;
   }

   // Check to see if we need to flush the current buffer.
   if ( ( pszBuffer == 0 && lpConn->usBufferLth > 0 ) ||
        ( lpConn->usBufferLth + uLth > BUFFER_LTH ) )
   {
      if ( lpConn->nTraceLevel > 1 )
      {
         TraceLineI( "(zwinsock) Sending buffer of length ",
                     lpConn->usBufferLth );
         TraceBuffer( "(zwinsock)",  lpConn->pszBuffer, lpConn->usBufferLth );
      }

      iBytesToSend = lpConn->usBufferLth;

      do
      {
         iBytesSent = send( lpConn->sock, lpConn->pszBuffer, iBytesToSend, 0 );
         if ( iBytesSent == SOCKET_ERROR )
         {
            TraceLineS( "(zwinsock) send -- Error!", "" );
            fnShowError( "send" );
            return( zCALL_ERROR );
         }

         if ( lpConn->nTraceLevel > 1 )
         {
            TraceLineI( "(zwinsock) Bytes sent for send ", iBytesSent );
         }

         iBytesToSend -= iBytesSent;

      } while ( iBytesToSend > 0 );

      lpConn->usBufferLth = 0;
   }

   // If pszBuffer is non-zero, then we need to add the buffer data to the
   // send buffer.
   if ( pszBuffer )
   {
      if ( lpConn->nTraceLevel > 1 )
      {
         TraceLineS( "(zwinsock) Adding bytes to send buffer", "" );
      }

      memcpy( &lpConn->pszBuffer[ lpConn->usBufferLth ], pszBuffer, uLth );
      lpConn->usBufferLth += uLth;
   }

   lpConn->lSendTickCount += GetTickCount( ) - lTickCount;

   return( 0 );

} // zNetSend
예제 #27
0
파일: Z2MPAPI.cpp 프로젝트: arksoftgit/10c
// geoCountryCanada          39   Canada
// geoCountryUnitedStates   244   United States
zOPER_EXPORT zSHORT OPERATION
MapPointValidateAddress( zPCHAR pchStreet, zPCHAR pchCity, zPCHAR pchOtherCity,
                         zPCHAR pchRegion, zPCHAR pchPostalCode,
                         zCPCHAR cpcStreetAddress, zLONG lFlag )
{
   AFX_MANAGE_STATE( AfxGetStaticModuleState( ) );
   SHORT nRC = 0;
   ZMapPointApp *pApp = (ZMapPointApp *) ::AfxGetApp( );

   *pchStreet = 0;
   *pchCity = 0;
   *pchOtherCity = 0;
   *pchRegion = 0;
   *pchPostalCode = 0;
   if ( pApp )
   {
      TRY
      {
         if ( pApp->GetMapPointState( ) == 0 )  // not active
            return( zCALL_ERROR );

         _Application *pMP = pApp->GetMapPointApplication( );
         if ( pMP == 0 )
         {
            nRC = zCALL_ERROR;
         }
         else
         {
            _Map Map = pMP->GetActiveMap( );
         // if ( pMap == 0 )
         //    nRC = zCALL_ERROR;
         // else
            {
            // Item    item;
               zLONG   lCnt;
               VARIANT a;
               a.vt = VT_I4;
               a.lVal = 244; // geoMapNorthAmerica!
            // a.lVal = 1; // geoMapNorthAmerica!
            // a.lVal = 2; // geoMapEurope!

               StreetAddress SA = Map.ParseStreetAddress( cpcStreetAddress );
               zstrcpy( pchStreet, SA.GetStreet( ) );
               zstrcpy( pchCity, SA.GetCity( ) );
               zstrcpy( pchOtherCity, SA.GetOtherCity( ) );
               zstrcpy( pchRegion, SA.GetRegion( ) );
               zstrcpy( pchPostalCode, SA.GetPostalCode( ) );
               FindResults FR = Map.FindAddressResults( pchStreet, pchCity,
                                                        pchOtherCity,
                                                        pchRegion,
                                                        pchPostalCode, a );
               TraceLineI( "FindAddressResults Quality: ", FR.GetResultsQuality( ) );
               lCnt = FR.GetCount( );
               TraceLineI( "FindAddressResults Count: ", lCnt );
#if 0
               for ( int k = 1; k <= lCnt; k++ )
               {
                  a.lVal = k;
                  Location L = FR.GetItem( &a );
                  long lType = L.GetType( );
                  long lX = Map.LocationToX( L );
                  long lY = Map.LocationToY( L );
                  TraceLine( "Location Name: %s  Type: %d  X: %d  Y: %d",
                             L.GetName( ), lType, lX, lY );

                  Map.AddPushpin( L, L.GetName( ) );
                  PlaceCategory PC = L.GetPlaceCategory( );
                  TraceLineS( "The Place Category is: ", PC.GetName( ) );
               }
#endif
            }
         }
      }
      CATCH_ALL( e )
      {
         nRC = zCALL_ERROR;
      }
      END_CATCH_ALL
   }

   return( nRC );
}
예제 #28
0
파일: ZdCtlChk.cpp 프로젝트: arksoftgit/10c
// ZCheckBox - ctor
ZCheckBox::ZCheckBox( ZSubtask *pZSubtask,
                      CWnd     *pWndParent,
                      ZMapAct  *pzmaComposite,
                      zVIEW    vDialog,
                      zSHORT   nOffsetX,
                      zSHORT   nOffsetY,
                      zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
           CButton( ),
           ZMapAct( pZSubtask,            // base class ctor
                    pzmaComposite,
                    pWndParent,
                    this,
                    vDialog,
                    nOffsetX,
                    nOffsetY,
                    pCtrlDef,
                    "CheckBox" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for CheckBox", (zLONG) this );
#endif

   if ( pCtrlDef->Subtype & zCONTROL_SIZEABLEBORDER )
      Attr.Style |= WS_THICKFRAME;
   else
   if ( !(pCtrlDef->Subtype & zCONTROL_BORDEROFF) )
      Attr.Style |= WS_BORDER;

   if ( pCtrlDef->Subtype & zCONTROL_NOTABSTOP )
      Attr.Style &= ~WS_TABSTOP;
   else
      Attr.Style |= WS_TABSTOP;

   m_pzsValueOn = 0;
   m_pzsValueOff = 0;

   zPCHAR pch = (zPCHAR) pCtrlDef->CtrlBOI;
   if ( pch == 0 )      // there is no CtrlBOI
      return;

   zPCHAR pchAmpersand = zstrchr( *m_pzsText, '&' );
   while ( pchAmpersand )
   {
      pchAmpersand++;
      if ( *pchAmpersand == '&' )
         pchAmpersand++;
      else
      {
         m_chQuickKey = toupper( *pchAmpersand );
         break;
      }

      pchAmpersand = zstrchr( pchAmpersand, '&' );
   }

   m_pzsValueOn = new CString( pch );
   pch += zstrlen( pch ) + 1;
   m_pzsValueOff = new CString( pch );

   BOX_SIZE = 13;  // ASSERT( BOX_SIZE > 1 );  ASSERT( BOX_SIZE < 30 );
   if ( pCtrlDef->Subtype & zCHECKBOX_XCHECK )
      m_resID = IDB_CB_XCHECK;
   else
   if ( pCtrlDef->Subtype & zCHECKBOX_LED )
   {
      m_resID = IDB_CB_LED;
      BOX_SIZE = 11;
   }
   else
      m_resID = IDB_CB_CHECKMARK;

   // load state bitmaps
   m_bmpSrc = LoadBitmap( AfxGetResourceHandle( ), MAKEINTRESOURCE( m_resID ) );
   ASSERT( m_bmpSrc ); // bitmap resource ID valid?

   m_bLeftText = FALSE;
   m_bDisabled = FALSE;
   m_bChecked  = FALSE;
   m_lState    = BOX_OFF;

   m_bInRect    = FALSE;
   m_bSpaceDown = FALSE;
   m_bMouseDown = FALSE;

   m_brush = 0;
   m_clr = CLR_INVALID;
   m_bHasFocus = FALSE;
   m_bPrepareBitmaps = TRUE;

   for ( int k = 0; k < 6; k++ )
      m_bitmaps[ k ] = 0;

#ifndef zREMOTE_SERVER
   if ( pzmaComposite == 0 ||
        (pzmaComposite->m_ulMapActFlag2 & zMAPACT_CREATE_CHILDREN) )
#endif
   {
      CreateZ( );
   }
}
예제 #29
0
파일: Z2MPAPI.cpp 프로젝트: arksoftgit/10c
zOPER_EXPORT zSHORT OPERATION
MapPointSetPushPin( zCPCHAR cpcStreet, zCPCHAR cpcCity, zCPCHAR cpcOtherCity,
                    zCPCHAR cpcRegion, zCPCHAR cpcPostalCode,
                    zCPCHAR cpcMsg, zSHORT nPushPin, zLONG lFlag )
{
   AFX_MANAGE_STATE( AfxGetStaticModuleState( ) );
   SHORT nRC = 0;
   ZMapPointApp *pApp = (ZMapPointApp *) ::AfxGetApp( );
   if ( pApp )
   {
      TRY
      {
         if ( pApp->GetMapPointState( ) == 0 )  // not active
            return( zCALL_ERROR );

         _Application *pMP = pApp->GetMapPointApplication( );
         if ( pMP == 0 )
         {
            nRC = zCALL_ERROR;
         }
         else
         {
            _Map Map = pMP->GetActiveMap( );
         // if ( pMap == 0 )
         //    nRC = zCALL_ERROR;
         // else
            {
            // Item    item;
               zLONG   lCnt;
               VARIANT a;
               a.vt = VT_I4;
               a.lVal = 244; // geoMapNorthAmerica!
            // a.lVal = 1; // geoMapNorthAmerica!
            // a.lVal = 2; // geoMapEurope!

               FindResults FR = Map.FindAddressResults( cpcStreet, cpcCity,
                                                        cpcOtherCity,
                                                        cpcRegion,
                                                        cpcPostalCode, a );
               TraceLineI( "FindAddressResults Quality: ", FR.GetResultsQuality( ) );
               lCnt = FR.GetCount( );
               TraceLineI( "FindAddressResults Count: ", lCnt );
               for ( int k = 1; k <= lCnt; k++ )
               {
                  a.lVal = k;
                  Location L = FR.GetItem( &a );
                  long lType = L.GetType( );
                  long lX = Map.LocationToX( L );
                  long lY = Map.LocationToY( L );
                  TraceLine( "Location Name: %s  Type: %d  X: %d  Y: %d",
                             L.GetName( ), lType, lX, lY );

                  Pushpin pin;

                  if ( cpcMsg && &cpcMsg )
                     pin = Map.AddPushpin( L, cpcMsg );
                  else
                     pin = Map.AddPushpin( L, L.GetName( ) );

                  pin.SetSymbol( nPushPin );
                  if ( lFlag & 0x00000001 )
                     L.GoTo( );

                  PlaceCategory PC = L.GetPlaceCategory( );
                  TraceLineS( "The Place Category is: ", PC.GetName( ) );
               }
            }
         }
      }
      CATCH_ALL( e )
      {
         nRC = zCALL_ERROR;
      }
      END_CATCH_ALL
   }

   return( nRC );
}
예제 #30
0
파일: TzCtlTAB.cpp 프로젝트: DeegC/10d
TZNotePage::~TZNotePage( )
{
#ifdef DEBUG_ALL
   TraceLineS( "TZNotePage dtor ", m_csTag );
#endif

   mDeleteInitA( m_pchCaption );
   if ( mIs_hWnd( m_hWnd ) == 0 )
      return;

#ifdef DEBUG_ALL

   TC_ITEM TabCtrlItem;
   TZNotePage *pPage = m_pZNoteBook->m_pZNotePage;
   zSHORT k = m_pZNoteBook->m_nPageCnt;
   while ( k-- )
   {
      TabCtrlItem.mask = TCIF_TEXT;
      if ( m_pZNoteBook->GetItem( k, &TabCtrlItem ) )
      {
         TraceLineI( "NoteBook GetItem successful for ", k );
         TraceLineS( "                           text ", TabCtrlItem.pszText );
      }
      else
      {
         TraceLineI( "NoteBook GetItem unsuccessful for ", k );
      }
   }

   m_pZNoteBook->DeleteItem( m_nTabIdx );

   TraceLineS( "TZNotePage after DeleteItem ", m_csTag );

   pPage = m_pZNoteBook->m_pZNotePage;
   k = m_pZNoteBook->m_nPageCnt + 5;
   while ( k-- )
   {
      TabCtrlItem.mask = TCIF_TEXT;
      if ( m_pZNoteBook->GetItem( k, &TabCtrlItem ) )
      {
         TraceLineI( "NoteBook GetItem successful for ", k );
         TraceLineS( "                           text ", TabCtrlItem.pszText );
      }
      else
      {
         TraceLineI( "NoteBook GetItem unsuccessful for ", k );
      }
   }
#else

   m_pZNoteBook->DeleteItem( m_nTabIdx );

#endif

   if ( m_pZNoteBook->m_pZNotePage )
   {
      TZNotePage *pNotePage = m_pZNoteBook->m_pZNotePage;
      TZNotePage *pNotePagePrev = 0;

      while ( pNotePage )
      {
         if ( pNotePage == this )
         {
            if ( pNotePagePrev )
               pNotePagePrev->m_pNext = pNotePage->m_pNext;
            else
               m_pZNoteBook->m_pZNotePage = pNotePage->m_pNext;

            m_pZNoteBook->m_nPageCnt--;

            zSHORT k = m_nTabIdx;
            pNotePage = pNotePage->m_pNext;
            while ( pNotePage )
            {
               pNotePage->m_nTabIdx = k++;
               pNotePage = pNotePage->m_pNext;
            }

            break;
         }

         pNotePagePrev = pNotePage;
         pNotePage = pNotePage->m_pNext;
      }
   }
}