dde支持传输的几种类型详解.doc_第1页
dde支持传输的几种类型详解.doc_第2页
dde支持传输的几种类型详解.doc_第3页
dde支持传输的几种类型详解.doc_第4页
dde支持传输的几种类型详解.doc_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Dynamic Data Exchange and XlTable FormatMicrosoft Windows provides several methods for transferring data between applications. One way to transfer data is to use Windows dynamic data exchange (DDE). DDE is a message protocol for data exchange between Windows programs. It allows software developers to design applications that share data and thereby provide the user with a more integrated Windows environment.For complete information about DDE, see the documentation for the Microsoft Windows Software Development Kit (SDK). This article describes the DDE formats that Microsoft Excel supports, and it provides detailed information about the high-performance XlTable DDE format.DDE FormatsMicrosoft Excel supports several DDE formats. The formats are listed in the following table in the order of precedence defined by Microsoft Excel, from highest precedence (XlTable) to lowest precedence (CF_METAFILEPICT). Clipboard formats that begin with CF_ are formats that are already defined in Windows.h. Clipboard formats without CF_ must be registered before use. For more information about registering formats, see Registering Clipboard Formats.Clipboard formatDescriptionXlTableMicrosoft Excel fast table format. For more information, see Fast Table Format.Biff5Binary interchange file format (BIFF) for Microsoft Excel version 5.0. For more information about the file format, see Microsoft Excel File Format.Biff4Binary interchange file format (BIFF) for Microsoft Excel version 4.0.Biff3BIFF for Microsoft Excel version 3.0.BiffBIFF for Microsoft Excel version 2.x.CF_SYLKMicrosoft symbolic link (SYLK) format. Microsoft Excel for the Apple Macintosh was originally designed to use SYLK format, and this format is now supported by Microsoft Excel on both the Windows and Macintosh platforms.Wk1Lotus 1-2-3 Release 2.01 and Release 2.2 format.CsvComma-separated values format, commonly used in BASIC language I/O. This is similar to CF_TEXT format, except that Csv uses commas to separate fields. CF_TEXTThe simplest form of Clipboard data. It is a null-terminated string containing a carriage return and linefeed at the end of each line.Rich Text FormatA method of encoding formatted text and graphics for easy transfer between applications. Rich Text Format (RTF) is commonly used by document-processing programs such as Microsoft Word for Windows and Microsoft Word for the Macintosh.CF_DIFAn ASCII format used by the VisiCalc spreadsheet program. The format is under the control of Lotus Development Corporation.CF_BITMAPA Windows version 2.x-compatible bitmap.CF_METAFILEPICTA metafile picture structure. For complete information, see the documentation for the Microsoft Windows Software Development Kit.Registering Clipboard FormatsWhenever an application uses a private Clipboard format such as XlTable, Biff5, Biff4, Biff3, Biff, Wk1, Csv, or Rich Text Format it must register the format before using it. Microsoft Excel registers these private Clipboard formats, and your DDE application must also register any of these formats that you want to use to exchange data.For example, to register XlTable, use the following Windows API function call.wCBformat = RegisterClipboardFormat(LPSTR)XlTable);If the function call is successful, the return value is equal to the format value for the XlTable format. This format value (type WORD) is between 0xC000 and 0xFFFF, and its equal to the format value that Windows returned to Microsoft Excel when it registered XlTable. If Windows cannot register XlTable, the function returns 0 (zero).Fast Table FormatThe fast table format, XlTable, is designed to maximize the DDE transfer speed of Microsoft Excel. XlTable consists of a sequence of data blocks that represent a rectangular selection of cells (a table). Each data block has three parts:WORD tdt /* the table data type */WORD cb /* the size (count of bytes) of the data */BYTE datacb /* the data */The first data block is always of type tdtTable, which specifies the number of rows and the number of columns in the table. The data blocks that follow tdtTable represent all the cells in the table. Microsoft Excel renders the reference of the cells in the table (for example, R1C1:R2C4) as the item part of the DDE message.The cells are always rendered row-wise. In other words, all the cells in the first row of the table appear first, then all the cells in the second row, and so on. To minimize overhead, adjacent cells of the same type (tdt) are represented together in one data block, even if the cells are in different rows. In other words, one tdtFloat can contain several numbers, one tdtString can contain several strings, one tdtBool can contain several Boolean values, and so on. For examples, see the following sections, XlTable Example 1 and XlTable Example 2.The data block types are described in the following table.Data block type ValueDescriptiontdtTable0x0010The size of the table. The data (4 bytes, cb=4) consists of two words. The first word is the number of rows, and the second word is the number of columns.tdtFloat0x0001IEEE-format floating-point number. The size of the number is 8 bytes per cell.tdtString0x0002String in st (byte-counted) format. The first byte contains the length of the string (cch). The string isnt null-terminated.tdtBool0x0003Boolean value: 1 = TRUE0 = FALSEThe length of the data is 2 bytes per cell.tdtError0x0004Error value: 0 = #NULL!7 = #DIV/0!15 = #VALUE!23 = #REF!29 = #NAME?36 = #NUM!42 = #N/AThe length of the data is 2 bytes per cell.tdtBlank0x0005A count of the number of consecutive undefined (blank) cells. The data (2 bytes, cb=2) contains the number of consecutive blank cells.tdtInt0x0006Unsigned integer. The length of the data is 2 bytes per cell. Microsoft Excel can read a number in this format, but it never writes a number in this format. tdtSkip0x0007Number of cells to skip. A skipped cell is a cell that retains its previous value. In other words, a skipped cell isnt changed by a WM_DDE_DATA message. You can use tdtSkip to increase DDE performance if your application changes only one or two cells in the middle of a large table. Microsoft Excel doesnt support tdtSkip when the new cell data is part of a WM_DDE_POKE message. The length of the data is 2 bytes (cb=2).XlTable Example 1The following selection of three cells . . .A1 EastA2 WestA3 North. . . produces the XlTable rendering shown in the following table.Data (hexadecimal)Description10 00 04 00 01 00 03 00tdtTable, cb=4, rows=1, columns=302 00 10 00tdtString, cb=1604 45 61 73 74cch=4, East (tdtString continued)04 57 65 73 74cch=4, West (tdtString continued)05 4e 6f 72 74 68cch=5, North (tdtString continued)Notice that the table contains three cells, but the XlTable rendering contains only one tdtString data block.XlTable Example 2The XlTable format uses the tdtBlank data block to represent blank cells in a table. A sequence of several blank cells may be represented by a single tdtBlank data block.For example, the following table . . .A1: 2 A2: 3B1: 4 B2: 5D1: 6 D2: 7 . . . produces the following XlTable rendering.Data (hexadecimal)Description10 00 04 00 02 00 04 00tdtTable, cb=4, rows=4, columns=206 00 08 00 02 00 03 00 04 00 05 00tdtInt, cb=8, int0=2, int1=3, int2=4, int3=5 (Microsoft Excel can read tdtInt as a client, but it would write tdtFloat if it were a server)05 00 02 00 02 00tdtBlank, cb=2, data=2 (two cells are blank)06 00 04 00 06 00 08 00tdtInt, cb=4, int0=6, int1=8Biff5, Biff4

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论