Podobne
- Strona startowa
- iraq book of iraq dodipp intelligence for military personnel
- Callan Book 6 [Stage 11]
- Callan Book 5 [Stage 9 & 10] (2)
- E BOOK Helion Hakerstwo PL
- Callan Book 4 [Stage 7 & 8]
- Callan Book 3 [Stage 5 & 6] (4)
- Borland Delphi 7 Developer's Guide
- Zbigniew Nienacki Raz w roku w Skiroławkach
- Tey Josephine Córka czasu
- dygasiński adolf as
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- zuzanka005.pev.pl
Cytat
Do celu tam się wysiada. Lec Stanisław Jerzy (pierw. de Tusch-Letz, 1909-1966)
A bogowie grają w kości i nie pytają wcale czy chcesz przyłączyć się do gry (. . . ) Bogowie kpią sobie z twojego poukładanego życia (. . . ) nie przejmują się zbytnio ani naszymi planami na przyszłość ani oczekiwaniami. Gdzieś we wszechświecie rzucają kości i przypadkiem wypada twoja kolej. I odtąd zwyciężyć lub przegrać - to tylko kwestia szczęścia. Borys Pasternak
Idąc po kurzych jajach nie podskakuj. Przysłowie szkockie
I Herkules nie poradzi przeciwko wielu.
Dialog półinteligentów równa się monologowi ćwierćinteligenta. Stanisław Jerzy Lec (pierw. de Tusch - Letz, 1909-1966)
[ Pobierz całość w formacie PDF ]
.cpp file.Using a Data Module with a DLL, COM, or CORBA object is actually just as simple.If you are using a data module with a DLL and need the data module to remain openacross calls to the DLL for the duration of time the DLL is loaded, you can open thedata module in the DllEntryPoint().The code in Listing 7.1 shows how this works.LISTING 7.1 Creating a Data Module in a DLL#include#include#pragma hdrstop#include#include#pragma argsusedString InternallyMaintainedResultString;int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*¥'lpReserved){// This is called on every process attach,// so make sure we need to initialize by checking the global variable.if (TestDataModule == NULL){Application->Initialize(); // This is essentialApplication->CreateForm(__classid(TTestDataModule),&TestDataModule);};return 1;}10 0672324806 CH07 12/12/02 2:42 PM Page 387How to Add Properties to a Data Module? 387Similar procedures can be followed for COM (the data module must be instantiatedin the DllEntryPoint() function of the generated Active Server Library) and CORBA.In CORBA, the server is itself a data module, so it is very easy to use data moduletechniques with CORBA.For more on multitier and distributed programming, see Part IV, DistributedComputing.What Goes in a Data Module?The basic data module is one that is used to contain datasets and data sources.Thissimple use of the data module enables you to encapsulate database objects, persistentfields, and event handlers for referential integrity, data validation, and the propaga-tion of changes across database tables.The resulting data module can be used withany user interface, as long as there are no references to controls on any specific form.Thus, when committing to the use of data modules, you also must commit to theuse of data-aware controls in your user interfaces.In most cases, the existing data-aware controls are sufficient, but you might also need to be prepared to create yourown data-aware control classes from nondata-aware control classes, through the useof the TDataLink and related classes.Data modules also often contain a TCustomConnection descendant for use either by thedata components in the data module or by other data module data components.The next type of data module contains nondatabase controls controls such astimers, custom nonvisual components, and so on.Developers often create specialcustom components for things like registry access, access to devices such as the serialand parallel ports, or to hardware modules.All of these components can also be athome in the data module.This enables them to be shared across applications, justlike data components.How to Add Properties to a Data Module?As with all forms, data modules do not easily allow the addition of published proper-ties.The best method for getting around this problem is to create a special TComponentdescendant with published properties that are the ones you would add to the datamodule if you could.Such a component can then be manipulated, and its propertyvalues set at design time or runtime.The component can be accessed by the code indata module event handlers during program operation, or by forms that need tomake values (including pointers to controls) available to the data module withouthaving the data module be coupled to a specific form.Naturally, you can also use public methods, variables, or properties, but then youwill be limited to setting values at runtime.This is more error prone and more diffi-cult to verify because you cannot look at the component alone, but must also read10 0672324806 CH07 12/12/02 2:42 PM Page 388388 CHAPTER 7 Database Programmingthe associated C++ statements in the.cpp file that uses the component.Nevertheless,such methods have a place.For instance, you can have a user interface that needs toregister a control, such as a progress bar, with the data module.This cannot be doneat design time without coupling the data module to the form, so it must be done bysetting a public variable or property in your C++ code.How to Use the Data Module DesignerThe data module designer consists of two panes.To the left is a tree representation ofthe components in the data module (such as datasets, data sources, and persistentfields).To the right is a two-page interface.One page is for the components you dropinto the data module.The other page is for drawing data diagrams.The Object Tree View and the Data Module DesignerThe Data Module Designer window is where you drop your components
[ Pobierz całość w formacie PDF ]