Pascal Newsletter #20
The full source code examples of this issue are available for download.
![]() |
![]() |
Pascal Newsletter #20 - 15-APR-2001 INDEX 1. A FEW WORDS FROM THE EDITOR 2. HELP & MANUAL - What is Help & Manual? - A straight-forward and easy-to-use interface - Good reasons to use Help & Manual - What do you need to work with Help & Manual? · What do you need to create Windows help files (.HLP files)? · What do you need to print a manual? · What do you need to create HTML pages? · What do you need to create the new fancy HTML HELP (.CHM files)? - EC Software Help Suite (EHS) · All about Help files in Borland Delphi - Where to get Help & Manual - Other interesting stuff 3. DETERMINING IF A FORM HAS MOVED 4. GETTING THE BIOS SERIAL NUMBER 5. FROM NEWBIE TO NEWBIE WRITING WITH LABEL1 IN "REALTIME" 6. DELPHI ON THE NET - Kylix articles - Delphi articles 7. RESOURCES ________________________________________________________________________ 1. A FEW WORDS FROM THE EDITOR In this issue I'm glad to present Help & Manual, an excellent tool that will help you create a good documentation quickly and easily. --------------------------------------------- I M P O R T A N T A N N O U N C E M E N T --------------------------------------------- Before writing this article, I contacted EC Software -the makers of Help & Manual- and I convinced them to do a drawing ("raffle") with one license of their software (including twelve months of free upgrades), and as a special courtesy, the subscribers of this newsletter that participate in the drawing will be given two numbers instead of one. Besides that, participants can get more numbers by referring other participants. Participation is free, and you don't need to purchase or evaluate the product. To participate, or get more information follow this link: http://www.latiumsoftware.com/ec-software/index.php?lang=en Best regards, Ernesto De Spirito eds2004 @ latiumsoftware.com ________________________________________________________________________ JfControls Library. Multi-language. Multi-appearance. Skins. Privileges. More than 40 integrated and customizable components. Impressive GUI. Centralized resources administration. Multiple programming problems solved. For Delphi 3-7 and C++ Builder 3-6. http://www.jfactivesoft.com/ ________________________________________________________________________ 2. HELP & MANUAL Writing a good help file with browse sequences, table of contents, index and everything, and fully integrating it to an application can be too cumbersome... or at least that was my idea until I tried Help & Manual. What is Help & Manual? ====================== Help & Manual is a stand-alone and true WYSIWYG authoring tool that simplifies the creation of Windows help files, printed manuals and documentation in general. A straight-forward and easy-to-use interface ============================================ Help & Manual combines a text editor and a tree-view of the content in one window. It lets you easily navigate the table of contents and insert or edit help topics without much fuss. This simple and intuitive interface has much been copied but never reached the same usability level. The WYSIWYG interface leaves out all the cryptic references for hyperlinks, macros and images. Instead of scuffling with topic IDs, footnotes and obscure commands, you can concentrate on more important things: to design your help file. Everything you need is right there at your finger tips. With Help & Manual you can easily create Windows help files (for Windows 3.x, Windows 95 / NT and the new format HTML HELP) as well as electronic documentation (HTML pages, richtext files to ship an electronic manual). Last but not least, you can print user manuals directly, including a table of contents and a keyword index, with customized page layouts, headers, footers and page numbering. All these documentation types are created from one single source! From a Help & Manual project that saves the data for topics, contents, keywords, index and all project settings in a single source file. Good reasons to use Help & Manual ================================= * Save time Help & Manual helps you to create better documentation more quickly. Writing the help file for a mid-ranged software project is a matter of days, not weeks. * Save money Online help is a key feature of your software and cannot be undervalued. A professional and well organized documentation can decrease support costs drastically. * Concentrate on the important thing Explain your software to your users, not the help authoring tool to yourself. Help & Manual's intuitive user interface is transparent, straight-forward and shields you from the technical stuff of help files. What you see is simply what you get. * Supply a print manual What other help authoring tools just promise - Help & Manual does it. It directly prints ready-to-ship user manuals from your help project. Forget the fuss about different formattings for online help and print output. * Get ready for HTML HELP Microsoft has introduced the new help standard HTML HELP with Windows 98. Help & Manual is ready and creates HLP files as well as HTML HELP (CHM). When you want to step, don't choose a new tool. Choose a different output in Help & Manual. What do you need to work with Help & Manual? ============================================ Help & Manual is a stand-alone and true WYSIWYG authoring tool. You do not need an additional word processor to write your documentation. What do you need to create Windows help files (.HLP files)? ----------------------------------------------------------- You need a help compiler - freely available from the Microsoft web site. Depending on the target system you want to create help for (Windows 3.x or Windows 95/98/NT) there are different compilers available. You can download them from these locations: * 16-Bit Winhelp compiler "HCP.EXE" 3.10.505 (~108 Kb) http://www.ec-software.com/pgm/hcp505.zip * 32-Bit Winhelp compiler "HCW.EXE" 4.03 (~1.5Mb) http://www.ec-software.com/pgm/hcw403.exe What do you need to print a manual? ----------------------------------- A printer. Unlike other authoring tools that need a word processor to print manuals, Help & Manual directly prints booklet style manuals including a content page, chapter numbering, topic headings and a keyword index. What do you need to create HTML pages? -------------------------------------- Help & Manual - nothing else. Help & Manual directly creates plain HTML. What do you need to create the new fancy HTML HELP (.CHM files)? ---------------------------------------------------------------- You must have the Microsoft HTML HELP Workshop installed - freely available from the Microsoft web site. * Microsoft HTML HELP Workshop 1.31 (~4 Mb) http://msdn.microsoft.com/library/tools/htmlhelp/wkshp/htmlhelp.EXE EC Software Help Suite (EHS) ============================ EC Software has developed an interesting set of components for Delphi that are freeware and include source code, but are not GPL, so you can use them freely in your applications without restrictions and without having to pay any charge or runtime fees. http://www.ec-software.com/comppage.htm Among these components, you have the EC Software Help Suite (EHS), a set of four component to make it easy to integrate help to your application: * TWhatsThis Automates right-click context sensitive "What's this?"-help and implements a fully automated context sensitive help mode similar to MS Word. Drop a TWhatsThis component on your main form and instantly enable context help menus for all controls without a single code line. What's more, it enables right-click help for menu items and gives you full control over the F1 key. * THelpRouter Builds a bridge to HTML HELP without extra coding. It manages the translation of help calls and context sensitive help. This component is the successor of former THTMLHelpRouter. New functions: support for context sensitive HTML HELP popups and mixed-mode help (HTML HELP plus Winhelp popup windows). * THelpContextMap Stores help context numbers and their associated topic IDs in a compressed form with ultra-fast searching. It reads help context numbers directly from a help project file (Winhelp and HTML HELP) and is designed to work with TWhatsThis. * TTrainingCard Simplifies the implementation of Winhelp training cards. Training card help is a kind of wizard in HLP format that interacts with your application. Please refer to the documentation for more info. This component was earlier released as a stand-alone component. If you use it, please uninstall the single component and delete the source before you install EC Software Help Suite. Downloads: * EC Software Help Suite for Delphi 3, 4 and 5 (includes full source code and compiled samples) http://www.ec-software.com/delphi/ehs.zip (~656 Kb) * mycomp: An example project showing how to create a help file for a Borland Delphi component and how to integrate it into the Delphi IDE. http://www.ec-software.com/delphi/mycomp.zip (~15 Kb) All about Help files in Borland Delphi -------------------------------------- This comprehensive tutorial covers all aspects of integrating a help file into a Delphi application. Learn how to... * Display the table of contents, the index and find tab from your application * Work with help commands and macros * Brush up your application with context sensitive help * Implement What's This? popup help * Accomplish contextual help with keywords (like the Delphi code editor) * Component help files seamlessly integrated into Delphi online help * And much more The document comes with a demo application that features all the highlights discussed in the tutorial. The compiled EXE and full source code is included. Download: * All about help files in Borland Delphi http://www.ec-software.com/delphi/helpd3_5.zip (~542 Kb) Also available online: http://www.ec-software.com/helpdelphi/index.html Where to get Help & Manual ========================== You can download an evaluation copy fully functional for 14 days from: http://www.ec-software.com/pgm/hmsetup.exe (~5.2 Mb) Other interesting stuff ======================= * T.N.T Screen Capture Tool - This is a screen capture utility that claims to create "screen shots that look better than the original screen". Can that be possible? Well, seeing is believing, so see it by yourself: http://www.ec-software.com/tnt/index.html Download a fully functional evaluation copy of T.N.T: http://www.ec-software.com/pgm/tntsetup.exe (~1.6 Mb) * HelpPos - A small freeware tool that can change and store the window position of a help file durably. The position of a help window is defined when the help file gets compiled. If you have no source of a help file (and you usually don't if you have not written it) you have no chance to change the window positions... but with HelpPos you can! http://www.ec-software.com/pgm/helppos.zip (~140 Kb) For more resources, pricing and other information, visit EC Software's web site: http://www.ec-software.com ------------------------------------ Portions of this article are Copyright © 2000 EC Software ________________________________________________________________________ 3. DETERMINING IF A FORM HAS MOVED We can know if a form has resized with the Resize event (OnResize property), but how do we know if a form has moved? Simply by capturing the WM_MOVE Windows message: interface ... type TForm1 = class(TForm) ... private { Private declarations } procedure FormMove(var Msg: TWMMove); message WM_MOVE; ... end; ... implementation ... procedure TForm1.FormMove(var Msg: TWMMove); begin inherited; Label1.Caption := Format('(%d,%d)', [Left, Top]); end; ... We call "inherited" to let the ancestors of TForm process the message. This will update the Left and Top properties. In the above example we simply displayed them, but we can use this kind of Move event for example to guarantee that the form is always placed within the limits of the screen's work area (the portion of the screen not used by the system taskbar or by application desktop toolbars). procedure TForm1.FormMove(var Msg: TWMMove); var WorkArea: TRect; begin inherited; if SystemParametersInfo(SPI_GETWORKAREA, 0, @WorkArea, 0) then begin if Left < WorkArea.Left then Left := WorkArea.Left else if Left + Width > WorkArea.Right then Left := WorkArea.Right - Width; if Top < WorkArea.Top then Top := WorkArea.Top else if Top + Height > WorkArea.Bottom then Top := WorkArea.Bottom - Height; end; end; ________________________________________________________________________ 4. GETTING THE BIOS SERIAL NUMBER For a simple copy-protection scheme we need to know whether the machine that is executing our application is the one where it was installed. We can save the machine data in the Windows Registry when the application is installed or executed for the first time, and then every time the application gets executed we compare the machine data with the one we saved to see if they are the same or not. But, what machine data should we use and how do we get it? In a past issue we showed how to get the volume serial number of a logical disk drive, but normally this is not satisfying for a software developer since this number can be changed. A better solution could be using the BIOS serial number. BIOS stands for Basic Input/Output System and basically is a chip on the motherboard of the PC that contains the initialization program of the PC (everything until the load of the boot sector of the hard disk or other boot device) and some basic device-access routines. Unfortunately, different BIOS manufacturers have placed the serial numbers and other BIOS information in different memory locations, so the code you can usually find in the net to get this information might work with some machines but not with others. However, most (if not all) BIOS manufacturers have placed the information somewhere in the last 8 Kb of the first Mb of memory, i.e. in the address space from $000FE000 to $000FFFFF. Assuming that "s" is a string variable, the following code would store these 8 Kb in it: SetString(s, PChar(Ptr($FE000)), $2000); // $2000 = 8196 We can take the last 64 Kb to be sure we are not missing anything: SetString(s, PChar(Ptr($F0000)), $10000); // $10000 = 65536 The problem is that it's ill-advised to store "large volumes" of data in the Windows Registry. It would be better if we could restrict to 256 bytes or less using some hashing/checksum technique. For example we can use the SHA1 unit (and optionally the Base64 unit) introduced in the issue #17 of this newsletter: http://www.latiumsoftware.com/en/pascal/0017.php The code could look like the following: uses SHA1, Base64; function GetHashedBiosInfo: string; var SHA1Context: TSHA1Context; SHA1Digest: TSHA1Digest; begin // Get the BIOS data SetString(Result, PChar(Ptr($F0000)), $10000); // Hash the string SHA1Init(SHA1Context); SHA1Update(SHA1Context, PChar(Result), Length(Result)); SHA1Final(SHA1Context, SHA1Digest); SetString(Result, PChar(@SHA1Digest), sizeof(SHA1Digest)); // Return the hash string encoded in printable characters Result := B64Encode(Result); end; This way we get a short string that we can save in the Windows Registry without any problems. You can take it as a sort of "BIOS serial number". DISPLAYING BIOS INFORMATION --------------------------- If we wanted to display the BIOS information we should parse the bytes to extract all null-terminated strings with ASCII printable characters at least 8-characters length, as it is done in the following function: function GetBiosInfoAsText: string; var p, q: pchar; begin q := nil; p := PChar(Ptr($FE000)); repeat if q <> nil then begin if not (p^ in [#10, #13, #32..#126, #169, #184]) then begin if (p^ = #0) and (p - q >= 8) then begin Result := Result + TrimRight(String(q)) + #13#10; end; q := nil; end; end else if p^ in [#33..#126, #169, #184] then q := p; inc(p); until p > PChar(Ptr($FFFFF)); Result := TrimRight(Result); end; Then we can use the return value for example to display it in a memo: procedure TForm1.FormCreate(Sender: TObject); begin Memo1.Lines.Text := GetBiosInfoAsText; end; ________________________________________________________________________ 5. FROM NEWBIE TO NEWBIE WRITING WITH LABEL1 IN "REALTIME" by Anders Dahl ================================= You had finished your project and everything is running as you like, but... helppage and aboutbox could be much nicer, almost better than if a pro had wrote it :) How? I'll show you: Place a Timer and a Label on your helppage or aboutbox: procedure TForm1.Timer1Timer(sender:TObject); const LabelString = 'This is a Label'; begin Label1.caption := copy(LabelString, 1, Timer1.Tag + 4); Timer1.Tag := Timer1.Tag + 3; if Timer1.Tag = Length(LabelString) then Timer1.Enabled := False; Application.ProcessMessages; end; You can write your messages in the LabelString as above, and if you want to do it in multiple lines use #10#13. I'll write an example: LabelString = ('This is how to' +#10#13+ 'write in realtime!!,' +#10#13+ 'with a Label......'); You can change the speed by Timer1.Interval and even with TagNumbers. The number 3 above is how many letters are to be shown in runtime. I think best solution is 1, and the 4 is how fast it going, best solution is 9, but you can find out for yourself. Set the Timer1.Interval to 1. There is a famous Delphi programmer named Marco Cantù from Italy who wrote the books "Mastering Delphi 4" and "Mastering Delphi 5". On his web site you can download the source code examples of the books. http://www.marcocantu.com/md4/md4dload.htm http://www.marcocantu.com/md5/md5dload.htm It contains many examples of Delphi programming, from basic to Internet. I recommend you to download them, and if you have questions about them you can join one of Marco Cantù's newsgroups: http://www.marcocantu.com/home/newsgroup.htm Have fun! :) ________________________________________________________________________ 6. DELPHI ON THE NET Kylix articles ============== * RADical Performance Linux Application Development - Evaluator's Guide January 2001 - by Borland Staff An excellent material to help you evaluate Kylix and see its features http://www.borland.com/kylix/papers/eval_guide.pdf (~1.22 Mb) * Creating Kylix Database Applications - by Bill Todd Examines the architecture of dbExpress and the provide/resolve mechanism. Subsequent sections describe the components that implement the Kylix data access strategy, and lead you through the steps of building a simple database application, demonstrating the power and productivity they provide. http://www.borland.com/kylix/papers/kylix_dbapps.pdf (~383 Kb) * A Quick Tour of Kylix - by Kylix Publications Team Explains how to start Kylix and gives you a quick tour of the main parts and tools of the desktop. It also gives you an overview of software development with Kylix. This includes creating a project, working with forms, writing code, and compiling, debugging, deploying, and preparing programs for international use. http://www.borland.com/kylix/papers/kylix_tour.pdf (~689 Kb) * Apache Development with Kylix Server Developer - by Colin A. Ridgewell Shows the ease with which Apache web server, web and Internet applications can be developed using Borland Kylix. This paper acts as an introduction to the capabilities of Kylix and Apache. http://www.borland.com/kylix/papers/apache_development.pdf (~674 Kb) * Using the Open Tools API in Kylix - by Ray Lischner How to extend and customize the Kylix IDE. http://community.borland.com/article/0,1410,27205,00.html * Borland's Kylix: turbocharging Linux development - by Scott Courtney A review of Kylix, with screen shots and an example of the creation of a simple application http://www.linuxplanet.com/linuxplanet/reviews/3207/1/ Delphi articles =============== * Internet Programming with Delphi - by Marco Cantù http://community.borland.com/article/0,1410,27143,00.html * Creating WAP Applications with Borland Delphi - by Jani Järvinen For Dynamic Data Driven Applications Beyond the Web Browser (~772 Kb) http://community.borland.com/article/images/27140/creating_wap.pdf * Using XML and XSLT with Delphi 5 and WebBroker - by Vincent Parrett This article is aimed at Delphi developers who wish to make use of XML/XSLT in their WebBroker applications. I'll present some WebBroker extensions/components which make it easier to create XSLT based WebBroker applications. http://community.borland.com/article/0,1410,27106,00.html * Delphi Database Programming Course - by Zarko Gajic Free online database programming course for beginner Delphi developers. Focus on ADO techniques. Chapter 5 ("Behind data in datasets") has been added recently. http://delphi.about.com/compute/delphi/library/weekly/aa010101a.htm * Spell Checking with MS Word - by Zarko Gajic Add spell checking and thesaurus capabilities to your Delphi application using automation with the MS Word Object Library. http://delphi.about.com/compute/delphi/library/weekly/aa032701a.htm ________________________________________________________________________ 7. DELPHI RESOURCES * Delphi Frequently Asked Questions http://community.borland.com/downloads/ti-faq/delphi-faq.zip (~909K) * Delphi Technical Information Docs http://community.borland.com/downloads/ti-faq/delphi-ti.zip (~886K) ________________________________________________________________________ YOU CAN HELP US We need your help to keep this newsletter going and growing. You can help by referring the newsletter to your colleagues: http://www.latiumsoftware.com/en/pascal/delphi-newsletter.php Or you can help by voting for us in some or all of these rankings to give more visibility to our web site and thus increase the number of subscriptions to this newsletter: http://www.sandbrooksoftware.com/cgi-bin/TopSite2/rankem.cgi?id=latium http://news.optimax.com/delphi/links/links.exe/click?id=70C517ECAE6E http://www.programmingpages.com/?r=latiumsoftwarecomenpascal http://www.top219.org/cgi-bin/vote.cgi?delphi&83 http://top100borland.com/in.php?who=20 http://top200.jazarsoft.com/delphi/rank.php3?id=latium http://213.65.224.200/cgi-bin/toplist.cgi/hits?Id=80 It's just a few seconds for you that REALLY mean a lot to us. ________________________________________________________________________ If you haven't received the full source code examples for this issue, you can get them from http://www.latiumsoftware.com/download/p0020.zip ________________________________________________________________________ This newsletter is provided "AS IS" without warranty of any kind. Its use implies the acceptance of our licensing terms and disclaimer of warranty you can read at http://www.latiumsoftware.com/en/legal.php where you will also find a note about legal trademarks. Articles are copyright of their respective authors and they are reproduced here with their permission. You can redistribute this newsletter as long as you do it in full (including copyright notices), without changes, and gratis. ________________________________________________________________________ Main page: http://www.latiumsoftware.com/en/pascal/delphi-newsletter.php Group home page: http://groups.yahoo.com/group/pascal-newsletter/ Subscribe/join: pascal-newsletter-subscribe@yahoogroups.com Unsubscribe/leave: pascal-newsletter-unsubscribe@yahoogroups.com Problems with your subscription? eds2004 @ latiumsoftware.com ________________________________________________________________________ Latium Software http://www.latiumsoftware.com/en/index.php Copyright (c) 2001 by Ernesto De Spirito. All rights reserved. ________________________________________________________________________ |
The full source code examples of this issue are available for download.
![]() |
Errors? Omissions? Comments? Please contact us!






