Presentation is loading. Please wait.

Presentation is loading. Please wait.

DATA EXCHANGE.

Similar presentations


Presentation on theme: "DATA EXCHANGE."— Presentation transcript:

1 DATA EXCHANGE

2 Vilnius University Faculty of Mathematics and Informatics
Student: Robert-Andrei Tudor Student ID:

3 Data exchange Data exchange is the process of taking data structured under a source schema and transforming it into data structured under a target schema, so that the target data is an accurate representation of the source data. Data exchange allows data to be shared between different computer programs.

4 The Clipboard It’s a data buffer used for short-term data storage and/or data transfer between documents or applications. All applications have access to the clipboard. It is user-driven.

5 Each format is identified by an unsigned integer value.
A memory object on the clipboard can be in any data format, called a clipboard format. Each format is identified by an unsigned integer value. For standard clipboard formats, this value is a constant defined in Winuser.h. For registered clipboard formats, it is the return value of the RegisterClipboardFormat function.

6 RegisterClipboardFormatA
Parameters: lpszFormat (the name of the format) Type: LPCSTR Return Value Type: UINT If the function succeeds, the return value identifies the registered clipboard format. If the function fails, the return value is zero. To get extended error information, call GetLastError.

7 Clipboard Commands A user typically carries out clipboard operations by choosing commands from an application's Edit menu. Cut: Places a copy of the current selection on the clipboard and deletes the selection from the document. The previous content of the clipboard is destroyed. Copy:Places a copy of the current selection on the clipboard. The document remains unchanged. The previous content of the clipboard is destroyed. Paste: Replaces the current selection with the content of the clipboard. The content of the clipboard is not changed. Delete: Deletes the current selection from the document. The content of the clipboard is not changed. This command does not involve the clipboard, but it should appear with the clipboard commands on the Edit menu.

8 Clipboard Sequence Number
The clipboard for each window station has an associated clipboard sequence number which is incremented whenever the contents of the clipboard change. To obtain the clipboard sequence number, call the GetClipboardSequenceNumber function.

9 Creating an Edit Menu An application should load an accelerator table containing the standard keyboard accelerators for the Edit menu commands. The TranslateAccelerator function must be added to the application's message loop for the accelerators to take effect.

10 Copying Information to the Clipboard
In the Label application, the application-defined EditCopy function copies the current selection to the clipboard. This function does the following: Opens the clipboard by calling the OpenClipboard function. Empties the clipboard by calling the EmptyClipboard function. Calls the SetClipboardData function once for each clipboard format the application provides. Closes the clipboard by calling the CloseClipboard function.

11 Pasting Information from the Clipboard
In the Label application, the application-defined EditPaste function pastes the content of the clipboard. This function does the following: Opens the clipboard by calling the OpenClipboard function. Determines which of the available clipboard formats to retrieve. Retrieves the handle to the data in the selected format by calling the GetClipboardData function. Inserts a copy of the data into the document. The handle returned by GetClipboardData is still owned by the clipboard, so an application must not free it or leave it locked. Closes the clipboard by calling the CloseClipboard function.

12 Dynamic Data Exchange And Dynamic Data Exchange Management Library
The DDE protocol is a set of messages and guidelines. It sends messages between applications that share data and uses shared memory to exchange that data between them. Applications can use the DDE protocol for continuous exchanges in which they send updates to one another as new data becomes available. Windows also supports the Dynamic Data Exchange Management Library (DDEML) that provides an interface that simplifies the task of adding DDE capability to an application.

13 Dynamic Data Exchange (DDE) differs from the clipboard data- transfer mechanism. One difference is that the clipboard is almost always used as a one-time response to a specific action by the user (such as clicking Copy or Paste from a menu). Although DDE can also be initiated by a user, it typically continues without the user's further involvement.

14 Dynamic Data Exchange Protocol
Because Windows has a message-based architecture, passing messages is the most appropriate method for automatically transferring information between applications. However, messages contain only two parameters (wParam and lParam) for passing data. As a result, these parameters must refer indirectly to other pieces of data when more than a few words of information pass between applications. The DDE protocol defines exactly how applications should use the wParam and lParam parameters to pass larger pieces of data by means of global atoms and shared memory handles. The DDE protocol has specific rules for allocating and deleting global atoms and shared memory objects. A global atom is a reference to a character string. In the DDE protocol, atoms identify the applications exchanging data, the nature of the data being exchanged, and the data items themselves.

15 Uses for DDE DDE can be used to implement a broad range of application features. Examples: Linking to real-time data, such as to stock market updates, scientific instruments, or process control. Creating compound documents, such as a word processing document that includes a chart produced by a graphics application. Using DDE, the chart will change when the source data is changed, while the rest of the document remains the same. To use the DDEML, you must include the DDEML.H header file in your source files, link with the USER32.LIB file, and ensure that the DDEML.DLL file resides in the system's path.

16 Client, Server, and Conversation
Two applications participating in DDE are said to be engaged in a DDE conversation. The application that initiates the conversation is the DDE client application; the application that responds to the client is the DDE server application. Since a DDE conversation is identified by the pair of handles to the windows engaged in the conversation, no window should be engaged in more than one conversation with another window. Either the client application or the server application must provide a different window for each of its conversations with a particular server or client application.

17 Dynamic Data Exchange Message Flow
A typical DDE conversation consists of the following events: The client application initiates the conversation, and the server application responds. The applications exchange data by any or all of the following methods: The server application sends data to the client at the client's request. The client application sends unsolicited data to the server application. The client application requests the server application to notify the client whenever a data item changes (warm data link). The client application requests the server application to send data whenever the data changes (hot data link). The server application carries out a command at the client's request. Either the client or server application terminates the conversation.

18 An application window that processes requests from a client or server must process them strictly in the order they are received. A client can establish conversations with more than one server; a server can have conversations with more than one client. When handling messages from more than one source, a client or server must process the messages of a conversation synchronously, but need not process all messages synchronously. In other words, it can shift from one conversation to another as needed.

19 Bibliography exchange us/windows/desktop/dataxchg/about-dynamic-data-exchange#client- server-and-conversation us/windows/desktop/dataxchg/about-the-ddeml us/windows/desktop/dataxchg/clipboard


Download ppt "DATA EXCHANGE."

Similar presentations


Ads by Google