archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • FILE Position 0 BufferSize 0 signifies invalid data in buffer PROCEDURE ReadBlock PROCEDURE CheckForBlockEnd END IMPLEMENTATION USES SysUtils FileExists CONSTRUCTOR TExclusiveIO Create BEGIN INHERITED Create FileEnd FALSE FileOpen FALSE Position 0 END Create PROCEDURE TExclusiveIO ReadBlock BEGIN Do nothing if file is not open IF FileOpen THEN BEGIN TRY BlockRead Exclusive Buffer SizeOf Buffer BytesRead IF BytesRead 0 THEN BEGIN Position 0 FileEnd TRUE FileOpen FALSE END ELSE Position 1 EXCEPT On EInOutError DO BEGIN FileOpen FALSE Position 0 END END END END ReadBlock FUNCTION TExclusiveIO Open CONST filename STRING BOOLEAN VAR SaveMode WORD BEGIN IF FileExists filename THEN BEGIN TRY SaveMode System FileMode fmShareExclusive guarantees that a file that is still open for writing will not be read until after it has been closed This only works on typed or untyped files not TextFiles System FileMode fmShareExclusive AssignFile Exclusive filename Reset Exclusive 1 Read 1 byte at a time System FileMode SaveMode FileOpen TRUE EXCEPT On EInOutError DO BEGIN FileOpen FALSE FileEnd TRUE END END If open was successful go ahead and read first block IF FileOpen THEN ReadBlock END ELSE FileOpen FALSE RESULT FileOpen END OpenFile FUNCTION TExclusiveIO Close BOOLEAN BEGIN TRY CloseFile Exclusive FileOpen FALSE RESULT TRUE

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/IO/ExclusiveIO.TXT (2016-02-14)
    Open archived version from archive



  • 100113 1101 compuXXserve com Newsgroups borland public delphi objectpascal I need to compare the contents of two binary files with the same size How can I do this If possible a code snippet would be very appreciated I m not yet familiar with filestreams Toni try this Function AreFilesEqual Const file1 file2 String Boolean Var m1 m2 TMemoryStream Begin Result False m1 TMemoryStream Create try m1 LoadFromFile file1 m2 TMemoryStream

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0801b.txt (2016-02-14)
    Open archived version from archive


  • Reply To ralphfriedman email com Newsgroups borland public delphi winapi In message Ivan Petkovic stated How can I compare two files and see if they are identical Ivan assuming you are using a 32 bit version of Delphi and the files are not gigantic function CompareFiles AFileName1 string AFileName2 string boolean var file1 TFileStream file1Text string file2 TFileStream file2Text string begin Result false file1 TFileStream Create AFileName1 fmOpenRead try file2

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/1227.txt (2016-02-14)
    Open archived version from archive


  • HIDE to append one text file to another is there a way to do it with the win32 shell Who needs the shell for such a simple task Procedure ConCatFiles Const targetname String Const Sourcenames Array of String Var i Integer target source TFileStream Begin target TFileStream Create targetname fmCreate try For i Low Sourcenames To High Sourcenames Do Begin source TFileStream Create Sourcenames i fmOpenread or fmShareDenyNone try target

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0107b.txt (2016-02-14)
    Open archived version from archive


  • Posting Host 63 150 8 196 X Trace dnews 991918332 63 150 8 196 7 Jun 2001 05 52 12 0700 Lines 15 Path dnews Xref dnews borland public delphi objectpascal 191713 In article nospamps paxit dk says How do I delete the first line or the first 10 lines in a textfile I am running a logfile on an application and I want to keep the size of the

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0607b.txt (2016-02-14)
    Open archived version from archive


  • s the user account may not have the required rights to create registry keys under HKEY CLASSES ROOT Procedure CreateKey Description This is a helper routine which uses the passed reg object to create a registry key Error Conditions If the key cannot be created a ERegistryError exception is raised Created 14 03 99 by P Below Procedure CreateKey reg TRegistry Const keyname String Begin If not reg OpenKey keyname True Then raise ERegistryError CreateFmt eCannotCreateKey keyname End CreateKey Procedure RegisterFiletype Parameters extension file extension including the dot to register filetype string to use as key for the file extension description string to show in Explorer for files with this extension If description is empty the file type will not show up in Explorers list of registered associations verb action to register open edit print etc The action will turn up as entry in the files context menu in Explorer serverapp full pathname of the executable to associate with the file extension including any command line switches Include the 1 placeholder as well Actions like printto may require more than one placeholder Description Creates the three basic registry keys for a file extension HKCR HKCR HKCR shell command If the keys already exist they are overwritten Error Conditions A ERegistryError exception will result if a key cannot be created Failure to create a key is usually due to insufficient user rights and only a problem on NT Created 14 03 99 by P Below Procedure RegisterFiletype Const extension filetype description verb serverapp String Var reg TRegistry keystring String Begin reg TRegistry Create Try reg Rootkey HKEY CLASSES ROOT CreateKey reg extension reg WriteString filetype reg CloseKey CreateKey reg filetype reg WriteString description reg closekey keystring Format s shell s command filetype verb CreateKey reg keystring reg WriteString serverapp reg CloseKey Finally reg free End End RegisterFiletype Procedure RegisterDDEServer Parameters filetype file type key name to register the server for verb action to register open edit print etc topic DDE topic name to use This is usually the name of a TDDEServerConv component servername DDE server name to use This is usually the filename of the executable without extension and path macro DDE macro to execute for the action needs to include a 1 placeholder for a filename Description Creates the registry keys required to open files of this type via DDE from Explorer or ShellExecute RegisterFileType needs to be called first to associate the filetype with an extension The registry keys added are HKCR shell ddeexec HKCR shell ddeexec topic HKCR shell ddeexec application If the keys already exist they are overwritten Error Conditions A ERegistryError exception will result if a key cannot be created Failure to create a key is usually due to insufficient user rights and only a problem on NT Created 14 03 99 by P Below Procedure RegisterDDEServer Const filetype verb topic servername macro String Var reg TRegistry keystring String Begin reg TRegistry Create Try reg Rootkey HKEY CLASSES ROOT keystring Format s shell s ddeexec

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0314b.txt (2016-02-14)
    Open archived version from archive


  • opened by my application Hi Paul you have to create some registry values and keys under HKEY CLASSES ROOT var Reg TRegistry begin Reg TRegistry Create Reg RootKey hKey Classes Root Reg OpenKey ext true create key for file extension Reg WriteString MyExtension Write alias Reg CloseKey Close this key before opening another Reg OpenKey MyExtension true Create alias key Reg WriteString My registered file type Write description Reg CloseKey

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0312.txt (2016-02-14)
    Open archived version from archive


  • MimeOLE Produced By Microsoft MimeOLE V4 72 3110 3 Organization PhilippeRanger RemoveThis compuserve com Reply To Philippe Ranger Newsgroups borland public delphi objectpascal Use this with the mode you want or d with fmDenyWrite See File open mode in the Help If you re using a text file just replace the first param type with text Uses sysUtils windows Function openInMode var f file sFname string nMode integer boolean Var

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0608.txt (2016-02-14)
    Open archived version from archive



  •