Developer׳S Journal

Developer׳S Journal

Volume 14, Number 5—May 2010 (Special Issue) www.bcbjournal.com ISSN 1093-2097 A Monthly Publication Offering Tips & Techniques for C++Builder Developer’s Journal Edited by Malcolm Smith, Malcolm Groves, Curtis Krauskopf, Remy Lebeau, Bob Swart, and Damon Chandler SSppeecciiaall IIssssuuee CChhaannggiinngg CC++++ PPrreeffaaccee BBuuiillddeerr 22001100’’ss Malcolm Smith DDeeffaauulltt SSaavvee DDiirreeccttoorryy DDaattaaSSnnaapp 22001100 Curtis Krauskopf Bob Swart BBuuiillddiinngg aa CCuussttoomm MMiiggrraattiinngg ttoo MMuullttii--TToouucchh UUnniiccooddee,, PPaarrtt II SSyysstteemm Josh Kelley Byeongcheol Nam and Ki-Tae Bae MMiiggrraattiinngg ttoo UUnniiccooddee,, PPaarrtt IIII LLiibbrraarryy PPrroobblleemmss Curtis Krauskopf Josh Kelley MJFAF Special Offer Page 28 EnCoded Communications Group www.bcbjournal.com C++Builder Developer’s Journal Volume 14, Number 5—May 2010 (Special Issue) Table of Contents 4 IINN TTHHIISS IISSSSUUEE:: 4 Special Issue Preface 3 Malcolm Smith DataSnap 2010 1122 4 Bob Swart Migrating to Unicode, 12 Part I Josh Kelley 1199 Migrating to Unicode, 19 Part II Josh Kelley Changing C++Builder 2299 2010’s Default Save 29 Directory Curtis Krauskopf Building a Custom 3322 32 Multi-Touch System Byeongcheol Nam and Ki-Tae Bae Library Problems 40 Curtis Krauskopf 4400 Developer’s Poll ........ 45 Contributors ............. 46 ISSN 1093-2097 2 C++Builder Developer’s Journal M. Smith, Special Issue Preface Volume 14, Number 5—May 2010 (Special Issue) Special Issue Preface By Malcolm Smith elcome to this special issue of the C++Builder Developer‘s Journal on C++Builder 2010. W Next, ByeongCheol Nam and Ki-Tae Bae de- C++Builder continues to be the tool of choice for scribe how to develop a multi-touch system using developers seeking a powerful, yet easy-to-use C++Builder 2010. The authors present a system which application-development solution for Windows. uses an infrared sensor as a multi-touch sensing de- Embarcadero C++Builder 2010 represents the latest vice; however, for those without such a device, you and greatest release of this award-winning tool. can still test the code by using two mice. This special issue discusses several important Finally, Curtis Krauskopf closes the special issue aspects of C++Builder development which are unique with an article on his experiences in porting libraries to version 2010. Even more, many of the techniques from BCB 6 to C++Builder 2010. Curtis discusses how presented in this issue are relevant to all developers to overcome a significant po- who upgrade to a newer tential problem when linking version of C++Builder. This special issue discusses static libraries into a Bob Swart opens the C++Builder 2010 project. issue with an article on how several important aspects of Thanks to the authors and to use C++Builder 2010 to C++Builder development which editors who have made this build DataSnap 2010 server are unique to version 2010. special issue possible. A spe- and client applications. Bob cial thanks is particularly due discusses several unique to our loyal readers who have aspects of DataSnap 2010, including server methods. continued to support the C++Builder Developer‘s If you need a robust way of creating a data bro- Journal since its first publication over 13 years ago. ker/client application, this is the article for you. On behalf of the special issue editorial board, I‘d Next, Josh Kelley provides an important two-part like to welcome you to this special issue, and I sincere- series on migrating a C++Builder application to Un- ly hope you find the material useful. Enjoy! icode—a daunting process for most developers. In his first article, Josh provides an introduction to Unicode and discusses various ways to work with Unicode text in C, C++, the Windows API, and the VCL. Malcolm Smith, Special Issue Lead Editor In his second article on Unicode, Josh provides MJ Freelancing and Comvision Pty Ltd specific details and guidelines on how to migrate a C++Builder application to Unicode. Josh presents sev- Other Special Issue Editors: eral C/C++ techniques that can be used to help with a Guest Editor: Malcolm Groves Unicode migration. This two-part series is a must- Embarcadero Technologies read for all C++Builder developers. Guest Editor: Curtis Krauskopf Next, Curtis Krauskopf provides three techniques The Database Managers for changing the default directory where new Guest Editor: Remy Lebeau C++Builder 2010 projects are saved. As we all know, Lebeau Software, TeamB, and Indy Project Team the C++Builder IDE insists on saving new projects Guest Editor: Bob Swart into the folder ―My Documents\RAD Stu- Bob Swart Training & Consultancy (eBob42.com) dio\Projects,‖ whereas most developers prefer to save their projects in custom locations. Curtis presents Publications Editor: Damon Chandler three approaches for customizing this location. C++Builder Developer‘s Journal C++Builder Developer’s Journal 3 www.bcbjournal.com Volume 14, Number 5—May 2010 (Special Issue) B. Swart, DataSnap 2010 DataSnap 2010 By Bob Swart Versions: C++Builder 2010 n a previous article, I demonstrated how to use DataSnap in C++Builder 2007 on Windows Vista I to build multi-tier database applications [1]. In the years that followed, DataSnap has undergone a signif- icant overhaul. No longer based on COM, the new DataSnap multi-tier architecture is more lightweight, but also feels like it is ―not yet finished‖ in all places. Unfortunately, C++Builder support is one of the the main form to DSForm, and the Caption to areas which is a lacking compared to the Delphi sup- ―C++Builder DataSnap 2010 Server Container‖, so we port for the new DataSnap. Delphi 2010 includes two know what‘s going on when we see this form run- DataSnap Wizards to produce different kinds of ning. projects, for example, with all components and prop- The ―DataSnap Server‖ category on the Tool Pa- erties already connected and ready to go. With lette contains the new DataSnap components that we C++Builder, we still have to do all that manually, and need to use to produce a DataSnap server application some things will take more effort than others. (see Figure 1). Two components are always needed In this article I will take you all the way, from for any and all DataSnap Server applications: the start to deployment, and even to server methods TDSServer and TDSServerClass components. which out-of-the-box are not possible in C++ for C++Builder, but with a little help from Delphi (or a C++Builder helper class) we can still get them as well. TDSServer Anyway, more than enough to cover lots of time and First, place a TDSServer component on the main form. pages, so let‘s get started. The TDSServer is the actual ―engine‖ of the DataSnap Server, and we can start, pause, or stop this engine C++Builder 2010 Enterprise using the corresponding commands. By default, the TDSServer has the AutoStart property set to true, to You will need the Enterprise (or greater) edition of automatically start the engine when the application C++Builder to be able to participate. Since there are itself starts. There is also a property called HideDSAd- no special DataSnap wizards in C++Builder, we need min which is set to false by default, but can be set to to start with a new VCL Forms Application (you can true to hide some of the methods that the DataSnap also start with a Windows Service Application, but the Server exposes that are not of use for the average Da- normal VCL Forms Application is taSnap Server application. If you the easiest one to demonstrate leave this property set to false, and debug). When saving the then you‘ll see the methods later project, I save the form (UnitX) in when we connect the DataSnap the file ServerContainer.cpp. This client to the server. will be the unit that holds the The TDSServer class has five DataSnap server communication events that we can hook into, to components. The project itself is trace what‘s going on with the saved in DS2010BCBServer- server. The events are OnCon- .cbproj in my case. nect, OnDisconnect, OnError, I‘ve set the Name property of Figure 1: DataSnap server components. OnPrepare and OnTrace. The ISSN 1093-2097 4 C++Builder Developer’s Journal B. Swart, DataSnap 2010 Volume 14, Number 5—May 2010 (Special Issue) OnTrace event gives us interesting details on the server class. This instance will handle all requests commands and data being sent back and forth be- from that source, so it‘s possible to maintain state (i.e. tween the clients and the server. Even if you do not to ask for ―the next 10 records‖, since the server will want to trace the communications, you should at least remember the previous position). The default setting write an event handler for the OnError event, to en- of Session results in the easiest way to build DataS- sure that the server will be notified (or at least some- nap servers and clients, but not in the most scalable one will be notified) of an error situation. The TDSEr- architecture. A few thousand concurrent requests in a rorEventObject has a property, Error, with the ex- time span of only one minute will be tough to handle ception that was causing the error, so the least we can by any DataSnap server if LifeCycle is set to Ses- do is present that information: sion (but a lesser problem for LifeCycle set to Serv- er or Invocation). void __fastcall TDSForm::DSServer1Error( OnGetClass TDSErrorEventObject *DSErrorEventObject) We must use the event hander of the { TDSServerClass to specify which class to use as the ShowMessage(DSErrorEventObject-> DataSnap server class. This should be a data module if Error->Message); we want to expose TDataSetProvider components— } which usually is the case.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    46 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us