Pascal Newsletter #48
The full source code examples of this issue are available for download.
![]() |
![]() |
Pascal Newsletter #48 - 08-SEP-2003 Contents 1. A few words from the editor 2. HTML Dialog Boxes Using the API ShowHTMLDialog function in the MSHTML.dll 3. Replacing the TStringGrid's standard InplaceEditor How to modify a TStringGrid to have a picklist or an ellipsis editor button in the selected cell 4. Using Delphi's Shell Controls 5. Inline Assembler in Delphi (X) - Playing sounds with the PC speaker 6. Forums / mailing lists 7. Delphi on the Net - Components, Libraries and Utilities · Shareware/Commercial · Freeware · Delphi and Borland products updates - Articles, Tips and Tricks · White Papers / Case Studies - Tutorials and training - Other links - News ________________________________________________________________________ 1. A few words from the editor It's been almost four months since the last issue, but now I'm happy to announce the newsletter is back! Thanks for the words of appreciation and encouragement I've received from the subscribers. It's nice to know the newsletter doesn't go unnoticed. As usual, I'd like to start by thanking the authors who contributed articles for this issue: Wes Turner, Werner Palmer and Dave Murray, and I'm pleased to give the prizes for this issue to: * Wes Turner ("HTML Dialog Boxes") · SMImport v1.75 - by Scalabium Software ($30 standard, $50 with source) Native VCL suite for importing data into a dataset without external libraries. Supports import from: Access (using DAO/MS Jet), Excel (without OLE/DDE), Lotus 123, QuattroPro, text, HTML, XML including TClientDataset format, Paradox, dBase and any TDataSet descendant. New in v1.75: visual Expression Builder; import from Word; direct import for dBase, no BDE required; load BLOB fields for XML; extended style for wizard dialog; OnCreateStructure event that allows creation of a dataset with parsed columns before real import; and more. http://www.scalabium.com/ * Werner Palmer ("Replacing the TStringGrid's standard InplaceEditor") · EurekaLog v4.1.1 - by Fabio Dell'Aria (Std $24, Pro $49, Ent $99) EurekaLog gives your application (GUI, Console, Web, etc.) the ability to catch every exception, generate a detailed log (with unit, class, method and line #) and send it via email. Fully integrated into the IDE, you only need a single rebuild to add EurekaLog to your apps. Does not decrease performance and increases compiled file size by just 0.5% - 4%. Compatible with Delphi 3 - 7 and all Windows platforms. http://www.eurekalog.com/bannerclick.php?id=15 For the next issue, we have available the following prizes for two of our contributors: * NTTools 7 For Delphi - by i-tivity (US$ 49.95) Stop battling the Windows NT Security API! Get your copy of NTTools 7 for Delphi 4/5/6/7 now and save countless hours with this collection of 40 VCL components written specifically to deal with the Windows NT Security functions. Full source code is included. http://www.i-tivity.biz/nttools.htm * LMD SearchPack 2.0 - by LMD Innovative (EUR 39) LMD SearchPack includes 3 controls for integrating advanced text search capabilities into your projects including support of AND, OR, NEAR and NOT operators. Full source code and extensive demo projects included. http://www.ceberus.com/lmd/products/index.php3#P6 The unit HighResTimer.pas published in the last issue as part of the article "High Accuracy Timings/Timer" -by Michael Darling- has been fixed so it works under Delphi 6 and Delphi 7 (and hopefully Delphi 8 eventually). Thanks to Francisco Arena for letting us note about the conditional compilation problem. The updated issue can be downloaded from http://www.latiumsoftware.com/download/p0047.zip By the way, there's been an update to the article "Base64 (MIME) Encode and Decode" -by Daniel Wischnewski- published in the Pascal Newsletter #40. Thanks to the author for the revision. The updated issue can be downloaded from http://www.latiumsoftware.com/download/p0040.zip I'd like to congratulate EC Software for its product Help & Manual (a help authoring utility), which was chosen as Product Of The Year in the Delphi Informant Magazine Readers Choice Awards 2003, apart from blasting the Help-authoring Package category obtaining 51% of the votes! http://www.delphizine.com/opinion/2003/09/di200309jc_o/di200309jc_o.asp Keynote users can find the past 6 issues of this newsletter in a Keynote file compiled by Jayan Chandrasekhar: http://www.tranglos.com/free/files/kn_latium_delphi_newsletter.zip About Keynote (freeware): http://www.tranglos.com/free/keynote.html Well, this is it for now. I hope you enjoy this issue. Regards, Ernesto De Spirito eds2004 @ latiumsoftware.com __________________ Collaborated in this issue: Dave Murray ________________________________________________________________________ Help & Manual 3, by EC Software - Shareware ($ 279) - Help & Manual is a WYSIWYG help authoring tool that will aid you in creating standard WinHelp files (.HLP), Adobe PDF files, HTML pages and the new HTML HELP (.CHM) files introduced in Windows 98, as well as other file formats and printed documentation, everything from a single source. This is a must- have for any software developer. http://www.helpandmanual.com/hmpage.htm ________________________________________________________________________ 2. HTML Dialog Boxes Using the API ShowHTMLDialog function in the MSHTML.dll By Wes Turner <splitdfile @ yahoo.com> Where is the ShowHTMLDialog function? In a .pas unit? ===================================================== No. The ShowHTMLDialog() function is in the MSHTML.dll library, and you will need to use hLib := LoadLibrary('MSHTML.DLL'); to access this DLL, and then use ShowHTMLDialog := GetProcAddress(hLib, 'ShowHTMLDialog'); to get the address for this function. You can use this function only if Internet Explorer version 4 and above is installed. What does an HTML Dialog Box look like? ======================================= When ShowHTMLDialog is used, Internet Explorer shows an IE Browser window with only a dialog type Title bar (no menu or tool bars, or status). This browser window will read the HTML in a file, and display it like a browser window. If you need user input (buttons, edit, radio buttons), you will use JScript or VBScript as the code language for functions to read or change these inputs. What code is needed to use the HTML Dialog? =========================================== Since the HTML Dialog is an Internet Explorer browser window, COM is used to communicate between your program and IE, with variants, IMoniker and IHTMLDialog interfaces. And the ShowHTMLDialog function will implement these interfaces for you. The ShowHTMLDialog function is defined below: function ShowHTMLDialog( hwndParent: Cardinal; // parent's handle UrlMnk: IMoniker; // IMoniker which has the HTML source file PvarArgIn: PVariantArg; // Variant address that contains PWChar sent // to dialog PWCHOptions: PWChar; // pointer to WideChar with Dialog Options PvarArgOut: PVariantArg // Variant address receives the data placed // in IHTMLDialog::returnValue ): HRESULT; // function Result is an OLE HRESULT (Integer) Parameters hwndParent - Handle to the parent of the dialog box, can be zero. UrlMnk - An IMoniker interface containing the URL from which the HTML file for the dialog box is loaded, file can be in app's resources. PvarArgIn - Pointer to a VariantArg record that contains the data sent to the dialog box. The data passed in this VariantArg is placed in the dialog window object's IHTMLDialog::dialogArguments property. This is mostly set as a VT_BSTR, with a PWChar for text the dialog will use for display. This parameter can be set as an empty VariantArg (VT_EMPTY). PWCHOptions - Window options for the dialog box. This parameter can be NIL or the address of a PWChar that contains a combination of values, each separated by a semicolon (;). POptions := 'dialogHeight:13;dialogWidth:21;resizable:no;help:no;' + 'center:yes' PvarArgOut - Pointer to a VariantArg record that contains the data sent from the dialog box when it closes. This VariantArg gets the data that was placed in the dialog window object's IHTMLDialog::returnValue property. This parameter can be an empty VariantArg. Result Value - Returns S_OK if successful, or an error value. The second parameter in ShowHTMLDialog is an IMoniker type. In order to place data into an IMoniker, you would use the CreateURLMoniker function in the UrlMon.pas, defined below: function CreateURLMoniker( MkCtx: IMoniker; // moniker to use as the base context, can be NIL szURL: PWChar; // contains the text of URL to be parsed out mk: IMoniker // moniker with the new URL created from MkCtx and // szURL. ): HResult; // function Result is an OLE HRESULT (Integer) This URL string (szURL) needs to be prefixed with "file://" to signify a disk file location, or with "res://" to signify a program's resource location, and in the case of a resource it should be followed by the path and file name, and a "/#" preceding the resource number, like this for file: UrlStr := 'file://C:\Program Files\HtmlDlg1.htm'; or UrlStr := 'file://' + ExtractFilePath(ParamStr(0)) + 'HtmlDlg1.htm'; and like this for a resource: UrlStr := 'res://MyProgram.exe/#101'; or UrlStr := 'res://' + ExtractFileName(ParamStr(0)) + '/#101'; ====> the #101 is defined in your resource creation .rc file The third and fifth parameters in ShowHTMLDialog are of PVariantArg type, that is, a Variant that Delphi does not automatically "decode" for you, so you will need to read or set the variant data type .vt (VarArgs.vt) yourself and then use that data "Type" when using the data in the Variant. Sample button click code for HTML dialog ======================================== Here is a button click that will show an HTML dialog box. I do not check for Internet Explorer version, since this does not use DHTML or COM objects that are only in higher versions (5, 6, 7 , 8) of IE. This uses an HTML file on disk (HtmlDlg1.htm) in the application's folder. A text string (VarArgs.bstrVal) is sent to the dialog with the dialog title, an information text string, and text items to put in the combo box. The code for the HtmlDlg1.htm web page is below this button click code. uses ActiveX, ComObj, UrlMon; procedure TForm1.button_FileHtmlDlgClick(Sender: TObject); type TShowHTMLDialog = function(hwndParent: Cardinal; UrlMnk: IMoniker; PvarArgIn: PVariantArg; PWCHOptions: PWChar; PvarArgOut: PVariantArg): HRESULT; stdcall; var hLib2: Integer; ShowHTMLDialog: TShowHTMLDialog; URLMoniker: IMoniker; VarArgs, VarReturn: TVariantArg; ArugStr, UrlStr, Return: String; POptions: PWChar; begin Return := 'ERROR, IE version is Below 4 or does not support HTML ' + 'dialogs'; hLib2 := LoadLibrary('MSHTML.DLL'); if hLib2 <> 0 then try ShowHTMLDialog := GetProcAddress(hLib2, 'ShowHTMLDialog'); if Assigned(ShowHTMLDialog) then begin // The PvarArgIn is used to Pass Data To the HTML Dialog. // The VarArgs Variant will be used here as a PWChar, with the // ^ being used as a Delimiter for the seven sub Strings, that // are sent to the Dialog ArugStr := 'HTML Dialog Top Title^This is Information text ' + 'passed to the Dialog<br>Type your Name Below^' + 'Small^Medium^Large^My Size^One size fits all'; // The first sub string is the dialog Title, the next substring // is the text (and HTML) that will be written to the html with // JScript document.write(ArgArray[1]) , notice that I have // HTML tags in this Text, this allows you to customize the // dialog from your programs data, all of the sub strings that // follow are placed in the Combo Box VarArgs.vt := VT_BSTR; VarArgs.bstrVal := StringToOleStr(ArugStr); // the UrlStr is prefixed with the file:// to signify a disk // file, use res:// to signify a resource} UrlStr := 'file://'+ExtractFilePath(ParamStr(0))+'HtmlDlg1.htm'; // the URLMoniker is set to the URL of the source of the htm // file used for the dialog box, it can be a disk file, a // program resource, or an Internet file address, if the html // file is not found, a blank dialog box is displayed OLECheck(CreateURLMoniker(nil, StringToOleStr(UrlStr), URLMoniker)); POptions := 'dialogHeight:17;dialogWidth:23;resizable:no;' + 'help:no;center:yes'; // POptions can be omitted (set to nil), but it allows you to // set some options of the dialog, like width and height VariantInit(OleVariant(VarReturn)); // VariantInit sets the VarReturn.vt to VT_EMPTY if ShowHTMLDialog(Handle, URLMoniker, @VarArgs, POptions, @VarReturn) = S_OK then begin // The JScript window.returnValue will automatically set the // VarReturn.vt to the data Type that is assigned to it, I only // use 2 data types for the window.returnValue , a JScript // text string (VT_BSTR - OLE wide string) and an integer // (VT_I4) , so any other variant data type will indicate an // Error if VarReturn.vt = VT_BSTR then begin Return := VarReturn.bstrVal; // I use a ^ to delimit the VarReturn.bstrVal, but the // first Char is the Radio Box number, which is below 9, so // I do not delimit it, since it will always be a single // Char Return[1]} Return := 'OK was Clicked'#10'Radio was '+Return[1]+#10 + 'Combo1 was '+Copy(Return,2,Pos('^',Return)-2) + #10'Edit Text was ' + Copy(Return,Pos('^',Return)+1, 512); end else if VarReturn.vt = VT_I4 then Return := 'OK was NOT clicked'#10'the VarReturn is ' + IntToStr(VarReturn.lVal) else Return := 'Variant Data type is not integer or OLE ' + 'string, ERROR'; end else Return := 'The ShowHTMLDialog FAILED'; end; finally FreeLibrary(hLib2); end; ShowMessage(Return); end; HTML code for the dialog above ============================== Below is the HTML code for the web page "HtmlDlg1.htm", to be displayed in the HTML Dialog box created by the Delphi code above. To get functionality from your dialog box (button press, enter text, combo boxes) you will need to use an HTML script language. If you don't know HTML or any HTML scripting language (JScript, JavaScript, VBscript), then HTML dialog boxes are not for you. The window.dialogArguments is your access to the data passed to the dialog box. You will usually pass a Wide String or an Integer in your VarArgs parameter to the dialog box. If you want more than one data item in your VarArgs variant, you can use a delimited string and the Split method in ArgArray = window.dialogArguments.split("^"); Split will use it's single parameter as the delimiter character, to divide up the string into an array. The only data this usage gets from the dialog box comes in the VarReturn variant. If you need more than one data item returned, you can again use a delimited string, as I have done here. <html id=dlg1 style="width: 25.9em; height: 22em"> <!-- If you DO NOT use the PWCHOptions in the ShowHTMLDialog, you can put dialog window's width and height above --> <head> <title>HTML Dialog Test</title> <script language="JScript"> var RBnum = 0; var ArgArray = new Array(); // get the dialog arguments into an array with .split and the // delimiter ArgArray = window.dialogArguments.split("^"); // the ArgArray check below is not necessary, but allows you to have a // Default dialog box with an empty PvarArgIn from ShowHTMLDialog if (ArgArray.length == 0) {ArgArray[0] = "Dialog Title";} if (ArgArray.length == 1) {ArgArray[1] = "No <b>Info</b> Text";} if (ArgArray.length == 2) {ArgArray[2] = "None";} // the first Array string is the Title document.title = ArgArray[0]; // set the default return value window.returnValue = 0; function StartUp() { // clear selections in Combo1 Combo1.options.length = 0; // add the ArgArray strings to the Combo1 selections var index; index = 2; // start with index of 2 because the first 2 strings are title and // info while(index < ArgArray.length) { var tempOption = new Option(ArgArray[index]); Combo1.options[Combo1.options.length] = tempOption; index++; } // set the first Combo1 selection position Combo1.options[0].selected = true; } function OkClick() { // this return value means that the OK button was clicked window.returnValue = RBnum+Combo1.options[Combo1.selectedIndex].text+ "^"+Edit1.value; // since the window.returnValue is a variant, it cant get text or // numbers or objects // The integer RBnum is automatically converted to text // close the dialog window window.close(); } function CancelClick() { // this -1 return value means that the Cancel button was clicked window.returnValue = -1; window.close(); } function RadioClick(num) { RBnum = num; // check and UnCheck the Radios RB1.checked = (num == 0); RB2.checked = (num == 1); RB3.checked = (num == 2); } </script> </head> <body onload="StartUp()" BGCOLOR="#A0E2F2" TEXT="Black"> <center> <font size="5"><b>A HTML Dialog Box</b></font> <!-- I use Fixed Font sizes because IE may have it's default font size as large or small, throwing off your sizing, but you could use style sheet settings to define fonts, colors, borders --> <font size="3"> <br><script language="JScript"> // a very useful operation - document.write( ) // the second array string is the INFO text written here document.write(ArgArray[1]) </script> <br><input type=text name="Edit1" value="No Name" size="24" title="Type your Name Here"><p> <table border="2" cellpadding="8" cellspacing="0"> <tr> <td><font size="3"><input type=radio name="RB1" checked=1 onClick="RadioClick(0)">Howdy<br> <input type=radio name="RB2" onClick="RadioClick(1)">Late<br> <input type=radio name="RB3" onClick="RadioClick(2)">Goomba</font> </td> <td><font size="3">Pick your Size - <select name="Combo1"></select></font> </td> </tr> </table> <P><input type=button value="OK" id="OkBut" onClick="OkClick()" title="Click to use the Entries above"> <input type=button value="Cancel" id="CancelBut" onClick="CancelClick()"> </font> </center> </body> </html> There are seven sub-strings in the VarArgs of the ShowHTMLDialog parameter, the first string is used as the Dialog Title. The second as the "info" text written to the HTML page with JScript. And all of the remaining sub-strings are added to the combo box. For more advanced HTML dialog boxes it is also possible to set up an IDispatch link between the dialog box and your program, so the dialog box could call code in in your Delphi program through IDispatch. Using a resource for the HTML file source ========================================= You can use the same code above for a program resource HTML file, except you must change the UrlStr to UrlStr := 'res://' + ExtractFileName(ParamStr(0)+'/#101'); OLECheck(CreateURLMoniker(nil, StringToOleStr(UrlStr), URLMoniker)); and add a resource to your program where you will need to define the HTML file as number 23 and define the call for that resource as a number, like this for HtmDlg.rc: #define RT_HTML 23 #define Dlg1 101 Dlg1 RT_HTML "HtmlDlg1.htm" You will need to define the RT_HTML as the number 23 (you could use any other designation beside RT_HTML, but that's the MS name), and then give your HTML files a number definition like 101. If you have a web browser or other web page display in your program, you may consider using HTML dialogs. __________________ Visit the author's web site if you want to learn how to code programs in API without the Forms Unit: http://www.angelfire.com/hi5/delphizeus/ You'll find many example programs for basic Windows programming. ________________________________________________________________________ Delphi-PRAXiS is a community for German speaking (and writing) programmers using Borland Delphi. We are not just (one of) the fastest growing German Delphi-forums, we also offer some unique services like our "Delphi-PRAXiS Expert", which is an add-on for your Delphi IDE allowing accessing to our libraries directly from within your development environment. We have a special section called our "code library" where you can find several tips, tricks and snippets ready to use. Furthermore, our database contains more than 50,000 articles for searches of any kind. Based on the common software phpBB we still improve it's usability to fit your needs in the best way possible. We want to be a free communication-platform for everyone who needs help and/or wants to help. Of course, you may post your questions also in English. ;-) All this is bundled with a charming, modern and unique design. Register for free and give us a try at http://www.delphipraxis.net ! Now! ;-) ________________________________________________________________________ 3. Replacing the TStringGrid's standard InplaceEditor How to modify a TStringGrid to have a picklist or an ellipsis editor button in the selected cell By Werner Palmer <werner.pamler @ infineon.com> The TStringGrid is a widely used Delphi component. It is possible to enter text directly into the grid cells, but it is sometimes desirable to use alternative inplace editors, such as a combobox to select from a picklist of values, or a user dialog called by clicking on an ellipsis button in the corresponding grid cell. While this is a standard behavior for a TDBGrid, it is not available for the non-data aware TStringGrid. Some solutions can be found all over the web, but the basic functionality, however, has been implemented already in the ancestor of any grid, TCustomGrid. I'm working with Delphi 6, and this may not be true for older versions. The corresponding inplace editor which has all the features mentioned can be found in the Grids unit as TInplaceEditList. It can be accessed by deriving a new component from TStringGrid, which will be named TNewStringGrid here. In this new component, the method "CreateEditor" is overridden to use the TInplaceEditList as inplace editor (instead of the standard TInplaceEdit). The new StringGrid also inherits the method "GetEditStyle" which decides which cells will use the new inplace editor. In the implementation of TNewStringGrid, we create a new event "OnGetEditStyle" which calls the GetEditStyle method. The event handler receives the cell coordinates and returns the editor style (esSimple, esPickList or esEllipsis, as defined in Grids.pas). Additionally for the esPicklist editor style, we have to write an event handler for the "OnGetPickListItems" event to pass the pick list (a TStringList) to the new string grid. For the esEllipsis editor style, we need an event handler for the event "OnEditButtonClicked" which is fired when the user clicks on the new ellipsis button; this event handler for example could open a complex dialog querying user input and should fill the cell with the corresponding text entered. Don't forget to activate the goEditing option of the StringGrid; otherwise you won't be able to edit the grid data. The NewStringGrid unit and a demo project can be found attached. ________________________________________________________________________ Outlook Express Data Backup 2.0 - EXCLUSIVE RIGHTS FOR SALE at $990 OE Data Backup is a backup and synchronization tool for the Outlook Express mail client. It allows you to backup and restore your messages (including attachments), address book, mail and news accounts, settings, message rules, lists of blocked senders, signatures and Internet favorites. You can backup data on one computer and restore to another. For more information, visit this page: http://users.volja.net/bzibrat/ ________________________________________________________________________ 4. Using Delphi's Shell Controls By Dave Murray <irongut @ vodafone.net> From Delphi 6 onwards, Borland provides shell controls including TShellTreeView and TShellListView that mimic the functionality of Windows Explorer but they are tucked away on the Samples page of the palette, have no documentation and even their source can be hard to find; its in Delphi\Demos\ShellControls. You could be forgiven for thinking they are an afterthought that you're not expected to use. Recently, I wanted to build my own FTP client because I don't like any of the free ones I've tried and I thought 'I've got Indy' so how hard can it be? I checked out the demo for TIdFTP, the Indy FTP client component, and the networking end looked pretty easy so I started to think about design. I wanted something simple and decided on a view of the local file system above a view of the remote file system with the main toolbar in-between. Each view would contain a TreeView and a ListView with a few buttons for simple, Explorer-like navigation. I also wanted drag and drop between controls and with Explorer. At this point I went looking for components to implement the local side and discovered Borland's shell controls. I decided that this kind of layout is something that I could reuse so I started working on a generic frame. So how do they work? Well some functionality is easy to implement but in other ways these controls can be awkward and confusing. Most of the methods you'd expect to find either don't exist or return parameters that are of dubious value. Often they are the wrong type for other calls you want to make. What should have been a couple of hours of easy programming rapidly turned into several nights of reading source code, experimentation and hair pulling. At some point during this process I decided to turn it into an article so I could share my pain with you. ;) Let's start with the easy stuff. I connected my TShellTreeView to a TShellListView and then started on a toolbar. The first button I wanted was one to move up the directory tree and after a bit of looking I realised that the TShellListView.Back method would do this for me. Most of the other buttons I wanted were more difficult so I'll come back to them but a Views button for the TShellListView was easy. I just created a popup menu for my button that sets TShellListView.ViewStyles. At this point I had a simple file manager that provides the standard Explorer context menu and basic navigation features. I considered adding a TShellComboBox above the file list. I wanted it to resize with the frame like the other controls but it doesn't have an Align property. I tried using Anchors but could not get the effect I wanted so I scrapped that idea. Now on to the more complicated stuff. The shell controls don't provide methods to help us manipulate files so we need to use the Windows API. The SHFileOperation() function can perform Copy, Move, Delete and Rename operations so I wrote the following wrapper to make it easier to use. function TconExplorerFrame.FileOperation(const source, dest : string; op, flags : Integer) : boolean; // perform Copy, Move, Delete, Rename on files + folders via WinAPI var Structure : TSHFileOpStruct; src, dst : string; OpResult : integer; begin // setup file op structure FillChar(Structure, SizeOf (Structure), #0); src := source + #0#0; dst := dest + #0#0; Structure.Wnd := 0; Structure.wFunc := op; Structure.pFrom := PChar(src); Structure.pTo := PChar(dst); Structure.fFlags := flags; case op of // set title for simple progress dialog FO_COPY : Structure.lpszProgressTitle := 'Copying...'; FO_DELETE : Structure.lpszProgressTitle := 'Deleting...'; FO_MOVE : Structure.lpszProgressTitle := 'Moving...'; FO_RENAME : Structure.lpszProgressTitle := 'Renaming...'; end; // case op of.. OpResult := 1; try // perform operation OpResult := SHFileOperation(Structure); finally // report success / failure result := (OpResult = 0); end; // try..finally.. end; // function TconExplorerFrame.FileOperation This function returns true if the operation is a success and displays a progress dialog if necessary. Look-up SHFILEOPSTRUCT in the WinAPI help to see the possible values of op and flags. I still can't decide if I'll need to access this function from outside my frame so for the moment it is a private method but I may change this in the future. A Delete button was now simple, all I had to do was determine which file or folder is selected and delete it using FileOperation(). While doing a Refresh button I decided to write a generic function that could be called from other methods and would refresh both controls. TShellTreeView.Refresh takes a node as a parameter, but which node to pass? I tried passing the current folder but that didn't always work (this also seems to be a problem in Explorer). Then I tried passing the root node and this works properly. TShellListView flickers when we refresh a TShellTreeView it is connected to so I detach them first. See the procedure TconExplorerFrame.Refresh in the source. When creating a new folder we need to give it a unique name. The usual way to do this is to call it 'New Folder' and add a number to the name if that folder already exists. I wrote a GetNewFolderName() function that would return the unique name I needed using the DirectoryExists() function from SysUtils.pas and a while loop. My Create Folder button calls this function and then uses CreateDir() from SysUtils.pas. I wanted to provide a Properties button but the shell controls don't have any useful methods. Since pressing Alt+Enter in a TShellListView works I dived into ShellCtrls.pas and checked out the source. Initially it looked simple, all you need to do is call DoContextMenuVerb. Or not, because DoContextMenuVerb is not a method of TShellListView but is a procedure private to ShellCtrls.pas. At this stage I decided plagiarism was the easiest course and copied it into my frame unit. Double-clicking files in TShellListView doesn't work (in Win2k at least) but choosing Open from the context menu does. Checking the source it does have a DblClick method that calls ShellExecute(). At this point I noticed TShellFolder.ExecuteDefault. Since a TShellFolder can be a file or a folder and we can get the selected item as a TShellFolder by calling TShellListView.SelectedFolder writing an OnDblClick event method was easy. This also ensures that double-click doesn't just try to open the file but performs the default action from its context menu which is what Explorer does. See TconExplorerFrame.shlllstvwFilesDblClick. At this point I had everything I wanted except Drag and Drop. I'd never done Drag and Drop before so I had to do some reading before I started. Ideally I would like to be able to change the cursor if the user presses Ctrl, like Explorer does. This means using a TDragControlObject to supply a drag image list so I decided to keep things simple for now and leave that effect out. I started with dragging from my TShellListView to my TShellTreeView. The methods and properties necessary (with the right return types) don't seem to exist until you realise the SelectedFolder property can return files as well as folders. I wrote an OnDragOver event for the TShellTreeView so that it would accept items from the TShellListView and started on its OnDragDrop event. I quickly found I couldn't access the file being dragged from this event so decided to store it in a variable global to my frame during TShellListView.OnStartDrag and then clear it in TShellListView.OnEndDrag. I had trouble with the target folder too, TTShellTreeView.GetNodeAt and TTShellTreeView.DropTarget return a TTreeNode but to get the path for a file operation I wanted a TShellFolder so I Select the DropTarget to retrieve the SelectedFolder (a TShellFolder) and then Select the previous folder again. This makes the TShellListView flicker horribly (you can actually see it change dir) so I tried using TShellListView.Items.BeginUpdate and EndUpdate but this didn't work so I had to detach it from its TShellTreeView, perform the select operations and then re-attach it. This is nasty and I don't like it but it works. The OnDragDrop event doesn't provide any information about the keyboard and I want a Copy operation if the user is pressing Ctrl at the end of the drag. I used the GetKeyState() function from the Jedi Code Library (JCLSysInfo.pas) for this. Having got drag working from my TShellListView I changed my OnDragOver and OnDragDrop events to also accept a folder dragged from my TShellTreeView and added OnStartDrag and OnEndDrag events to it. These six events provide all the features required for dropping a file on the TShellTreeView from within the frame. To keep it simple I only allow the user to select and drag one item at a time. Explorer allows you to drag a folder from the tree to the file list and to drag files to folders within the list. But dragging a folder from TShellTreeView selects and displays that folder and in either case TShellListView.DropTarget always returns nil! Because of this I couldn't find any way to implement these features. :( Having done what I could to provide Drag and Drop within my frame I now wanted to make it work with Explorer. To accept a file dropped from Explorer we use Windows messages and I was unsure if this would effect my Drag and Drop events but I was pleased to find that it didn't. I did have a few problems getting it properly setup though. We need to call DragAcceptFiles() with the handle of the control that will accept files to let Windows know to send it the drop files message but TFrame doesn't have an OnCreate event and we can't refer to its components or itself in an initialization section. I had wanted my frame to be fully encapsulated but I had to settle for calling DragAcceptFiles() in the OnCreate event of the form that contains it. Initially I wanted to pass the handle to my TShellListView so that files could only be dropped there but that would need a WMDROPFILES message for the TShellListView so I ended up accepting files anywhere on the frame by passing its handle. Once I got round these problems the rest was easy. The procedure TconExplorerFrame.WMDROPFILES handles the drop message. It uses DragQueryFile() from the WinAPI to determine the number of items being dropped and then uses it again to get an item's full path as it iterates through the list. Windows automatically provides us with a Copy cursor and pressing Ctrl or Shift doesn't effect it so I copy the items to the folder currently displayed in my TShellListView. I had also wanted to be able to drag files to Explorer or other instances of my test program but I've been unable to find any articles or tips that explain how to do it. I had hoped that enabling drag from Explorer might have given me one of these features as a side-effect or helped me work out how to do them but it didn't. I think I need to create my own descendant of TCustomShellListView that is drag enabled with the shell but I'm unsure where to begin. So that's the end of my exploration of Borland's shell controls. If anyone knows how to drag from Delphi to other applications or can suggest other improvements to my frame please contact me. The source for my frame and test program are in the attached archive, feel free to use it in your own programs. ________________________________________________________________________ When was the last time you voted for the Pascal Newsletter? Please support this initiative voting for us in The Programming Top 100! http://www.sandbrooksoftware.com/cgi-bin/TopSite2/rankem.cgi?id=latium ________________________________________________________________________ Vote for the Pascal Newsletter in The Programming Pages! http://www.programmingpages.com/topsite.asp?r=latium&Language=29 ________________________________________________________________________ 5. Inline Assembler in Delphi (X) - Playing sounds with the PC speaker The IN and OUT assembler instructions allow us to read from and write to an I/O port respectively. To read from a port: in accumulator, port IN reads a byte, word or doubleword from the specified port into the accumulator register, i.e. AL, AX, or EAX for a byte, word or doubleword port respectively. The port number can be a byte constant (0..255) or the DX register (to have access to all I/O ports). To write to a port: out port, accumulator OUT writes the byte, word or doubleword in the accumulator register to the specified port. Again, the port number can be a byte constant or the DX register. Here we'll see an example of the use of assembler for reading and writing to I/O ports to program the 8253/8254 Counter/Timer and the 8255 Programmable Peripheral Interface (PPI) chips on the motherboard in order to make the built-in PC speaker play a tone. The steps to play a tone using those chips are the following: 1) Prepare the 8253/8254 to receive the frequency. This is done by writing the value $B6 to the Timer Control Register (port $43). 2) Write the frequency of the sound to the 8253/8254's Frequency Register (port $42). Actually, it's not the frequency in Hertz that we should write to the register, but the result of 1331000 divided into that frequency. First we should write the low order byte of the result, and then the high order byte. 3) Turn the speaker on and make it use the 8253/8254 Counter/Timer. This is done by turning on the first two bits of Port B of the 8255 PPI (port $61). 4) Turn the speaker off when the sound should stop. This is done by turning off the second bit of Port B of the 8255 PPI (port $61). The following inline assembler function implements the steps listed above: procedure SpeakerSound(Frequency: word; Duration: longint); // Copyright (c) 2003 Ernesto De Spirito // Visit: http://www.latiumsoftware.com // Plays a tone thru the PC speaker using the 8253/8254 // Counter/Timer chip and the 8255 Programmable Peripheral // Interface (PPI) chip on the motherboard. // NOTE: This code won't work under Windows NT/2000/XP. asm push edx // Push Duration on the stack (for Sleep) mov cx, ax // CX := Frequency; // Prepare the 8253/8254 to receive the frequency data mov al, $B6 // Function: Expect frequency data out $43, al // Write to Timer Control Register // Compute the frequency data mov dx, $14 // DX:AX = $144F38 mov ax, $4F38 // = 1331000 div cx // AX := 1331000 / Frequency; // Send the frequency data to the 8253/8254 Counter/Timer chip out $42, al // Write low byte to the Frequency Address mov al, ah // AL := High byte of AX out $42, al // Write high byte to the Frequency Address // Tell the 8255 PPI to start the sound in al, $61 // Read Port B of the 8255 PPI or al, $03 // Set bits 0 and 1: // bit 0 --> use the 8253/8254 // bit 1 --> turn speaker on out $61, al // Write to Port B of the 8255 PPI // Wait call Sleep // Sleep(Duration); // requires Windows unit // Tell the 8255 PPI to stop the sound in al, $61 // Read Port B of the 8255 PPI and al, NOT 2 // Clear bit 1 (turn speaker off) out $61, al // Write to Port B of the 8255 PPI end; Sample call: procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin Randomize; for i := 1 to 3 do SpeakerSound(Random(900)+100, 200); end; NOTES: * Since IN and OUT imply direct access to the hardware, and given that Windows NT/2000/XP don't allow that for user applications, then those instructions won't work (will generate an exception) under these operating systems (unless running in protected mode at ring 0, also known as kernel mode). Anyway, under these operating systems the Beep API function accepts two arguments ignored under Windows 95/98/Me: frequency in hertz and duration in milliseconds. The only catch is that this function is synchronous, while the code I introduced above is susceptible to be modified to play sounds asynchronously. * Using the PC speaker to make sounds is OBSELETE. Applications should use MIDI or WAVE sounds instead. ________________________________________________________________________ Delphi BUGS? Catch & Log every BUG showing Unit, Class, Method, Line #. Now with support for command-line compiler and IntraWeb applications. http://www.eurekalog.com/bannerclick.php?id=15 ________________________________________________________________________ 6. Forums / mailing lists To join any of our forums, the best way is to subscribe from the web, since that way you'll be able to access the features available at the web site (like changing your subscription options, viewing the past messages, accessing the files section, etc.). A Yahoo! ID is required for that, and you can get yours free by registering as a Yahoo! user, but if you don't want to register or if you don't have full Internet access, you can also subscribe by email (you'll only have email access). * Delphi (intermediate level): If you know a lot about Delphi but you are still far (or not so far) from being a guru, then this forum is for you. This is the only forum for intermediate-level Delphi programmers on the Web... Delphi experts are also welcome! :-) http://groups.yahoo.com/group/delphi-en/ Subscription: http://groups.yahoo.com/group/delphi-en/join delphi-en-subscribe@yahoogroups.com * Delphi (all levels): A Delphi group open to all levels. http://groups.yahoo.com/group/delphi-all/ Subscription: http://groups.yahoo.com/group/delphi-all/join delphi-all-subscribe@yahoogroups.com * Kylix: Kylix programming. http://groups.yahoo.com/group/KylixGroup/ Subscription: http://groups.yahoo.com/group/KylixGroup/join KylixGroup-subscribe@yahoogroups.com * Components: This is a forum for searching/recommending software components (VCL and CLX components, ActiveX objects, DLL libraries, shared objects, etc.), as well as utilities, tutorials, information, etc. http://groups.yahoo.com/group/components/ Subscription: http://groups.yahoo.com/group/components/join components-subscribe@yahoogroups.com * Software Developers: This is a forum for discussions about software development and to share experience in the work, professional or commercial environments. It is not a programming forum, matters treated here are supposed to be more general or language independent. http://groups.yahoo.com/group/software-developers/ Subscription: http://groups.yahoo.com/group/software-developers/join software-developers-subscribe@yahoogroups.com ________________________________________________________________________ Merlin's Delphi Forge Delphi and Kylix news, FAQ, downloads, links, forums and more. Accepting uploads and submissions. http://www.delphifaq.net/ ________________________________________________________________________ 7. Delphi on the Net By Dave Murray <irongut @ vodafone.net> Components, Libraries and Utilities =================================== Shareware / Commercial ---------------------- * InterBase 7.1 Trial - by Borland http://community.borland.com/article/0,1410,30157,00.html * Trial Version of C#Builder Enterprise Available for Download http://bdn.borland.com/article/0,1410,30278,00.html * Personal Edition of C#Builder 1.0 Available for Download. This edition is limited to free non-commercial development. http://bdn.borland.com/article/0,1410,30203,00.html Freeware -------- * TurboPower OfficePartner v1.64b - by TurboPower (with source) OfficePartner is the easy way to integrate your project with Microsoft Office. With OfficePartner you can access COM services in Office with easy to use VCL components. http://sourceforge.net/projects/tpofficepartner/ * KeyNote v1.6.1 - by Marek Jedlinsky (MPL 1.1 with source) A flexible, multi-featured tabbed notebook based on Windows' standard RichEdit control. It's always accessible with a single keypress, even when working in another application. The basic idea of KeyNote is that you can include many separate notes within a single file. Features include strong data encryption, styles, macros, plugins and templates. Delphi source code available. http://www.tranglos.com/free/keynote.html * DScriptVCL - by DelphiScript (freeware, source code available for $49) Give your applications Winamp's look & feel with DScriptVCL. Includes Main Forms, Menus, Panels, Leds, Numeric Displays, Progress Bars, Buttons, Checkboxes and many more graphical components. http://www.delphiscript.com/dscriptvcl/ * WinAmpDll - by Ivan Spiridonov (with source) A DLL Project that shows how to create WinAmp General Purpose Plugins. http://www.torry.net/vcl/mmedia/other/wagppdll.zip * Keyboard Macro Manager v1.0 - by Daniel Cunningham Delphi IDE Enhancement for saving / restoring keyboard macros. http://www.torry.net/vcl/experts/ide/keymac.zip * TssSimpleIPC v1.0 - by Sunisoft (with source) TssSimpleIPC is a component for Interprocess Communications. http://www.torry.net/vcl/internet/irc/simpleipc.zip * QTest v1.9 - by Michael Johnson (with source) Delphi friendly way to create test cases for test-centric coding, ala extreme programming. Update includes logging capability, more detail, and some expansion of the methods of testing. http://www.bigattichouse.com/qtest.php * QSetup Installation Suite 4.0.0.4 - by Pantaray Research Highly effective and powerful setup program featuring a user-friendly and intuitive user interface designed to let you create high quality sophisticated installation delivery with minimum effort and no script programming. QSetup is FREE for independent software developers. http://www.pantaray.com/ * Delphi.DX - by Tim Baumgarten (with source) DirectX header file conversions for DirectX 7, 8 and 9. http://www.crazyentertainment.net/dx.php?ver=nine * PBPreview v4.50.00.00 - by BakSoft-Denmark (with source) OpenDialog with custom Preview of your files. http://home11.inet.tele.dk/BakSoft/PBPreview.htm * PBPrinter-SetupDialog v6.10.00.00 - by BakSoft-Denmark (with source) Printer Setup dialog with the ability to get/set printer settings at designtime & runtime. http://home11.inet.tele.dk/BakSoft/PBPrinterSetupDialog.htm * TFindFile - by HANAX Software (with source) Very simple component, can be used to searching for specified files in specified directory(ies) and all it's subfolders. http://www.webpark.sk/hanax/files/hanax_findfile.zip Delphi and Borland Product Updates ---------------------------------- * DbExpress Driver for IBM DBM v8 for Delphi 7 Users This patch for Delphi 7 is available to registered users. http://community.borland.com/article/0,1410,30320,00.html * Fixes for Kylix 3 Issues on Newer Distros (updated) - Andrés Colubri Kylix 3 (particularly C++) on newer Linux distros (eg. RedHat 8+, Madrake 9+, SuSE 8.2) has a number of bugs: compilation errors with STL, unresolved references when linking, installer and IDE hangs, etc. This package contains a collection of fixes to address these issues. http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=20136 * First Update Pack for C#Builder Available to Registered Users http://bdn.borland.com/article/0,1410,30287,00.html Articles, Tips and Tricks ========================= * Simple Programming Tip #3 - by Charlie Calvert Learn how refactoring can help you create robust and easy to maintain programs. http://community.borland.com/article/0,1410,30304,00.html * Interview with Nick Hodges - by Clay Shannon Nick Hodges, member of TeamB and the Borland Conference Advisory Board, explains why he prefers WebSnap to 3rd party web app creation solutions, talks about his Super Bowl bet with the interviewer, his unusual method of working, etc. http://community.borland.com/article/0,1410,30040,00.html * Data Access in ADO.NET - by Cary Jensen ADO.NET provides the native data access layer for the .NET framework. This article is the first in a series to look at ADO.NET, and begins a discussion of the data access mechanism. http://community.borland.com/article/0,1410,30113,00.html * Using Visual Form Inheritance with IntraWeb 5.1 in Delphi 7 - by Tjipke A. van der Plaats This article explains a way to be able to use visual form inheritance with IntraWeb (5.1). Something that normally is not working. http://community.borland.com/article/0,1410,30195,00.html * Interview with Marco Cantu - by Clay Shannon Author and trainer Marco Cantu tells us about the 15th century house in which he lives, encourages people to turn off their televisions, praises Stupid White Men (the book, not obtuse caucasians) and, of course, talks about programming. http://community.borland.com/article/0,1410,30052,00.html * Interview with Ray Konopka - by Clay Shannon Ray Konopka talks about the mechanics of the Borland Conference advisory board, his work on Code Site for .NET, the great BorCon pizza thread time slice demonstration, his High School record in Track and Field, and Octane. http://community.borland.com/article/0,1410,30095,00.html * Interview with Cary Jensen - by Clay Shannon Trainer/author/BorCon Advisory Board member Cary Jensen talks about his hair, his books, JBuilder, psychology, .NET data sets and predicts fun surprises at BorCon this coming November in San Jose. http://community.borland.com/article/0,1410,30114,00.html * Data Storage in ADO.NET - by Cary Jensen This article is the second in a series to look at ADO.NET. In this installment we take a look at the ADO.NET data storage classes. http://community.borland.com/delphi/0,1419,1,00.html * InterBase 7.1 Trial Technical Specifications - Sriram Balasubramanian Capabilities of the InterBase 7.1 Trial version. http://community.borland.com/article/0,1410,30151,00.html * The Coad Letter 110: Announcing UML 2.0 - by Randy Miller The UML 2.0 Specification has been approved by the OMG. The final editing process is going on and the specification is set to be released to the public by the end of the year. Here is what is new. http://community.borland.com/article/0,1410,30144,00.html * What's New in UML 2? The Use Case Diagram - by Randy Miller This article examines a new element of the use case diagram in UML 2.0 including multiplicities and conditions on "extends" relationships. http://community.borland.com/article/0,1410,30166,00.html * Business Rules - by Randy Miller This article looks at business rules in a modeling and development environment. http://community.borland.com/article/0,1410,30158,00.html * InterBase Community Tools and Solutions - by Aaron Ruddick Third party tools and solutions for InterBase. http://community.borland.com/article/0,1410,30126,00.html * Interview with Steve McConnell - by Clay Shannon Steve McConnell, the author of several important programming books including "Code Complete", "Rapid Development", "Software Project Survival Guide", and "After the Gold Rush" answers questions about his current projects. http://community.borland.com/article/0,1410,29921,00.html * Get Your Delphi Apps off to a Fast Start - by Clay Shannon Explains how and why you should create a template project. This can save you a lot of time whenever you begin a new Delphi project, as the normal "setup work" you do will already be done - setting properties, adding forms and units, etc. http://community.borland.com/article/0,1410,29907,00.html * Interview with Lino Tadros - by Clay Shannon Lino Tadros talks about creating the first ActiveX control ever written with Delphi, a practical joke he played on some of his employees, why he eschews the newsgroups lately, who he impersonates, and the new magazine he is writing for. http://community.borland.com/article/0,1410,30085,00.html * Simple Programming Tip #2 - by Charlie Calvert A discussion of benefits to be derived from using testing tools such as JUnit, DUnit, NUnit or CppUnit. The heart of the argument is that such tools encourage programmers to create highly modular, reusable classes that are easy to maintain. http://community.borland.com/article/0,1410,30049,00.html * Are We Not Geeks? - by Clay Shannon Why is programming the least understood of all professions? There is a conspiracy to defame us! Hollywood and Madison Avenue don't want us to come out from behind our cubicle walls. A tongue-in-cheek take on how programmes are viewed. http://community.borland.com/article/0,1410,29920,00.html * Interview with Chad "Kudzu" Hower - by Clay Shannon Chad "Kudzu" Hower, prime mover behind Indy and IntraWeb, talks about the future of Delphi, what he thinks of .NET, how to bring about world peace, why he rarely reads computer books, and other things. http://community.borland.com/article/0,1410,30038,00.html * Disseminating Your Software - by Clay Shannon The difference between deployment and dissemination of software is discussed, as is the relative merits of hosting your own software or outsourcing that chore. DIY vs. outsourcing is also examined relative to the processing of payments. http://community.borland.com/article/0,1410,29931,00.html * InterBase 7.1 DataType to ADO.NET C# Type mappings - by Borland Developer Support Staff InterBase SQL datatypes and C# Object Type mappings using the InterBase Borland Data Provider (BDP). http://community.borland.com/article/0,1410,30108,00.html * Distributed Information Systems, From A to Z: Part I - Serge Dosyukov This article is a first in a series discussing several aspects of building distributed information systems using Delphi 7 and Indy. http://community.borland.com/article/0,1410,30025,00.html * Interview with Ray Lischner - by Clay Shannon Ray Lischner talks about his books, how he backed into programming, his keyboard deafness, the extent of his multilingualism, C#, his predictions for a post-.NET Borland and what he's working on. http://community.borland.com/article/0,1410,30013,00.html * Life cycle of a Database Application - by Oleg Meeting Analyses a database project's life pattern and concludes some useful recommendations for developers. http://community.borland.com/article/0,1410,28994,00.html * This Old Pipe - by Randall Nagy Few appreciate how much modern computing relies upon pipes and streams. This article reviews how to apply these elegant IPC mechanisms to your console and GUI applications. http://community.borland.com/article/0,1410,29772,00.html * Using XMLBroker with IntraWeb - by Guinther Pauli This article will explain how to use the XMLBroker in a IntraWeb application, caching data and updates in browser. And finally, how to solve this updates to database server. http://community.borland.com/article/0,1410,29860,00.html * Advanced Dynamic Packages - by Vino Rodrigues Topics covered include: Calling Custom Class Methods, Calling Standard Functions and Procedures, Obtaining Package Information and Obtaining Knowledge of Class Names. http://community.borland.com/article/0,1410,29119,00.html * An Introduction To Endo-Testing Using Mock Objects - by Sascha Frick Problems arise when applying unit testing and test driven development principles to complex projects. This article describes how to overcome the problems with endo-testing and mock objects. http://www.thedelphimagazine.com/samples/1677/1677.htm * Creating Custom Windows Event Logs - by Dennis Passmore Explains what is involved in creating custom event logs and why they will come in handy to monitor your applications. http://www.thedelphimagazine.com/samples/1655/1655.htm * Code Reuse Through Interfaces - Rob Collins Code reuse is perhaps more talked about than done, so this article shows how code reuse can be achieved, with aggregated Delphi interfaces. http://www.thedelphimagazine.com/samples/1664/1664.htm * Registering DLL and ActiveX Controls from Code - by Zarko Gajic How to register / unregister OLE controls such as dynamic-link library (DLL) or ActiveX Control (OCX) files from a Delphi application. http://delphi.about.com/library/weekly/aa040803a.htm * Exposing the OnClick Event for a DBGrid - by Zarko Gajic Delphi's DBGrid does not respond to the OnClick event. Here's how to hack a DBGrid and surface the OnClick event - using the so-called "protected hack". http://delphi.about.com/library/weekly/aa083003a.htm * Accessing Protected Members of a Component - by Zarko Gajic Many Delphi components have useful properties and methods that are marked invisible ("protected") to a Delphi developer. In this article you will find the workaround to this problem - thus enabling you to access a DBGrid's RowHeights property, for example. http://delphi.about.com/library/weekly/aa082603a.htm * Accessing protected members of a component - by Zarko Gajic Many Delphi components have useful properties and methods that are marked invisible ("protected") to a Delphi developer. In this article you will find the workaround to this problem - thus enabling you to access a DBGrid's RowHeights property, for example. http://delphi.about.com/library/weekly/mpreviss.htm * CheckBox inside a DBGrid - by Zarko Gajic Here's how to place a check box into a DBGrid. Create visually more attractive user interfaces for editing boolean fields inside a DBGrid. http://delphi.about.com/library/weekly/aa082003a.htm * Adding components to a DBGrid - by Zarko Gajic How to place just about any Delphi control (visual component) into a cell of a DGBrid. Find out how to put a CheckBox, a ComboBox (drop down list box) and even an Image inside the DBGrid. http://delphi.about.com/library/weekly/aa081903a.htm * Computer restrictions with Delphi and Registry - by Zarko Gajic How to enable your applications to make restrictions to what users can (and cannot) do with their computer using Delphi and the Registry. http://delphi.about.com/library/weekly/aa081703a.htm * Implementing PING without using raw sockets - by Serhiy Perevoznyk Implementing Internet pings using Delphi and the Icmp.dll. http://delphi.about.com/library/weekly/aa081503a.htm * A Simple example of Artificial Intelligence using Delphi - R. Dhungel The article explores Delphi approach to AI, using the pebble picking game. A simple game is used to show how computer can learn by correcting mistakes. http://delphi.about.com/library/weekly/aa081003a.htm * DLLs Made Simpler - by Richard Le Mesurier This article is aimed at removing the fear of writing DLLs for beginners. A lot of beginners think DLLs are really complex, when actually they are pretty simple. http://delphi.about.com/library/weekly/aa080803a.htm * Professional Looking Grids with Custom Drawing - by Vegar Vikan Using custom drawing to make your grids look as nice as the expensive third party suites. Three main topics are presented: how to fix-up the column headers, how to add clickable buttons and checkboxes inside cells and how to simulate merged cells. http://delphi.about.com/library/weekly/aa072203a.htm * PDF Managing Tools - by Zarko Gajic Need to create, encrypt or manage PDF files from Delphi? Using the tools and components in this listing you will get powerful control of PDF documents in your applications. http://delphi.about.com/cs/toppicks/tp/aatppdf.htm * Reading and Manipulating XML files - by Zarko Gajic Learn how to read and manipulate XML documents with Delphi using the TXMLDocument component. http://delphi.about.com/library/weekly/aa072903a.htm * Locate, Display and Execute Control Panel Applets - by Zarko Gajic Interested in Delphi code to mimic the Windows Control Panel folder behavior? In this article you can learn how to find CPL files, how to extract description, name and even the applet icon. Even more, learn how to execute applets from your applications. http://delphi.about.com/library/weekly/aa062403a.htm * TComplexMath - by Thomas Bejstam When using Delphi to develop engineering applications, you'll often find that the mathematics support in the development environment is not enough. TComplexMath unit is a way out! Full source code. http://delphi.about.com/library/weekly/aa070103a.htm * Free Source VCL Sets! - by Zarko Gajic Looking for a free source multi-purpose Delphi component collection to add more power to your applications? Look no more, here's a list of the best Delphi component (free with source) sets on the Net! http://delphi.about.com/cs/toppicks/tp/aatpfreevclset.htm * A TreeView of Data - by Anand Gopalakrishnan How to display a dataset of records from a table or query in a treeview component. http://delphi.about.com/library/weekly/aa060603a.htm * Adding Regular Expression Filtering to ShellListView - George Merriman How to add regular expression (filename) filtering to the Delphi file explorer application. http://delphi.about.com/library/weekly/aa052503a.htm * Shell Controls: Delphi's Hidden Gems - by George Merriman How to create a reasonable Delphi facsimile of the Windows Explorer, all without writing a single line of code. http://delphi.about.com/library/weekly/aa052503a.htm * Records in Delphi: Part 1 - by Zarko Gajic Learn about records, Delphi's Pascal data structure that can mix any of Delphi's built in types including any types you have created. http://delphi.about.com/library/weekly/aa062700a.htm * Records in Delphi: Part 2 - by Kevin S. Gallagher Why and when to use variant records and creating an array of records. http://delphi.about.com/library/weekly/aa070803a.htm * TNumEdit - by Michael Klaus TNumEdit is a TEdit descendant that only accepts numerical input. You can adjust whether to accept positive or negative numbers, integers or decimals. You can also limit the input by using MinValue and MaxValue. http://delphi.about.com/library/weekly/aa070603a.htm * About Delphi Programming *Current Headlines* - by Zarko Gajic Put About Delphi Programming *Current Headlines* on your web site for FREE! Get the *Current Headlines* without leaving the Delphi IDE using the free Delphi IDE add-on. http://delphi.about.com/library/blsticker.htm * UML Sequence Diagrams Show Class Collaboration - by Kirk Knoernschild The dynamic aspects of class collaborations can be represented in UML with sequence diagrams. Find out how to use sequence diagrams as a tool in your application development and get a better understanding of object interaction. http://builder.com.com/article.jhtml?id=u00320030814KXK01.htm * Follow these Steps to Secure your Data Layer - by Robert W. McLaws A secure data layer is essential for a truly secure application. Learn how to nurture a secure environment for the pivotal Data tier of your application with the correct tools. http://builder.com.com/article.jhtml?id=u00320030731MCL01.htm * Three Recovery Models for Backing Up your SQL Server - by Ed Martin Backing up SQL Server is a standard practice, but knowing which recovery model to use can be confusing. Use these tips to get started with your backup strategy. http://builder.com.com/article.jhtml?id=u00320030429gcn01.htm * SQL Server: Design for Security from the Start - Harkins + Gunderloy When developing a SQL Server database security must be a priority even during the design process. Prepare a more secure database application by familiarizing yourself with these guidelines before you start your next project. http://builder.com.com/article.jhtml?id=u00320030715ssh01.htm * Use Microsoft JET'S ShowPlan to Write More Efficient Queries - by Susan Sales Harkins and Mike Gunderloy In large databases, an inefficient query can reduce performance to a crawl and incur the ire of users. The ShowPlan feature of Microsoft's Jet engine can help you plan more efficient queries, optimize your database, and increase performance. http://builder.com.com/5100-6388-5064388.html?fromtm=e601 * Secure SQL Server: Installing for Security - by Harkins + Gunderloy Securing SQL Server is vital to the proper design of any database system. Get the lowdown on how to install SQL securely, protect data from prying eyes, and ensure its validity. http://builder.com.com/5100-6388-5054470.html * Basic .Net: Framework Compatibility Issues - by Builder.com Multiple .NET Framework versions means there are more options to consider during implementation. This article looks at compatibility issues between versions 1.0 and 1.1 of the .NET Framework and explore what you can do to reduce versioning problems. http://builder.com.com/5100-6389-5055539.html * Differences Between Jet's ISNULL() and T-SQL's COALESCE() Functions - by Susan Sales Harkins and Doris Manning Null values are handled differently by Access when compared to SQL Server. Get a hands-on explanation of the appropriate null functions for each database and improve your application's reliability. http://builder.com.com/5100-6388-5053997.html * Avoid Security Vulnerabilities in your CGI Programs - Scott Robinson CGI makes creating Web-executable programs quick and easy - both for you and for hackers. Learn about some of the explicit security vulnerabilities of CGI and how to avoid them. http://builder.com.com/5100-6371-5061201.html * How to execute a Javascript function in a Webbrowser/ IE Document? http://www.swissdelphicenter.ch/en/showcode.php?id=1732 * How to display items in a listview control display as a group (XP)? http://www.swissdelphicenter.ch/en/showcode.php?id=1782 * How to know when a form is activated or deactivated? http://www.swissdelphicenter.ch/en/showcode.php?id=1775 * How to Determine if you are running inside Virtual PC? http://www.swissdelphicenter.ch/en/showcode.php?id=1756 * How to implement a Linked List Memory Table? http://www.swissdelphicenter.ch/en/showcode.php?id=1758 * How to get the server (router) and client IP address of your dial-up connection? - by Sunish Issac There are quite a lot of articles on retrieving IP addresses for LAN interfaces. Here's one for dialup using RAS(Remote Access Services). http://www.delphi3000.com/articles/article_3683.asp * Changing the z-order of controls - by Daniel Wischnewski Move your control step-by-step. http://www.delphi3000.com/articles/article_3684.asp * RAVE Export Device for EMF, WMF and Bitmaps - by Julian Ziersch How to implement a generic RAVE render device. http://www.delphi3000.com/articles/article_3685.asp * How To Use MSAccess In Delphi (using BDE Components) - by Ameenudeen M Methods to access data in MS Access Database from Delphi Application using standard BDE Components. http://www.delphi3000.com/articles/article_3687.asp * Handle OleExceptions - by Andreas Schmidt A EOleException has more information than the default handler shows. http://www.delphi3000.com/articles/article_3694.asp * DialogUnits To Pixels - by Jean Claude Servaye How to convert dialogs units in pixels if the dialog do not use the system font. http://www.delphi3000.com/articles/article_3695.asp * Check for exe files and DLLs - by Peter Johnson This article looks at how we examine a file to check if it is a DOS or Windows executable and, if so, whether it is a program file or a DLL. http://www.delphi3000.com/articles/article_3696.asp * TreeView+ComboBox - by Eugine Veselov How to create a combobox which has a popup treeview. http://www.delphi3000.com/articles/article_3699.asp * Converting ASCII to Paradox - by gourari noureddine Exports delimited file to a Paradox table. http://www.delphi3000.com/articles/article_3700.asp * Dynamic ODBC DSN create and ADV MS-SQL Login - by Mike Heydon This class adds dynamic ODBC Alias/DSN generation at run-time. Also featured is two login modes, one that lets the programmer handle returned errors and another that stays in a loop with error messages that allows retry and Alias/DSN user setup. There are also properties that set and retrieve ODBC Alias/DSN driver and dsn settings such as CPTimeout, Version etc. http://www.delphi3000.com/articles/article_3702.asp * Advanced exception handler to find the exception source file name, call stack and all other related information - by Clever Components This article describes how to replace the standard Delphi exception handlers with advanced ones in order to get more control over all errors occuring during run-time execution. It is possible to collect very detailed information about all occured exceptions and save this information for later use without any interference with end-user. http://www.delphi3000.com/articles/article_3703.asp * Using TList's and Pointers in Delphi - by Stewart Moss A small demonstration that shows how to use the TList helper object and how to use pointers. It creates a list of Pointers to Integers but they could be a list of pointers to any record or class type. http://www.delphi3000.com/articles/article_3705.asp * Component to Monitor Clipboard - by Enrique Ortuño http://www.delphi3000.com/articles/article_3708.asp * Direct File Access with a StringGrid - by Max Kleiner From time to time we need to populate a StringGrid from a file and save it to a file in a well defined structure like a record. Here's a way to handle this with a contol class. http://www.delphi3000.com/articles/article_3709.asp * Converting a floating point value to an integer value - by Jim Carter Real to Integer typecasting. http://www.delphi3000.com/articles/article_3712.asp * Methods for Cutting and Pasting SQL Select Order by Clause - A. Wijoyo Most of data access components don't have method for sorting in memory records. So the only way for sorting records is add an order by clause to the query and reopen it. These method make this task easier to do. http://www.delphi3000.com/articles/article_3715.asp * Inline-editing with a TTreeView - by Omer Can http://www.delphi3000.com/articles/article_3720.asp * TTreeView descendant showing LAN hierarchy - by Eugine Veselov This component shows your LAN resources represented as a tree. http://www.delphi3000.com/articles/article_3721.asp * Design time Icons for CoClasses - by Andreas Schmidt How to add icons to CoClasses in an ActiveX DLL or automation server. Icons will be shown in IDEs like VB, VC++, Delphi, etc. http://www.delphi3000.com/articles/article_3725.asp * Exchange Items in a TListView - by Mike Shkolnik http://www.delphi3000.com/articles/article_3726.asp * Open Password Protected xls File + Save Without Password - M. Shkolnik http://www.delphi3000.com/articles/article_3727.asp * Replace Text or Font in doc File - by Mike Shkolnik How to use an OLE automation for MS Word and replace some text string in any document. http://www.delphi3000.com/articles/article_3728.asp * BitCompression - by Ritchie Blackmore Why using whole byte to store bynary data when single bit is enough? With this unit you can compress boolean array into byte array in one move. http://www.delphi3000.com/articles/article_3730.asp * Read picture maketime from digital camera file - by Maarten de Haan Almost every digital camera stores the datetime of the camera clock in the JPG-file when a picture is taken. This function will return the first occurence of the datetime found in the JPG-file. http://www.delphi3000.com/articles/article_3732.asp * plain MySQL access - by Ionel Roman How to access MySQL databases in plain source code using just library. (Windows and Linux) http://www.delphi3000.com/articles/article_3733.asp * Adding Line no and Column no to TRichTextBox - by Sridhar n http://www.delphi3000.com/articles/article_3734.asp * Exporting an TImage contents to WMF format - by Walter Alves Chagas http://www.delphi3000.com/articles/article_3735.asp * Show System Menu for Form - by Mike Shkolnik How to activate a system menu by button click. http://www.delphi3000.com/articles/article_3737.asp * WinInet: Implementing Resuming Feature - by Clever Components This article describes the most efficient way to continue downloading a file from a point where it stoped and organize the mutithreaded downloading feature using the WinInet library. http://www.delphi3000.com/articles/article_3738.asp * When to use Interfaces, when to use Inheritance? - by Max Kleiner There are two possibilities to define a (same) class hierarchy: with interfaces, with inheritance. Which one suits your needs? http://www.delphi3000.com/articles/article_3745.asp * Delphi .NET: "Hello, world!" - by Herbert Poltnik http://www.delphi3000.com/articles/article_3750.asp * Delphi .NET: Get Computer IP address - by Herbert Poltnik How to get the list of the computer's IP addresses. http://www.delphi3000.com/articles/article_3751.asp * Reterive Windows / IExplorer Special Folders - by Magnus Flysjö Using SHGetSpecialFolderPath API to get special folders. http://www.delphi3000.com/articles/article_3759.asp * Increasing speed of a ListBox with 1,000,000 lines - by Werner Pamler Populating the items of a ListBox can become extremely slow for a VERY large number of items. Is there a way to speed this up? http://www.delphi3000.com/articles/article_3761.asp * How To Load File Data To a String Using TFileStream - by Michael Cone How To Load File Data To a String Using TFileStream. http://www.delphi3000.com/articles/article_3762.asp White Papers / Case Studies --------------------------- * Case Study: Smart Restaurant Solutions See how Smart Restaurant Solutions took advantage of Delphi 7 Studio to deliver a Web Services-based solution to keep ahead of the competition. www.borland.com/products/case_studies/delphi_smart_restaurant.html Tutorials and Training ====================== * BorCon 2003 to be be held in San Jose, California November 1-5, 2003 http://info.borland.com/conf2003/ * Borland Web Seminars The Borland Web Seminar Series is designed to address the latest in development, deployment, and integration technologies. http://info.borland.com/web_seminar/ Available Web Seminars include: - Delivering high-performance applications for the Microsoft .NET Framework - Simplifying Integration of the Microsoft .NET Framework with J2EE/CORBA - Driving Alignment of IT Initiatives with Business Goals - Why Upgrade to JBuilder 9 - Accelerating Productivity with Agile Modeling - Introduction to the Borland Embedded Databases - Performance Management for J2EE Systems * Writing MS SQL Server Extended Stored Procedures with Delphi - by Berend de Boer Presents a framework which makes writing Microsoft SQL Server Extended Stored Procedures a breeze with four sample xp's (Extended Stored Procedures) shown and discussed. http://www.berenddeboer.net/article/1293.zip Source code: http://www.berenddeboer.net/article/1293_C.zip * Integrating with Outlook - By Berend de Boer This article explores the possibilities of using Microsoft Outlook as an extension of your program, or vice versa, your program as an extension of Outlook. The article gives you a good idea of Outlook's object model. You'll be able to integrate straight into Outlook itself by extending Outlook's menu and toolbars. After reading this article you should be able to program and control Outlook, sending mail and reading contacts. Also you should have a good start in writing Exchange Extensions. http://www.berenddeboer.net/article/1292.zip Source code: http://www.berenddeboer.net/article/1292_C.zip Other Links =========== * Get the New Delphi Desktop Wallpaper - by Borland Show your support for Borland with our cool new Delphi wallpaper. http://community.borland.com/article/0,1410,30321,00.html * Borland Partner CDs are online - by John Kaster The partner CD submissions for Borland's latest IDE products are available for download. http://community.borland.com/article/0,1410,29797,00.html * C#Builder Personal Download Now Available C#Builder Personal is now available as a free download for non-commercial development. http://www.borland.com/products/downloads/download_csharpbuilder.html * Delphi-PRAXiS Delphi community for German speaking programmers. http://www.delphipraxis.net * Delphi Programmers @ SETI - by m3rlin Newly founded SETI@Home group created for Delphi programmers. Join myself and m3rlin in the search for little green men. :) http://setiathome.ssl.berkeley.edu/stats/team/team_156396.html News ==== * Borland Upgrades Embedded Database - by Paul Krill Borland Software introduced InterBase 7.1, a cross-platform embeddable database that adds support for Windows Server 2003. http://www.infoworld.com/article/03/06/17/HNinterbase_1.html?platforms * BorCon 2003 to be be held in San Jose, California November 1-5, 2003 http://info.borland.com/conf2003/ Other Borland conferences around the world: - EKon 7 - 7th German/Borland Developers Conference - Frankfurt - September 21-26, 2003 http://www.entwicklerkonferenz.de http://www.entwicklerkonferenz.com/ - Borland Conference Europe - Amsterdam - November 10-12, 2003 http://www.europeanborlandconference.com/ - Borland Conference France - Paris - December 10-11, 2003 http://info.borland.fr/conference/2003/ * Open Letter to the Borland C++ Developer Community - by J.P. LeBlanc Learn about the future of the Borland C++ product line. http://bdn.borland.com/article/0,1410,30279,00.html ________________________________________________________________________ Vote for the Pascal Newsletter in The Delphi Top 200! http://top200.jazarsoft.com/delphi/rank.php3?id=latium ________________________________________________________________________ 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. Don't forget we also need articles for this newsletter and there is a prize for one of the authors in each issue. All articles will be considered but we are particularly interested in articles about Kylix because there is so little available online to help Kylix developers. Send articles to <eds2004 @ latiumsoftware.com>. We are also looking for shareware authors who would like to offer their components or applications as prizes for articles in the newsletter. In return you will be promoted in this newsletter and the Latium Software web site. For more information contact Dave <irongut @ vodafone.net>. ________________________________________________________________________ If you haven't received the full source code examples for this issue, you can get them from http://www.latiumsoftware.com/download/p0048.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 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) 2003 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!






