home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / SOURCE / CLASSES / DDE.PRG < prev    next >
Text File  |  1994-05-09  |  2KB  |  79 lines

  1. #include "FiveWin.ch"
  2.  
  3. static aDDEs := {}
  4.  
  5. static nLastMsg
  6.  
  7. //----------------------------------------------------------------------------//
  8.  
  9. CLASS TDde
  10.  
  11.    DATA   nService, nTopic, nItem
  12.    DATA   bAction
  13.    DATA   oWndServer
  14.  
  15.    METHOD New( cService, cTopic, cItem, bAction ) CONSTRUCTOR
  16.    METHOD Activate()
  17.    METHOD Execute( cCommand )
  18.  
  19.    METHOD End() INLINE ::oWndServer:PostMsg( WM_DDE_TERMINATE )
  20.  
  21. ENDCLASS
  22.  
  23. //----------------------------------------------------------------------------//
  24.  
  25. METHOD New( cService, cTopic, cItem, bAction ) CLASS TDde
  26.  
  27.    ::nService = GlobalAddAtom( cService )
  28.    ::nTopic   = GlobalAddAtom( cTopic )
  29.    ::nItem    = GlobalAddAtom( cItem )
  30.    ::bAction  = bAction
  31.  
  32.    AAdd( aDDEs, Self )
  33.  
  34. return nil
  35.  
  36. //----------------------------------------------------------------------------//
  37.  
  38. METHOD Activate() CLASS TDde
  39.  
  40.    nLastMsg = WM_DDE_INITIATE
  41.  
  42.    SendMessage( -1, WM_DDE_INITIATE, GetActiveWindow(),;
  43.                 nMakeLong( ::nService, ::nTopic ) )
  44.  
  45. return nil
  46.  
  47. //----------------------------------------------------------------------------//
  48.  
  49. METHOD Execute( cCommand ) CLASS TDde
  50.  
  51.    nLastMsg = WM_DDE_EXECUTE
  52.  
  53.    ::oWndServer:PostMsg( WM_DDE_EXECUTE, GetActiveWindow(),;
  54.                          DdeCommand( cCommand ) )
  55.    SysRefresh()
  56.  
  57. return nil
  58.  
  59. //----------------------------------------------------------------------------//
  60.  
  61. function DdeAck( hWndServer, nLParam )
  62.  
  63.    local nService, nTopic
  64.    local nDde, oDde
  65.  
  66.    do case
  67.       case nLastMsg == WM_DDE_INITIATE
  68.            nService = nLoWord( nLParam )
  69.            ATail( aDDEs ):oWndServer = TWindow()
  70.            ATail( aDDEs ):oWndServer:hWnd = hWndServer
  71.  
  72.       case nLastMsg == WM_DDE_EXECUTE
  73.            DdeGetCommand( nLParam )
  74.    endcase
  75.  
  76. return nil
  77.  
  78. //----------------------------------------------------------------------------//
  79.