home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / WINDOWS / APPS / DDE_LIB.ZIP / DDELIB.PRN < prev    next >
Encoding:
Text File  |  1990-09-17  |  91.3 KB  |  1,712 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                      DDELIB 1.3
  8.                              Horizon Technologies Inc.
  9.  
  10.          Introduction:
  11.  
  12.               The Dynamic Data Exchange (DDE) Dynamic Link Library (DLL)
  13.               offers Microsoft Windows programmers a tool that reduces the
  14.               effort required to add DDE support to their applications.
  15.  
  16.               DDE is a protocol for sending data and commands between two
  17.               applications in real time.  This link makes it possible to
  18.               build an integrated system from specialized component
  19.               programs.  For example, a DDE session could be established
  20.               to transfer numerical data from a spreadsheet to a word
  21.               processing program.  By means of the DDE protocol the
  22.               spreadsheet could automatically send updated data to the
  23.               word processor every time the user changed an entry in the
  24.               spreadsheet.
  25.  
  26.               As attractive as this sounds, DDE has a major drawback - it
  27.               is very difficult for programmers to implement.  Not only
  28.               must they deal with the data being transferred to and from
  29.               the application being developed, but also with the difficult
  30.               and confusing DDE protocol itself.
  31.  
  32.               We cannot offer much assistance in the processing of data,
  33.               as this is inherent to the structure of every program.
  34.               However, there is considerable relief from the burdens of
  35.               the DDE protocol in the form of this library.  The                                                              The                                                              The ___                                                                 DDE                                                                 ___                                                                 DDE                                                                 ___                                                                 DDE
  36.               _______              Library              _______              Library              _______              Library provides a simplified means of implementing the DDE                      provides a simplified means of implementing the DDE                      provides a simplified means of implementing the DDE
  37.               protocol in any Windows application              protocol in any Windows application              protocol in any Windows application.
  38.  
  39.          Overview:
  40.  
  41.               This overview summarizes the function calls available in the
  42.               ___ _______              DDE Library.  A general knowledge of the DDE protocol can be
  43.               obtained from Microsoft documents:  Chapters 8, 9 and 10 of
  44.               the _________ _______ ________ ___________ ___ _ _______                  Microsoft Windows Software Development Kit - Windows
  45.               __________ _ _______ ___              Extensions - Version 2.0, and chapter 22 of the _________                                                              Microsoft
  46.               _______ _____ __ ___________              Windows Guide to Programming for Windows 3.0 will provide
  47.               the needed background.
  48.  
  49.               The ___ _______                  DDE Library tracks all DDE messages.  The application,
  50.               whether a client, a server or both, does not have to respond
  51.               to any DDE messages in its window procedure.  The ___                                                                DDE
  52.               _______              Library will create special windows to handle all of the DDE
  53.               message traffic.  The application needs only to interact
  54.               with the library functions provided.
  55.  
  56.               The ___ _______                  DDE Library handles all message flow control and
  57.               acknowledgements.  It tracks the current state of the DDE
  58.  
  59.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  60.          Inc.  All rights reserved.  (517) 347-0800                 Page 1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.               conversation and sends messages only when permitted by the
  67.               DDE protocol.  The application does not have to determine
  68.               whether or not to acknowledge a received message or wait
  69.               until an acknowledgement is received from a transmitted
  70.               message.
  71.  
  72.               The ___ _______                  DDE Library handles all atom creation and deletion.  It
  73.               will convert a string to an atom and back again so the
  74.               application does not need to work with any of the atom
  75.               manager functions.
  76.  
  77.               The ___ _______                  DDE Library handles much of the memory management
  78.               required for DDE.  Any memory management required by the
  79.               application is documented by those functions requiring it.
  80.  
  81.               The ___ _______                  DDE Library provides special support services to help
  82.               DDE server applications track information relevant to DDE,
  83.               but not necessarily part of the DDE protocol itself.
  84.  
  85.               Applications requiring DDE client functionality use the
  86.               following functions:
  87.                                                      ___________                 DDEInitiate                                                                                                                                                                                                                                                                                                                                                  and                                                                                                                                         ____________                                 DDETerminate                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                for session management.
  88.                                                      _________                 DDEAdvise                                                                                                                                                                                                                                                                                     and                                                                                                                                 ___________                               DDEUnadvise                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      to establish and close advise
  89.                    circuits.
  90.                                                                                          __________                 DDERequest                                                                                                                                                                                                                                                                                                 and                                                                                                                                     _______                                DDEPoke                                                                                                                                                                                                                                                                                                                                                 for one time data transfers from
  91.                    and to the server respectively.
  92.                                                                                          __________                 DDEExecute                                                                                                                                                                                                                                                                                                 to send a command to the server.
  93.  
  94.               Applications requiring DDE server functionality use these
  95.               functions:
  96.                                                      ________________                 DDERegisterTopic                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            to provide a service to other potential
  97.                    client applications.
  98.                                                                                          ____________________                 DDEGetSessionAppAtom                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ,                                                                                                                                                                 ____________________                                       DDEGetSessionAppName                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ,
  99.                                                                                                    ______________________                   DDEGetSessionTopicAtom                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       and                                                                                                                                                                                             ______________________                                              DDEGetSessionTopicName                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               to
  100.                    obtain information about the client application.
  101.                                                      ___________                 DDESendData                                                                                                                                                                                                                                                                                                                                                  to transmit data to client applications.
  102.                  _________________                 DDERegisterAdvise                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    , ____________                                    DDEGetAdvise                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         and ___________________                                                     DDEUnregisterAdvise                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
  103.                    to record outstanding advises to be serviced.  Unlike
  104.                    any other ___ _______                             DDE Library functions, these functions do not
  105.                    perform any DDE actions and can be considered
  106.                    separately from the rest of the ___ _______                                                   DDE Library.  In fact,
  107.                    they are merely convenience routines to aid in the
  108.                    implementation of DDE server applications.
  109.                  __________________                 DDEUnregisterTopic                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           to remove a particular service.
  110.  
  111.               Each of the functions of the ___ _______                                           DDE Library are described in
  112.               detail on the following pages.  The information provided
  113.               includes the function description, syntax, parameter list,
  114.               return value, and helpful comments.  These descriptions also
  115.               document the format of any callback functions that may be
  116.  
  117.  
  118.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  119.          Inc.  All rights reserved.  (517) 347-0800                 Page 2
  120.  
  121.  
  122.  
  123.  
  124.  
  125.               required.  An appendix is supplied that describes the
  126.               different structures used.
  127.  
  128.               ___ _______              DDE Library can communicate with a variety of DDE based
  129.               applications including Microsoft's _____                                                 Excel and ____ ___                                                           Word for
  130.               _______              Windows.  ___ _______                        DDE Library also comes with sample programs that
  131.               demonstrate the use of the library.
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  178.          Inc.  All rights reserved.  (517) 347-0800                 Page 3
  179.  
  180.  
  181.  
  182.  
  183.  
  184.                                                                 DDEInitiate
  185.  
  186.          Syntax:
  187.                  HWND DDEInitiate (hOwner, lpszApp, lpszTopic)
  188.                  Client applications use this function to initiate a DDE
  189.                  session with the first server that responds.  This DDE
  190.                  function must be called before any of the other client
  191.                  DDE functions.
  192.  
  193.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  194.                  hOwner           HWND                                  HWND                                  HWND  Handle to the top level window of
  195.                                   the application.
  196.  
  197.                  lpszApp          LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  198.                                   names the requested application.  The
  199.                                   string must be a null terminated
  200.                                   character string.
  201.                  lpszTopic        LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  202.                                   names the requested topic.  The string
  203.                                   must be a null terminated character
  204.                                   string.
  205.  
  206.          Return Value:
  207.                  A handle to the initiated DDE session which is used in
  208.                  subsequent client DDE function calls.  It is NULL if the
  209.                  function is unsuccessful.
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  237.          Inc.  All rights reserved.  (517) 347-0800                 Page 4
  238.  
  239.  
  240.  
  241.  
  242.  
  243.                                                                   DDEAdvise
  244.  
  245.          Syntax:
  246.                  WORD DDEAdvise (hClient, lpszItem, lpAdvise,
  247.                    lpfnAdviseCallBack)
  248.                  Client applications use this function to request the
  249.                  establishment of an advise circuit for a particular data
  250.                  item.  Whenever the server determines that the value of
  251.                  the data item has changed, it will notify the client by
  252.                  calling the lpfnAdviseCallBack function.  This function
  253.                  returns after the server has acknowledged the advise.
  254.  
  255.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  256.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  257.                                   by DDEInitiate.
  258.  
  259.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  260.                                   names the requested item.  The string
  261.                                   must be a null terminated character
  262.                                   string.
  263.                  lpAdvise         DDEADVISE FAR *                                  DDEADVISE FAR *                                  DDEADVISE FAR *  Points to a DDEADVISE
  264.                                   structure that specifies the particular
  265.                                   options for this advise circuit.  See
  266.                                   Advise Structure below.
  267.  
  268.                  lpfnAdviseCallBack    DDECALLBACK                                       DDECALLBACK                                       DDECALLBACK  Is the procedure
  269.                                   instance of the callback function that
  270.                                   will be invoked each time the server
  271.                                   issues an advise.  See Callback Function
  272.                                   below.
  273.          Return Value:
  274.  
  275.                  A word in the format of the DDEACK structure.  See
  276.                  Appendix for more information.
  277.          Advise Structure:
  278.  
  279.                  Set fDeferUpd to TRUE to cause the server to exclude the
  280.                  DDEDATA structure as part of the data message.  Set
  281.                  fAckReq to TRUE to cause the server to wait for an
  282.                  acknowledgement before sending another data message.  Set
  283.                  cfFormat to a valid clipboard format, such as CF_TEXT,
  284.                  identifying the format of the data requested.  See
  285.                  Appendix for more information.
  286.                  Never set both fAckReq and fDeferUpd to TRUE, since the
  287.                  server would have no way of letting the client know
  288.                  whether or not ot should acknowledge a particular data
  289.                  message.
  290.  
  291.  
  292.  
  293.  
  294.  
  295.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  296.          Inc.  All rights reserved.  (517) 347-0800                 Page 5
  297.  
  298.  
  299.  
  300.  
  301.  
  302.          Comments:
  303.  
  304.                  Setting fDeferUpd to TRUE provides a mechanism to avoid
  305.                  frequent data transfers if only a notification is
  306.                  required.
  307.                  Note that when setting fAckReq to TRUE the server will
  308.                  not receive an acknowledgement until the callback
  309.                  function returns.
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  355.          Inc.  All rights reserved.  (517) 347-0800                 Page 6
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.          Callback Function:
  363.                  WORD FAR PASCAL Advise (hClient, iMessage, lpszItem,
  364.                    hData)
  365.                  Advise is a placeholder for the application-supplied
  366.                  function name.  The actual name must be exported by
  367.                  including it in an EXPORTS                                    EXPORTS                                    EXPORTS statement in the application's
  368.                  module definition file.
  369.  
  370.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  371.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  372.                                   by DDEInitiate.
  373.  
  374.                  iMessage         unsigned                                  unsigned                                  unsigned  A value indicating why the
  375.                                   callback function was invoked.  See
  376.                                   messages below.
  377.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  378.                                   names the item whose value is currently
  379.                                   being advised.  The string is a null
  380.                                   terminated character string.
  381.  
  382.                  hData            HANDLE                                  HANDLE                                  HANDLE  A handle to a global memory
  383.                                   object in the form of a DDEDATA
  384.                                   structure for DDE_DATA messages.  It
  385.                                   will be NULL if the fDeferUpd flag of
  386.                                   the DDEADVISE strucure passed to
  387.                                   DDEAdvise was TRUE.  It is also NULL for
  388.                                   all other values of iMessage.  See Data
  389.                                   Structure below.  __ ___ ____ ____                                                    Do not free this
  390.                                   ______ ______                                  memory object.
  391.          Messages:
  392.  
  393.                  The messages sent to the callback function contained in
  394.                  iMessage are as follows:
  395.                  _____                 Value                 _____                 Value                 _____                 Value            ___________                                  Description                                  ___________                                  Description                                  ___________                                  Description
  396.  
  397.                  DDE_ACK          First message sent when the circuit
  398.                                   opens successfully.  hData is NULL.
  399.                  DDE_DATA         One message sent each time the server
  400.                                   advises the client of the new data.
  401.  
  402.                  DDE_TERMINATE    Sent when the circuit is closing or if
  403.                                   the circuit could not be established.
  404.          Return Value:
  405.  
  406.                  The return value, defined as a WORD, is unused.
  407.          Data Structure:
  408.  
  409.                  If the fDeferUpd flag in the DDEADVISE structure passed
  410.                  to the DDEAdvise function was TRUE then hData will be
  411.                  NULL.  cfFormat should be the format set in the DDEADVISE
  412.                  structure passed to the DDEAdvise function.
  413.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  414.          Inc.  All rights reserved.  (517) 347-0800                 Page 7
  415.  
  416.  
  417.  
  418.  
  419.  
  420.                                                                 DDEUnadvise
  421.  
  422.          Syntax:
  423.                  WORD FAR PASCAL DDEUnadvise (hClient, lpszItem)
  424.                  Client applications use this function to request the
  425.                  termination of an advise circuit for a particular data
  426.                  item previously established by a call to the DDEAdvise
  427.                  function.  This function returns after the server has
  428.                  acknowledged the unadvise.
  429.  
  430.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  431.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  432.                                   by DDEInitiate.
  433.  
  434.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  435.                                   names the requested item.  The string
  436.                                   must be a null terminated character
  437.                                   string.
  438.          Return Value:
  439.  
  440.                  A word in the format of the DDEACK structure.  See
  441.                  Appendix.
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  473.          Inc.  All rights reserved.  (517) 347-0800                 Page 8
  474.  
  475.  
  476.  
  477.  
  478.  
  479.                                                                  DDERequest
  480.  
  481.          Syntax:
  482.                  WORD DDERequest (hClient, lpszItem, cfFormat,
  483.                    lpfnRequestCallBack)
  484.                  Client applications use this function to request a
  485.                  particular data item.  The server will respond to the
  486.                  client by calling the lpfnRequestCallBack function.  This
  487.                  function returns after the server has acknowledged the
  488.                  request.
  489.  
  490.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  491.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  492.                                   by DDEInitiate.
  493.  
  494.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  495.                                   names the requested item.  The string
  496.                                   must be a null terminated character
  497.                                   string.
  498.                  cfFormat         WORD                                  WORD                                  WORD  should be set to a valid clipboard
  499.                                   format, such as CF_TEXT, identifying the
  500.                                   format of the data requested.
  501.  
  502.                  lpfnRequestCallBack   DDECALLBACK                                       DDECALLBACK                                       DDECALLBACK  Is the procedure
  503.                                   instance of the callback function that
  504.                                   is invoked when the server responds with
  505.                                   the data.  See Callback Function below.
  506.          Return Value:
  507.  
  508.                  A word in the format of the DDEACK structure.  See
  509.                  Appendix.
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  532.          Inc.  All rights reserved.  (517) 347-0800                 Page 9
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.          Callback Function:
  540.                  WORD FAR PASCAL Request (hClient, iMessage, lpszItem,
  541.                    hData)
  542.                  Request is a placeholder for the application-supplied
  543.                  function name.  The actual name must be exported by
  544.                  including it in an EXPORTS                                    EXPORTS                                    EXPORTS statement in the application's
  545.                  module definition file.
  546.  
  547.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  548.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  549.                                   by DDEInitiate.
  550.  
  551.                  iMessage         unsigned                                  unsigned                                  unsigned  A value indicating why the
  552.                                   callback function was invoked.  See
  553.                                   messages below.
  554.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  555.                                   names the item whose value is currently
  556.                                   being requested.  The string is a null
  557.                                   terminated character string.
  558.  
  559.                  hData            HANDLE                                  HANDLE                                  HANDLE  A handle to a global memory
  560.                                   object in the form of a DDEDATA
  561.                                   structure for DDE_DATA messages.
  562.                                   Otherwise, it is NULL.  See Data
  563.                                   Structure below.  __ ___ ____ ____                                                    Do not free this
  564.                                   ______ ______                                  memory object.
  565.          Messages:
  566.  
  567.                  The messages sent to the callback function contained in
  568.                  iMessage are as follows:
  569.                  _____                 Value                 _____                 Value                 _____                 Value            ___________                                  Description                                  ___________                                  Description                                  ___________                                  Description
  570.  
  571.                  DDE_DATA         Sent if the server fulfilled the request
  572.                                   and is providing the data.
  573.                  DDE_TERMINATE    Sent if the server could not fulfill the
  574.                                   request and hence no data is available.
  575.                                   hData is NULL.
  576.  
  577.          Return Value:
  578.                  The return value, defined as a WORD, is unused.
  579.  
  580.          Data Structure:
  581.                  cfFormat is the format requested in the DDERequest
  582.                  function.
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  591.          Inc.  All rights reserved.  (517) 347-0800                Page 10
  592.  
  593.  
  594.  
  595.  
  596.  
  597.                                                                     DDEPoke
  598.  
  599.          Syntax:
  600.                  WORD FAR PASCAL DDEPoke (hClient, lpszItem, hPoke)
  601.                  Client applications use this function to send,
  602.                  unsolicited, a particular data item to the server.  This
  603.                  function returns after the server has acknowledged the
  604.                  poke.
  605.  
  606.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  607.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  608.                                   by DDEInitiate.
  609.  
  610.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  611.                                   names the item whose data is being sent.
  612.                                   The string must be a null terminated
  613.                                   character string.
  614.                  hPoke            HANDLE                                  HANDLE                                  HANDLE  A handle to a global memory
  615.                                   object in the form of a DDEPOKE
  616.                                   structure.  It must have been allocated
  617.                                   with GlobalAlloc using the GMEM_DDESHARE
  618.                                   flag.  See Poke Structure below.
  619.  
  620.          Return Value:
  621.                  A word in the format of the DDEACK structure.  See
  622.                  Appendix.
  623.  
  624.          Poke Structure:
  625.                  Set fRelease to TRUE to cause the server to free the
  626.                  memory object.  Otherwise, it is the client application's
  627.                  responsibility to free the memory object.  Set cfFormat
  628.                  to a valid clipboard format, such as CF_TEXT, identifying
  629.                  the format of the data being sent.
  630.  
  631.          Comments:
  632.                  Even if fRelease has been set to TRUE in the DDEPOKE
  633.                  structure, it is still the client application's
  634.                  responsibility to free the memory object if the poke
  635.                  fails.  This can be determined by examining fAck in the
  636.                  return value.  It will be FALSE if the poke failed.
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  650.          Inc.  All rights reserved.  (517) 347-0800                Page 11
  651.  
  652.  
  653.  
  654.  
  655.  
  656.                                                                  DDEExecute
  657.  
  658.          Syntax:
  659.                  WORD FAR PASCAL DDEExecute (hClient, hCommand)
  660.                  Client applications use this function to send,
  661.                  unsolicited, a particular command to the server.  This
  662.                  function returns after the server has acknowledged the
  663.                  command.
  664.  
  665.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  666.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  667.                                   by DDEInitiate.
  668.  
  669.                  hCommand         HANDLE                                  HANDLE                                  HANDLE  A handle to a global memory
  670.                                   object which contains a null terminated
  671.                                   ASCII string of commands that the server
  672.                                   should execute.  It must have been
  673.                                   allocated with GlobalAlloc using the
  674.                                   GMEM_DDESHARE flag.  Example: [open
  675.                                   ("foo.xlm")] [run ("r1c1")].  ____                                                                This
  676.                                   ______ ______ ____ __ _____ __ ___ ___                                  memory object will be freed by the DDE
  677.                                   _______                                  Library.
  678.          Return Value:
  679.  
  680.                  A word in the format of the DDEACK structure.  See
  681.                  Appendix.
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  709.          Inc.  All rights reserved.  (517) 347-0800                Page 12
  710.  
  711.  
  712.  
  713.  
  714.  
  715.                                                                DDETerminate
  716.  
  717.          Syntax:
  718.                  WORD FAR PASCAL DDETerminate (hClient)
  719.                  Client applications use this function to terminate a
  720.                  session previously established DDEInitiate.  This
  721.                  function invalidates the hClient handle which can no
  722.                  longer be used.  This function returns after the server
  723.                  has acknowledged the command.
  724.  
  725.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  726.                  hClient          HWND                                  HWND                                  HWND  Handle to a DDE session returned
  727.                                   by DDEInitiate.
  728.  
  729.          Return Value:
  730.                  A word in the format of the DDEACK structure.  See
  731.                  Appendix.
  732.  
  733.          Comments:
  734.                  Advise circuits established with DDEAdvise do ___                                                               not need to
  735.                  be explicitly closed with a call to DDEUnadvise before
  736.                  terminating a session.
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  768.          Inc.  All rights reserved.  (517) 347-0800                Page 13
  769.  
  770.  
  771.  
  772.  
  773.  
  774.                                                            DDERegisterTopic
  775.  
  776.          Syntax:
  777.                  HWND DDERegisterTopic (hOwner, lpszApp, lpszTopic,
  778.                    lpfnTopicCallBack)
  779.                  Server applications use this function to register its
  780.                  services for a particular topic.  Any potential client
  781.                  application can establish a session with this server by
  782.                  issuing a DDEInitiate for this particular application and
  783.                  topic.
  784.  
  785.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  786.                  hOwner           HWND                                  HWND                                  HWND  Handle to the top level window of
  787.                                   the application.
  788.  
  789.                  lpszApp          LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  790.                                   names the name of the application
  791.                                   providing the service.  The string must
  792.                                   be a null terminated character string.
  793.                  lpszTopic        LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  794.                                   names the name of the topic that the
  795.                                   application is servicing.  The string
  796.                                   must be a null terminated character
  797.                                   string.
  798.  
  799.                  lpfnTopicCallBackDDECALLBACK                                  DDECALLBACK                                  DDECALLBACK  Is the procedure instance
  800.                                   of the callback function that is invoked
  801.                                   each time a client requests a service.
  802.                                   See Callback Function below.
  803.          Return Value:
  804.  
  805.                  A handle to the created DDE topic server which is used in
  806.                  subsequent server DDE function calls.  It is NULL if the
  807.                  function is unsuccessful.
  808.          Comments:
  809.  
  810.                  A server may register more than one topic by repeatedly
  811.                  calling DDERegisterTopic.  Each invocation should (but is
  812.                  not required to) use the same value for lpszApp.
  813.                  The application can use the same callback function for
  814.                  more than one topic.  Four functions:
  815.                  DDEGetSessionAppAtom, DDEGetSessionAppName,
  816.                  DDEGetSessionTopicAtom, and DDEGetSessionTopicName can be
  817.                  used within the callback function to determine the
  818.                  application and topic that a client is communicating
  819.                  with.
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  827.          Inc.  All rights reserved.  (517) 347-0800                Page 14
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.          Callback Function:
  835.                  WORD FAR PASCAL Topic (hSession, iMessage, lpszItem,
  836.                    hData)
  837.                  Topic is a placeholder for the application-supplied
  838.                  function name.  The actual name must be exported by
  839.                  including it in an EXPORTS                                    EXPORTS                                    EXPORTS statement in the application's
  840.                  module definition file.
  841.  
  842.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  843.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  844.                                   particular DDE session with a client.
  845.                                   This is ___                                          not the return value from
  846.                                   DDERegisterTopic.
  847.  
  848.                  iMessage         unsigned                                  unsigned                                  unsigned  A value indicating why the
  849.                                   callback function was invoked.  See
  850.                                   messages below.
  851.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  852.                                   names the item of interest.  This may be
  853.                                   NULL for some messages.  The string is a
  854.                                   null terminated character string.
  855.  
  856.                  hData            HANDLE                                  HANDLE                                  HANDLE  A handle to a global memory
  857.                                   object in a form dependant on the
  858.                                   message.  __ ___ ____ ____ ______                                            Do not free this memory
  859.                                   ______                                  object.
  860.          Return Value:
  861.  
  862.                  The return value is defined as a WORD.  For messages that
  863.                  require a return value, fill this word using the format
  864.                  of the DDEACK structure.  The DDEACK structure is defined
  865.                  in the Appendix.  Each message value documented below
  866.                  defines whether or not it requires a return value.
  867.          Messages:
  868.  
  869.                  The messages sent to the callback function contained in
  870.                  iMessage are as follows:
  871.                  _____                 Value                 _____                 Value                 _____                 Value            ___________                                  Description                                  ___________                                  Description                                  ___________                                  Description
  872.  
  873.                  DDE_INITIATE     Message sent when a new client
  874.                                   establishes a session.  lpszItem and
  875.                                   hData are NULL.  The return value is not
  876.                                   used.
  877.                  DDE_TERMINATE    Message sent when a session with a
  878.                                   client is being terminated.  lpszItem
  879.                                   and hData are NULL.  The return value is
  880.                                   not used.
  881.  
  882.                  DDE_POKE         Message sent when the client is offering
  883.                                   data for a particular item.  lpszItem
  884.                                   contains the name of the item.  hData is
  885.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  886.          Inc.  All rights reserved.  (517) 347-0800                Page 15
  887.  
  888.  
  889.  
  890.  
  891.  
  892.                                   in the form of a DDEPOKE structure.
  893.                                   Make sure to set fAck and fBusy in the
  894.                                   return value since it is used.
  895.  
  896.                  DDE_REQUEST      Message sent when the client is
  897.                                   requesting a one time data transfer for
  898.                                   a particular item.  lpszItem contains
  899.                                   the name of the item.  hData is in the
  900.                                   form of a DDEADVISE structure.  Check
  901.                                   cfFormat.  No need to check fRelease or
  902.                                   fAckReq.  __ ___ ____ ____ ______                                            Do not free this memory
  903.                                   _______                                  object.  Make sure to set fAck and fBusy
  904.                                   in the return value since it is used.
  905.                                   If fAck is TRUE the server is ________                                                                required
  906.                                   to send the data using DDESendData.
  907.                  DDE_EXECUTE      Message sent when the client is
  908.                                   requesting the execution of a command
  909.                                   string.  lpszItem is NULL.  hData is
  910.                                   simply a null terminated ASCII string.
  911.                                   Make sure to set fAck and fBusy in the
  912.                                   return value since it is used.
  913.  
  914.                  DDE_ADVISE       Message sent when the client is
  915.                                   requesting a continuous data transfer
  916.                                   for a particular item whenever its value
  917.                                   changes.  lpszItem contains the name of
  918.                                   the item.  hData is in the form of a
  919.                                   DDEADVISE structure.  Check fAckReq,
  920.                                   fDeferUpd, and cfFormat.  __ ___ ____                                                            Do not free
  921.                                   ____ ______ _______                                  this memory object.  Make sure to set
  922.                                   fAck and fBusy in the return value since
  923.                                   it is used.  If fAck is TRUE the server
  924.                                   should send advise data using
  925.                                   DDESendData.
  926.                  DDE_UNADVISE     Message sent when the client is
  927.                                   requesting a continuous data transfer to
  928.                                   be terminated for a particular item.
  929.                                   lpszItem contains the name of the item.
  930.                                   hData is NULL.  Make sure to set fAck
  931.                                   and fBusy in the return value since it
  932.                                   is used.
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  945.          Inc.  All rights reserved.  (517) 347-0800                Page 16
  946.  
  947.  
  948.  
  949.  
  950.  
  951.                                                        DDEGetSessionAppAtom
  952.  
  953.          Syntax:
  954.                  ATOM DDEGetSessionAppAtom (hSession)
  955.                  Server applications use this function to determine the
  956.                  application name that the client has used to communicate
  957.                  with it.  This is useful if the same callback function
  958.                  has been passed to multiple calls to DDERegisterTopic.
  959.  
  960.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  961.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  962.                                   particular DDE session with a client
  963.                                   identified as the first parameter of the
  964.                                   callback function registered by
  965.                                   DDERegisterTopic.  This is ___                                                             not the
  966.                                   return value from DDERegisterTopic.
  967.  
  968.          Return Value:
  969.                  An atom value (integer) representing the application
  970.                  name.  Use GlobalGetAtomName or DDEGetSessionAppName to
  971.                  retrieve the actual string.
  972.  
  973.  
  974.                                                        DDEGetSessionAppName
  975.  
  976.          Syntax:
  977.                  int DDEGetSessionAppName (hSession, lpszApp, nSize)
  978.                  Server applications use this function to determine the
  979.                  application name that the client has used to communicate
  980.                  with it.  This is useful if the same callback function
  981.                  has been passed to multiple calls to DDERegisterTopic.
  982.  
  983.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  984.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  985.                                   particular DDE session with a client
  986.                                   identified as the first parameter of the
  987.                                   callback function registered by
  988.                                   DDERegisterTopic.  This is ___                                                             not the
  989.                                   return value from DDERegisterTopic.
  990.  
  991.                  lpszApp          LPSTR                                  LPSTR                                  LPSTR  Points to a character string to
  992.                                   receive the name of the application.
  993.                                   The string will be a null terminated
  994.                                   character string.
  995.                  nSize            int                                  int                                  int  Specifies the maximum size (in
  996.                                   bytes) of the buffer pointed to by
  997.                                   lpszApp.
  998.  
  999.          Return Value:
  1000.                  The return value specifies the actual number of bytes
  1001.                  copied to the buffer.
  1002.  
  1003.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1004.          Inc.  All rights reserved.  (517) 347-0800                Page 17
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.                                                      DDEGetSessionTopicAtom
  1011.  
  1012.          Syntax:
  1013.                  ATOM DDEGetSessionTopicAtom (hSession)
  1014.                  Server applications use this function to determine the
  1015.                  topic name that the client has used to communicate with
  1016.                  it.  This is useful if the same callback function has
  1017.                  been passed to multiple calls to DDERegisterTopic.
  1018.  
  1019.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1020.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  1021.                                   particular DDE session with a client
  1022.                                   identified as the first parameter of the
  1023.                                   callback function registered by
  1024.                                   DDERegisterTopic.  This is ___                                                             not the
  1025.                                   return value from DDERegisterTopic.
  1026.  
  1027.          Return Value:
  1028.                  An atom value (integer) representing the topic name.  Use
  1029.                  GlobalGetAtomName or DDEGetSessionTopicName to retrieve
  1030.                  the actual string.
  1031.  
  1032.  
  1033.                                                      DDEGetSessionTopicName
  1034.  
  1035.          Syntax:
  1036.                  int DDEGetSessionTopicName (hSession, lpszTopic, nSize)
  1037.                  Server applications use this function to determine the
  1038.                  topic name that the client has used to communicate with
  1039.                  it.  This is useful if the same callback function has
  1040.                  been passed to multiple calls to DDERegisterTopic.
  1041.  
  1042.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1043.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  1044.                                   particular DDE session with a client
  1045.                                   identified as the first parameter of the
  1046.                                   callback function registered by
  1047.                                   DDERegisterTopic.  This is ___                                                             not the
  1048.                                   return value from DDERegisterTopic.
  1049.  
  1050.                  lpszTopic        LPSTR                                  LPSTR                                  LPSTR  Points to a character string to
  1051.                                   receive the name of the topic.  The
  1052.                                   string will be a null terminated
  1053.                                   character string.
  1054.                  nSize            int                                  int                                  int  Specifies the maximum size (in
  1055.                                   bytes) of the buffer pointed to by
  1056.                                   lpszTopic.
  1057.  
  1058.          Return Value:
  1059.                  The return value specifies the actual number of bytes
  1060.                  copied to the buffer.
  1061.  
  1062.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1063.          Inc.  All rights reserved.  (517) 347-0800                Page 18
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.                                                                 DDESendData
  1070.  
  1071.          Syntax:
  1072.                  HWND DDESendData (hSession, iMessage, lpszItem, hData)
  1073.                  Server applications use this function to send data to a
  1074.                  client application in direct response to a request
  1075.                  message or as a result of an advise circuit having been
  1076.                  established.  This function returns after the client has
  1077.                  acknowledged the data message if the bAckReq field in the
  1078.                  DDEDATA structure is TRUE.  Otherwise it will return
  1079.                  immediately after the message is sent.
  1080.  
  1081.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1082.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  1083.                                   particular DDE session with a client
  1084.                                   identified as the first parameter of the
  1085.                                   callback function registered by
  1086.                                   DDERegisterTopic.  This is ___                                                             not the
  1087.                                   return value from DDERegisterTopic.
  1088.  
  1089.                  iMessage         unsigned                                  unsigned                                  unsigned  A value indicating the reason
  1090.                                   the data is being sent to the client.
  1091.                                   Set this value to DDE_REQUEST if the
  1092.                                   data is in response to a request
  1093.                                   message, otherwise set it to DDE_ADVISE.
  1094.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  1095.                                   names the item whose data is being sent.
  1096.                                   The string must be a null terminated
  1097.                                   character string.
  1098.  
  1099.                  hData            HANDLE                                  HANDLE                                  HANDLE  A handle to a global memory
  1100.                                   object in the form of a DDEDATA
  1101.                                   structure.  It must have been allocated
  1102.                                   with GlobalAlloc using the GMEM_DDESHARE
  1103.                                   flag.  See Data Structure below.
  1104.          Return Value:
  1105.  
  1106.                  A word in the format of the DDEACK structure.  See
  1107.                  Appendix.
  1108.          Data Structure:
  1109.  
  1110.                  If this data is sent in response to an advise message,
  1111.                  set fAckReq to the same value as the fAckReq field of the
  1112.                  DDEADVISE structure sent previously by the client.  If
  1113.                  this data is sent in response to a request message
  1114.                  fAckReq may be set to either TRUE or FALSE.  See the
  1115.                  appendix for more information.  Set fRelease to TRUE if
  1116.                  the client should free the memory object.  Otherwise, it
  1117.                  is the server application's responsibility to free the
  1118.                  memory object.  Set cfFormat to a valid clipboard format
  1119.                  such as CF_TEXT.
  1120.  
  1121.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1122.          Inc.  All rights reserved.  (517) 347-0800                Page 19
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.                  Never set both fAckReq and fRelease to FALSE, since it
  1129.                  would be the server applications responsibility to free
  1130.                  the memory object but it would not have a way of knowing
  1131.                  when the client application had completed processing the
  1132.                  data.
  1133.  
  1134.          Comments:
  1135.                  Even if fRelease has been set to TRUE in the DDEDATA
  1136.                  structure, it is still the server application's
  1137.                  responsibility to free the memory object if the send
  1138.                  fails.  This can be determined by examining fAck in the
  1139.                  return value.  It will be FALSE if the send failed.
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1181.          Inc.  All rights reserved.  (517) 347-0800                Page 20
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.                                                           DDERegisterAdvise
  1188.  
  1189.          Syntax:
  1190.                  HANDLE DDERegisterAdvise (hList, hSession, lpszItem,
  1191.                    fAckReq, fDeferUpd, cfFormat)
  1192.                  Server applications use this function to record
  1193.                  information about a new advise circuit in response to an
  1194.                  advise message.  This function appends the new advise
  1195.                  circuit information to the list indicated by hList.
  1196.  
  1197.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1198.                  hList            HANDLE                                  HANDLE                                  HANDLE  Handle that identifies the list
  1199.                                   of advise circuits that this new advise
  1200.                                   should be appended to.  This is the
  1201.                                   return value from a previous call to
  1202.                                   DDERegisterAdvise or
  1203.                                   DDEUnregisterAdvise.  If this parameter
  1204.                                   is NULL a new list will be created.
  1205.                                   Upon return from this function, the
  1206.                                   value of hList will no longer be valid
  1207.                                   and should be replaced by the return
  1208.                                   value.
  1209.  
  1210.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  1211.                                   particular DDE session with a client
  1212.                                   identified as the first parameter of the
  1213.                                   callback function registered by
  1214.                                   DDERegisterTopic.  This is ___                                                             not the
  1215.                                   return value from DDERegisterTopic.
  1216.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  1217.                                   names the item of the advise circuit.
  1218.                                   The string must be a null terminated
  1219.                                   character string.
  1220.  
  1221.                  fAckReq          int                                  int                                  int  This should be set to the fAckReq
  1222.                                   field in the DDEADVISE structure passed
  1223.                                   to the callback function registered by
  1224.                                   DDERegisterTopic.
  1225.                  fDeferUpd        int                                  int                                  int  This should be set to the fDeferUpd
  1226.                                   field in the DDEADVISE structure passed
  1227.                                   to the callback function registered by
  1228.                                   DDERegisterTopic.
  1229.  
  1230.                  cfFormat         int                                  int                                  int  This should be set to the cfFormat
  1231.                                   field in the DDEADVISE structure passed
  1232.                                   to the callback function registered by
  1233.                                   DDERegisterTopic.
  1234.          Return Value:
  1235.  
  1236.                  A handle to the newly created advise list in the case
  1237.                  that hList is NULL, and a handle to the modified advise
  1238.                  list in the case that hList was not NULL.
  1239.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1240.          Inc.  All rights reserved.  (517) 347-0800                Page 21
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.          Comments:
  1247.  
  1248.                  Make sure not to re-use the value of hList but to use the
  1249.                  return value from the function instead.
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1299.          Inc.  All rights reserved.  (517) 347-0800                Page 22
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.                                                                DDEGetAdvise
  1306.  
  1307.          Syntax:
  1308.                  HANDLE DDEGetAdvise (hList, nItem, lphSession, lpszItem,
  1309.                    nItemLen, lpfAckReq, lpfDeferUpd, lpcfFormat)
  1310.                  Server applications use this function to recall
  1311.                  information about outstanding advise circuits from the
  1312.                  list indicated by hList.  This is useful to check if any
  1313.                  clients have registered an advise circuit on an item that
  1314.                  the server application has determined to have changed.
  1315.                  The return information is useful for calling DDESendData.
  1316.  
  1317.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1318.                  hList            HANDLE                                  HANDLE                                  HANDLE  Handle that identifies the list
  1319.                                   of advise circuits to scan.  This is the
  1320.                                   return value from a previous call to
  1321.                                   DDERegisterAdvise or
  1322.                                   DDEUnregisterAdvise.
  1323.  
  1324.                  nItem            int                                  int                                  int  Index number of the advise circuit
  1325.                                   in hList.  To scan through all entries,
  1326.                                   repeatedly call this function with
  1327.                                   successively larger integer values for
  1328.                                   nItem, beginning at zero, until the
  1329.                                   return value indicates that the item
  1330.                                   does not exist.
  1331.                  lphSession       HWND FAR *                                  HWND FAR *                                  HWND FAR *  Pointer to variable to
  1332.                                   receive the hSession value previously
  1333.                                   passed to DDERegisterAdvise.
  1334.  
  1335.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Pointer to variable to receive
  1336.                                   the lpszItem string previously passed to
  1337.                                   DDERegisterAdvise.
  1338.                  nItemLen         int                                  int                                  int  Specifies the maximum size (in
  1339.                                   bytes) of the buffer pointed to by
  1340.                                   lpszItem.
  1341.  
  1342.                  lpfAckReq        int FAR *                                  int FAR *                                  int FAR *  Pointer to variable to
  1343.                                   receive the fAckReq value previously
  1344.                                   passed to DDERegisterAdvise.
  1345.                  lpfDeferUpd      int FAR *                                  int FAR *                                  int FAR *  Pointer to variable to
  1346.                                   receive the fDeferUpd value previously
  1347.                                   passed to DDERegisterAdvise.
  1348.  
  1349.                  lpcfFormat       int FAR *                                  int FAR *                                  int FAR *  Pointer to variable to
  1350.                                   receive the cfFormat value previously
  1351.                                   passed to DDERegisterAdvise.
  1352.          Return Value:
  1353.  
  1354.                  The return value specifies the actual number of bytes
  1355.                  copied to the buffer.  It is -1 to indicate that no
  1356.                  advise entry exists for the specified nItem.
  1357.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1358.          Inc.  All rights reserved.  (517) 347-0800                Page 23
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.          Comments:
  1365.  
  1366.                  As items are added and removed with DDERegisterAdvise and
  1367.                  DDEUnregisterAdvise the item number for a particular
  1368.                  advise will ___                             not remain constant.
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1417.          Inc.  All rights reserved.  (517) 347-0800                Page 24
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.                                                         DDEUnregisterAdvise
  1424.  
  1425.          Syntax:
  1426.                  HANDLE DDEUnregisterAdvise (hList, hSession, lpszItem)
  1427.                  Server applications use this function to delete recorded
  1428.                  information about a terminated advise circuit in response
  1429.                  to an unadvise message.  This function removes the advise
  1430.                  circuit information from the list indicated by hList.
  1431.  
  1432.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1433.                  hList            HANDLE                                  HANDLE                                  HANDLE  Handle that identifies the list
  1434.                                   of advise circuits that this advise
  1435.                                   should be removed from.  This is the
  1436.                                   return value from a previous call to
  1437.                                   DDERegisterAdvise or
  1438.                                   DDEUnregisterAdvise.  Upon return from
  1439.                                   this function, the value of hList will
  1440.                                   no longer be valid and should be
  1441.                                   replaced by the return value.
  1442.  
  1443.                  hSession         HWND                                  HWND                                  HWND  Handle that identifies a
  1444.                                   particular DDE session with a client
  1445.                                   identified as the first parameter of the
  1446.                                   callback function registered by
  1447.                                   DDERegisterTopic.  This is ___                                                             not the
  1448.                                   return value from DDERegisterTopic.  If
  1449.                                   this value is NULL, all advise circuits
  1450.                                   recorded in hList will be removed and
  1451.                                   the list will be freed.
  1452.                  lpszItem         LPSTR                                  LPSTR                                  LPSTR  Points to a character string that
  1453.                                   names the item of the advise circuit.
  1454.                                   The string must be a null terminated
  1455.                                   character string.  If this value is
  1456.                                   NULL, all advise circuits recorded in
  1457.                                   hList that belong to the specified
  1458.                                   hSession will be removed.
  1459.  
  1460.          Return Value:
  1461.                  A handle to the modified advise list.
  1462.  
  1463.          Comments:
  1464.                  Make sure not to re-use the value of hList but to use the
  1465.                  return value from the function instead.
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1476.          Inc.  All rights reserved.  (517) 347-0800                Page 25
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.                                                          DDEUnregisterTopic
  1483.  
  1484.          Syntax:
  1485.                  HWND DDEUnregisterTopic (hServer)
  1486.                  Server applications use this function to unregister its
  1487.                  services for a particular topic.  This function will
  1488.                  first terminate all currently active sessions with
  1489.                  clients before returning.
  1490.  
  1491.                  _________                 Parameter                 _________                 Parameter                 _________                 Parameter        ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1492.                  hServer          HWND                                  HWND                                  HWND  Handle to a DDE topic server
  1493.                                   established with DDERegisterTopic.
  1494.  
  1495.          Return Value:
  1496.                  A word in the format of the DDEACK structure.  See
  1497.                  Appendix.
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1535.          Inc.  All rights reserved.  (517) 347-0800                Page 26
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.                                                                    Appendix
  1542.  
  1543.          The DDEACK structure:
  1544.                  A word in the format of the DDEACK structure is returned
  1545.                  by all of the DDE library functions except DDEInitiate
  1546.                  and DDERegisterTopic.  The fields that are packed into
  1547.                  this word are described in the table below.
  1548.  
  1549.                  _____                 Field                 _____                 Field                 _____                 Field            ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1550.                  fAck             unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that is TRUE
  1551.                                   for a positive acknowledgement and FALSE
  1552.                                   for a negative (nack) acknowledgement.
  1553.  
  1554.                  fBusy            unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that indicates
  1555.                                   the server could not process the request
  1556.                                   because it is currently busy.  This
  1557.                                   field only has meaning only if fAck is
  1558.                                   FALSE.
  1559.                  bAppReturnCode   unsigned:8                                  unsigned:8                                  unsigned:8  Can be set to any value
  1560.                                   desired for further interprocess status
  1561.                                   communications.  However, the DDE
  1562.                                   library functions also set this return
  1563.                                   code to indicated failures on their part
  1564.                                   as well.  See the table below.
  1565.  
  1566.                  The following table represents the values that the DDE
  1567.                  library functions may supply in the bAppReturnCode of the
  1568.                  DDEACK structure.
  1569.                  _____                 Value                 _____                 Value                 _____                 Value            _______                                  Meaning                                  _______                                  Meaning                                  _______                                  Meaning
  1570.  
  1571.                  DDE_OK           Function completed ok.
  1572.                  DDE_NACK         A nack was received.
  1573.  
  1574.                  DDE_BADHANDLE    The session handle passed to the
  1575.                                   function is invalid.
  1576.                  DDE_BADSTATE     The current state of communications can
  1577.                                   not perform the action requested by this
  1578.                                   function.
  1579.  
  1580.                  DDE_MEMORY       A memory allocation error occurred
  1581.                                   during the processing of this function.
  1582.                  DDE_BADITEM      The item passed to the function is
  1583.                                   invalid.
  1584.  
  1585.                  DDE_BADTOPIC     The topic passed to the function is
  1586.                                   invalid.
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1594.          Inc.  All rights reserved.  (517) 347-0800                Page 27
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.          The DDEADVISE Structure:
  1602.                  The DDEAdvise structure, sent to the server from the
  1603.                  client, contains the following fields.
  1604.  
  1605.                  _____                 Field                 _____                 Field                 _____                 Field            ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1606.                  fAckReq          unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that is TRUE if
  1607.                                   the server is required to wait for an
  1608.                                   acknowledgement to be returned before
  1609.                                   sending another advise message.  The
  1610.                                   fAckReq field in the DDEDATA structure
  1611.                                   sent as part of the data message to the
  1612.                                   client ____                                         must be set equal to this field
  1613.                                   by the server.
  1614.  
  1615.                  fDeferUpd        unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that indicates
  1616.                                   the server should not send the DDEDATA
  1617.                                   structure when sending a data message.
  1618.                                   It is assumed that the client will send
  1619.                                   a request message to the server when it
  1620.                                   requires the actual data.
  1621.                  cfFormat         int                                  int                                  int  A valid clipboard format, such as
  1622.                                   CF_TEXT, identifying the format of data
  1623.                                   requested.
  1624.  
  1625.          The DDEDATA Structure:
  1626.                  The DDEData structure, sent to the client from the
  1627.                  server, contains the following fields.
  1628.  
  1629.                  _____                 Field                 _____                 Field                 _____                 Field            ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1630.                  fAckReq          unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that is TRUE if
  1631.                                   the client is required to send an
  1632.                                   acknowledgement back to the server.
  1633.  
  1634.                  fRelease         unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that is TRUE if
  1635.                                   the client is expected to free the
  1636.                                   global memory object.
  1637.                  fResponse        unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that is TRUE if
  1638.                                   the data message is in response to a
  1639.                                   request.  FALSE if the server initiated
  1640.                                   the transfer as a result of an
  1641.                                   established advise circuit.
  1642.  
  1643.                  cfFormat         int                                  int                                  int  A valid clipboard format, such as
  1644.                                   CF_TEXT, identifying the format of data
  1645.                                   sent.
  1646.                  Value            BYTE[n]                                  BYTE[n]                                  BYTE[n]  The data.
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1653.          Inc.  All rights reserved.  (517) 347-0800                Page 28
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.          The DDEPOKE Structure:
  1661.                  The DDEPoke structure, sent to the server from the
  1662.                  client, contains the following fields.
  1663.  
  1664.                  _____                 Field                 _____                 Field                 _____                 Field            ________________                                  Type/Description                                  ________________                                  Type/Description                                  ________________                                  Type/Description
  1665.                  fRelease         unsigned:1                                  unsigned:1                                  unsigned:1  Boolean flag that is TRUE if
  1666.                                   the server is expected to free the
  1667.                                   global memory object.
  1668.  
  1669.                  cfFormat         int                                  int                                  int  A valid clipboard format, such as
  1670.                                   CF_TEXT, identifying the format of data
  1671.                                   sent.
  1672.                  Value            BYTE[n]                                  BYTE[n]                                  BYTE[n]  The data.
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.          DDELIB - Copyright (C) September 17, 1990 Horizon Technologies
  1712.          Inc.  All rights reserved.  (517) 347-0800                Page 29