Windows işletim sisteminde çalışabilen uygulamalarda dinamik veri değiş tokuşunun kullanımı

thumbnail.default.placeholder
Tarih
1994
Yazarlar
Mustafa, İşbilen
Süreli Yayın başlığı
Süreli Yayın ISSN
Cilt Başlığı
Yayınevi
Fen Bilimleri Enstitüsü
Institute of Science and Technology
Özet
Tezin genel amacı DDE'yi (Dynamic data exchange) açıklayıp, yazılım geliştirenler için bunu pratiğe aktarmada yöntemler verebilmektir. İlk olarak DDE'nin terminolojisini oluşturan kavram ve kelimeler verildi. DDE; Windows'da (MS Windows 3.1 işletim sistemi) prosesler arası haberleşmede desteklenen üç mekanizmadan biridir. Diğer iki mekanizma, Windows Clipboard ve dinamik bağlantı kütüphaneleriyle (DLL) paylaşımlı bellek kullanılmasıdır. Windows'da çalışan iki program bir DDE oturumunda birbirlerine iletiler postalayarak çalışırlar. Bunlardan oturumu başlatan; istemci, hizmet veren; Sunucu'dur. Windows Sunucu programı, diğer Windows programının yararlanacağı verilere erişen programdır. DDE İstemcisi ise verileri elde eden programdır. Windows programı, bir programa göre istemci diğerine göre sunucu olarak davranabilir. Böyle olursa iki ayrı oturumun kurulması gerekir. Sunucu uygulama, birden fazla istemciye veri gönderebilir ya da bir istemci birden fazla sunucudan veri alabilir. O zaman birden fazla DDE oturumlarının kurulması gerekir. Bu oturumların biricik (unique) ve ayrık olmalarını sağlamak için istemci/sunucu üzerindeki her oturum farklı bir pencere kullanır. DDE oturumunda çalışacak programların kodlarının özel bir biçimde yazılması gerekir. DDE sunucusunun kullandığı verinin biçimi ile (format) istemcinin istediği aynı veya dönüştürülebilir olmalı. Temel olarak üç çeşit DDE oturumu vardır; soğuk bağlantı, sıcak bağlantı, ılık bağlantı. DDE'nin Visual Basic ve Excel üzerinde uygulanması açıklandı. Sonra buraya kadar anlatılanları kapsayan TEZDEMO.MAK/EXE isimli bir uygulama geliştirildi. 5. bölüm bu uygulamaya ayrıldı. Ayrıca program kodu içinde verilen açıklamalara ek olarak TEZDEMO'nun kullanımı için de akış diyagramı verildi. Yazılım geliştirenler, bu uygulamada kullanılan temel işlemlerden faydalanıp çeşitli yazılımlar hazırlayabilirler.
Interprocess communication between two Windows applications using DDE (Dynamic data exchange) is called a DDE conversation. The conversation is initiated by the DDE client application requesting that a DDE server application open a DDE channel over which to hold the conversation. DDE clients and servers are occasionaly referred to as DDE source and destination applications, respectively, paralleling OLE (Object linking & embedding) terminology. The relationship between DDE clients and servers is similar to that between workstations and database servers. The primary difference is that both the DDE client and server applications must be running on the same computer, because the transfer of data between applications takes place through the Windows Clipboard. The single-computer restriction does not apply if you use the Network DDE features on Windows for Workgroups. In addition to transferring data from and to DDE server applications, you can execute instructions, usually in the form of the menu commands in DDE servers that support the DDE execute statement. DDE is one of three mechanisms of interprocess communication supported under Windows. The other two are the Windows clipboard and shared memory in dynamic link libraries. DDE is based on the messaging system built into Windows. Two Windows programs carry on a DDE conversation by posting messages to each other. These two programs are known as the server and client. A DDE server is the program that has access to data that may be useful to other Windows programs. A DDE client is the program that obtains this data from the server..VI' A single Windows program can be both a client to one program and a server to another, but this requires two different DDE conversations. A server can deliver data to multiple clients, and a client can obtain data from multiple servers, but again, this requires multiple DDE conversations. To keep this conversations unique and separate, each conversation (on both the client and server sides) uses a different window. Generally, a program that supports DDE will create a hidden child window for each conversation it maintains. Because DDE uses the messaging system built into Windows, it fits very naturaly in the environment. But this is not to say that DDE is easy to implement. The protocol has many options, and programs must be ready to deal with some rather tricky problems. The Types of Conversation There are three basic types of DDE conversations; cold link, hot link, warm link. These conversations use DDE messages defined in the DDE.H header file. The simplest of the three conversations is known as cold link. 1) The Cold Link A cold link conversation begins when a client broadcast a WM_DDEJNITIATE message identifying the application and topic it requires. (The application and topic may be set to NULL to begin a conversation with any server application or any data topic.) A server application that supports the specified topic responds to the client with a WM_DDE_ACK (acknowledge) message. The client then requests a particular data item by posting a WM_DDE_REQUEST message. If the server can supply this data item, it responds by posting a WM_DDE_DATA message to the client. The client can acknowledge to the server that it has received the WM_DDE_DATA message. The server indicates whether it wants this acknowledgement in a flag passed with the WM_DDE_DATA message. A flag passed with the WM_DDE_ACK message indicates a positive acknowledgement. If the client posts a WM_DDE_REQUEST message to the server, and the server can not supply the request data item, then the server posts a negative WM_DDE_ACK message to the client. VII - The DDE conversation continues with the client posting WM_DDE_REQUEST messages to the server -for the sama data or different data items- and the server responding with WM_DDE_DATA or WM_DDE_ACK messages. The conversation is terminated when the client and server post each other WM_DDE_TERMINATE messages. 2) The Hot Link One problem with the cold link is that the data the server has access to may change with the passing of time. In the cold link, the client does not know when the data changes. The hot link solves this problem. Again, the DDE conversation begins with a WM_DDE_INITIATE message and a WM_DDE_ACK message. The client indicates the data item it requires by posting a WM_DDE_ADVISE message to the server. The server responds by posting a WM_DDE_ACK message indicating if it has access to this item. A positive acknowledgement indicates that the server can supply the data; a negative acknowledgement indicates that it cannot. At this point, the server is obligated to notify the client whenever the value of the data item changes. This notification uses a WM_DDE_DATA message, to which the client (based on a flag set in the WM_DDE_DATA message) may or may not respond with a WM_DDE_ACK message. When the client no longer wishes to be advised of updates to the data item, it posts a WM_DDE_UNADVISE message to the server, and the server acknowledges. The conversation is terminated with the posting of WM_DDE_TERMINATE messages. The cold link and the hot link are not mutually exclusive. During a single DDE conversation, a client may ask for some data items by using WM_DDE_REQUEST (for a cold link) and ask for others by using WM_DDE_ADVISE (for a hot link). - VIII - 3) The Warm Link The warm link combines elements of the cold link and hot link. The conversation begins as normal. As with the hot link, the client posts a WM_DDE_ADVISE message to the server, and the server acknowledges either positively or negatively. However, a flag passed with the WM_DDE_ADVISE message indicates that the client wishes only to be informed of changes in data without immediately receiving the new data item. So the server posts WM_DDE_DATA messages with NULL data. Now the client knows that a particular data item has changed. To obtain this item, the client uses a WM_DDE_REQUEST message, just as in cold link. As in the hot link, a client can stop being advised of changes in data items by posting a WM_DDE_UNADVISE message to the server. The conversation is terminated with the posting of WM_DDE_TERMINATE messages. These three types of conversations use all the DDE messages except two: WM_DDE_POKE (in which a client gives a server unsolicited data) and WM_DDE_EXECUTE (in which a client sends a command string to a server). Initiating a DDE Conversation with Service and Topic Names in VB The DDE server that participates in the conversation is identified by its Service name; in versions of Windows prior to 3.1, Service name was called Application name, Service name is usually, but not always, the name of the application's executable file, without the.EXE extension. Service name is the name by which the Windows Task Manager recognizes the application. If the client request can not obtain a DDE channel within a fixed time period, called the DDE timeout interval, you receive an error message. If the server application is not running, you need to launch the application with Visual Basic's Shell() function before you attempt to initiate a DDE conversation. Setting the value of the LinkMode property to a positive integer (1,2 or 3) does not cause Windows to automatically launch the application. - IX- You set the value of Visual Basic's LinkTopic property to the combination of the DDE Service name and the DDE Topic name, separated by a pipe character. If the document is a file, you need to specify a well- formed path to the file and the file name as the Topic name. The following two statements open a DDE channel from a control object (ctrDDELink) to an Excel worksheet, SHEET.XLS, in the C:\EXCEL\WRKSHEET directory: ctrDDELink.LinkTopic = "Excel|C:\EXCEL\WRKSHEET\SHEET.XLS" ctrDDELink. LinkMode = 2 'Manual All DDE server applications are required to have a Topic name "System" that returns information about the server, including the names of valid topics. Testing the values returned by the System topic enable you to determine if the file that constitutes the topic is presently open in the server application. If setting the value of the LinkMode property successfully opens a DDE channel, Visual Basic assignes the channel number to the control object. If the link fails, you receive an error message. The preceding code fragment returns the entire content of the worksheet to ctrDDELink. An Example TEZDEMO for DDE There is an example about DDE, at the back of this book. TEZDEMO includes the principal DDE techniques. This thesis gives a route with which reader can develope more complex applications. The comments in the program code, are enough to understand it easily.
Açıklama
Tez (Yüksek Lisans) -- İstanbul Teknik Üniversitesi, Fen Bilimleri Enstitüsü, 1994
Thesis (M.Sc.) -- İstanbul Technical University, Institute of Science and Technology, 1994
Anahtar kelimeler
Veri iletişimi, Windows NT, İşletim sistemleri, Data communication, Windows NT, Operating systems
Alıntı