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".
  • efg's Science and Engineering Page
    function to create a spectrum of visible light 380 to 780 nanometers and optionally show interval markers Point at spot on spectrum and see RGB values Show absorption and emission spectra of hydrogen Print spectrum or save to 24 bit BMP file Show graph using TChart of R G B components versus wavelength Visible light spectrum hydrogen emission spectrum hydrogen absorption spectrum WavelengthToRGB function TChart Scanline TRGBArray Print BMP StretchDIBits

    Original URL path: http://www.efg2.com/Lab/ScienceAndEngineering/index.html (2016-02-14)
    Open archived version from archive


  • efg's Printer Projects Page
    not appear on some printers or versions of Delphi For example no image is displayed on LaserJet 5 in Delphi 1 or 2 but does appear in Delphi 3 with same printer 6 Print same images using StretchDraw 7 Print Image the right way using StretchDIBits 8 Create and Print Hue Saturation color circle Bitmap with StrechDraw and StretchDIBits Draw sine curve to offscreen bitmap and then use CopyRect to Printer Canvas 9 List the fonts for this printer Delphi printing Draw StretchDraw StretchDIBits CopyRect GetDeviceCaps Pixels Per Inch Aspect Ratio Fonts Scanline HSVtoRGB TextOut Rect sorting using TStringList Transparency A 4 Printer Demo 2 This Demo shows how to write a routine DisplayGraphics that displays various graphics pen brush styles and how to draw lines ellipses chords pies and text on a Canvas Use this routine with any canvas The example shows how to write on the TForm TImage TBitmap and Printer canvases Output on the Printer canvas is in either Landscape or Portrait orientation Results of Pen Brush styles differ on various printers Note that the TForm Canvas is not preserved when it is damaged i e it is not redrawn unless the OnPaint handler is used Two Windows regions are used to define a complex clipping region The various rectangles that are drawn on the screen show the 20 colors in Windows that do NOT dither even on a 256 color display In addition shades of gray are shown which differ on various printers Windows non dither colors Pen Style Pen Width Brush Style Canvas MoveTo Canvas LineTo Canvas Rectangle Canvas Ellipse Canvas Chord Canvas Pie Canvas TextOut MulDiv Device independent graphics CreateRectRgn CreateEllipticRgn CombineRgn SelectClipRgn DeleteObject A 5 ShellDemo SHPrinters ZIP Delphi 3 version of most of the code from Microsoft s Knowledge Base Article Q153751

    Original URL path: http://www.efg2.com/Lab/OtherProjects/PrinterProjects.htm (2016-02-14)
    Open archived version from archive

  • efg's Other Projects Page
    files for use with Pager Utility below Writes results to log file for review Delphi 3 Source and EXE Uses icmp unit from www mg soft si TPageControl TStringGrid TIniFiles TTimer A 6 PageService ZIP Pager utility The EXEs described below require the XPAGER32 DLL for operation which is included in the ZIP file Delphi 3 Source and EXE See ReadMe Txt file Since I developed this program a newer version of XPAGER is now available and is called Power Page Contact Ron Tanner at www inventiveweb com prod01 htm for information on how to obtain the XPDELPHI PAS unit to recompile the Delphi projects All my source code is in the ZIP Only XPAGER32 DLL can be distributed due to the license agreement XPagerText EXE Freeware Quick overview of XPAGER32 s capabilities PageService EXE Freeware for non commercial use Fee for for commercial use Send pages manually or via automation Define pager IDs and groups of pagers Send page to list of pagers or groups Supports multiple paging companies Each pager Nickname is associated with a paging company Autopage searches specified directories for specified files that become pages Designed to work with Pinger above or VisualChron below utilities For example periodically ping IP addresses and page if network connection is down Send page from any computer or device that can be configured to write simple ASCII file TPageControl TStringGrid TIniFiles TTimer user defined Windows messages modems phone dialer ExclusiveIO unit to read text files in exclusive mode also reads DOS or UNIX line ends QueueManager unit StringGridLibrary Tokens Library A 7 VisualChron ZIP Visual Chron utility VisualChron is a Delphi utility that works somewhat like the UNIX cron command to run commands at specified frequencies Design to work with Pager Utility above Delphi 3 Source and EXE See ReadMe 1st file TPageControl TStringGrid TIniFiles TTimer REXX Library Tokens Library StringGridLibrary A 8 Till Till Countdown clock The default behavior is to count down till the next January 1 regardless of the year until you select your target time TTimer Now TDateTime TDateTimePicker DateTime SetFormat Application OnRestore Application OnMinimize Application Title Format ClientWidth ClientHeight Trunc Frac DecodeTime EncodeDate TIniFile WritePrivateProfileString ShellExecute A 9 Arial Unicode MS Display any of the 65 536 Unicode Characters Requires Windows NT 2000 and Windows 2000 Unicode Arial Unicode MS font Unicode Block Unicode NamesList TXT WideChar WideString SetLength Delete TextOutW ExtTextOutW GetTextExtentPoint32W StringGridDrawCell StringGridClick TBitmap TImage palette TRichEdit TCombobox Invalidate GetVersionEx TOSVersionInfo Fonts IndexOf ShellExecute OpenClipboard EmptyClipboard SetClipboardData CloseClipboard CF UNICODETEXT StretchDIBits Printer Canvas A 10 Hershey H Hershey Font This Delphi Kylix project demonstrates how to manipulate the data and display the characters in the original Hershey font files Hershey Font rotation scaling VCL CLX TStringList TListBox TSpinEdit Application Icon Delphi 3 4 5 Kylix Linux B Utilities and Other Programs Program Description Keywords B 1 SysMap ZIP System Map Includes BIOS DOS Memory and Disk Information The Memory Map was part of SysMap and was published as a utility MemMap in PC

    Original URL path: http://www.efg2.com/Lab/OtherProjects/index.html (2016-02-14)
    Open archived version from archive

  • efg's Tech Note on Hershey's Repertory of Occidental Type Fonts
    TStringList s STRING begin Don t allow form to be resized WITH FormHershey Constraints DO BEGIN MaxHeight Height MaxWidth Width MinHeight Height MinWidth Width END Hershey TStringList Create Filename ExtractFilePath ParamStr 0 Hershey DAT IF FileExists Filename THEN BEGIN Screen Cursor crHourGlass TRY Raw TStringList Create TRY Raw LoadFromFile Filename Reduce each character to one line s Raw 0 FOR i 1 TO Raw Count 1 DO BEGIN IF COPY Raw i 1 8 THEN s s COPY Raw i 9 LENGTH Raw i 8 ELSE BEGIN Hershey Add s s COPY s 1 Pos s 1 ListBoxHershey Items Add s s Raw i END END Hershey Add s take care of last character s COPY s 1 Pos s 1 ListBoxHershey Items Add s ListBoxHershey ItemIndex 0 HersheyChange ulUpdateList FINALLY Raw Free END FINALLY Screen Cursor crDefault END Avoid SpinEditScaleChanged being called during initialization until set here SpinEditScale OnChanged SpinEditScaleChanged END ELSE ShowMessage Cannot find data file Hershey DAT end Once the table is loaded the first symbol in the list is automatically selected Whenever a symbol is selected or when its scaling factor or rotation angle is changed the HersheyChange method is called Changing a selected symbol or change in scaling or rotation of a symbol procedure TFormHershey ListBoxHersheyClick Sender TObject begin HersheyChange ulUpdateList end procedure TFormHershey UpdateHersheyLook Sender TObject begin This appraoch avoids unnecessry updates and flicker of MemoCharacter HersheyChange ulDoNotUpdateList end The HersheyChange method updates the display of a single Hershey symbol Displaying single Hershey symbol PROCEDURE TFormHershey HersheyChange CONST NewPointList TUpdateList TYPE TPenMode pmUp pmDown VAR alpha Double Bitmap TBitmap BoundaryLeft INTEGER BoundaryRight INTEGER CosAlpha Double index STRING penmode TPenMode s STRING Scale INTEGER SinAlpha Double t STRING x INTEGER xMidPoint INTEGER xOld INTEGER xPrime INTEGER xSave INTEGER y INTEGER yOld INTEGER yMidPoint INTEGER yPrime INTEGER begin xOld 0 avoid compiler warning yOld 0 xMidPoint Image Width DIV 2 yMidPoint Image Height DIV 2 Scale SpinEditScale Value IF NewPointList ulUpdateList THEN MemoCharacter Lines Clear s ListBoxHershey Items ListBoxHershey ItemIndex index Trim COPY s 1 7 Delete s 1 8 BoundaryLeft StrToInt COPY s 1 3 BoundaryRight StrToInt COPY s 5 3 Delete s 1 8 Bitmap TBitmap Create TRY Bitmap Width Image Width Bitmap Height Image Height Bitmap Canvas Font Name Arial Bitmap Canvas Font Height MulDiv Image Height 12 100 Bitmap Canvas Font Style fsBold Bitmap Canvas TextOut 2 2 index Bitmap Canvas Pen Color clSilver Bitmap Canvas MoveTo xMidPoint BoundaryLeft Scale yMidPoint 5 Scale Bitmap Canvas LineTo xMidPoint BoundaryLeft Scale yMidPoint 5 Scale Bitmap Canvas MoveTo xMidPoint BoundaryRight Scale yMidPoint 5 Scale Bitmap Canvas LineTo xMidPoint BoundaryRight Scale yMidPoint 5 Scale penmode pmUp WHILE LENGTH s 0 DO BEGIN x StrToInt COPY s 1 3 y StrToInt COPY s 5 3 IF NewPointList ulUpdateList THEN MemoCharacter Lines Add IntToStr x IntToStr y Rotate figure As suggested by Jacques Oberto rotation of these figures is easy since the center of the figure is the origin t Rotation IntToStr TrackBarRotation Position degree IF TrackBarRotation Position

    Original URL path: http://www.efg2.com/Lab/OtherProjects/Hershey.htm (2016-02-14)
    Open archived version from archive

  • efg's Unicode Lab Report
    NamesList Txt file to add additional information but use an editor that shows you the location of the tab characters Do not remove or expand the tabs in this file or the parsing routine will no longer work correctly Arial Unicode MS Font Check Arial Unicode MS Font Check font is from Office 2000 CONST UnicodeFont Arial Unicode MS IF Screen Fonts IndexOf UnicodeFont 0 THEN BEGIN FormUnicode Caption Unicode font UnicodeFont is not available ShowMessage s 0A Unicode characters will not appear END Three main controls perform roughly the same actions The Block Combobox and a click on either the Sector or Character StringGrids all result in the at least the following steps Define a range of Unicode characters UnicodeRangeFrom and UnicodeRangeTo Redraw StringGrids Draw Unicode Graphics Display information about selected Unicode from NamesList Txt file The last three steps are performed in TFormUnicode UpdateEverything A single Unicode character can be displayed in a bitmap using the UnicodeLibrary routine GetUnicodeBitmap How to Display a Single Unicode Character in a Bitmap Calling program responsible for freeing bitmap FUNCTION GetUnicodeBitmap CONST w WideChar CONST BitmapSize INTEGER VAR Size TSize TBitmap CONST UnicodeFont Arial Unicode MS VAR Palette TMaxLogPalette BEGIN Need black white palette for pf1bit bitmap Palette palVersion 300 Palette palNumEntries 2 WITH Palette palPalEntry 0 DO BEGIN peRed 0 peGreen 0 peBlue 0 peFlags 0 END WITH Palette palPalEntry 1 DO BEGIN peRed 255 peGreen 255 peBlue 255 peFlags 0 END RESULT TBitmap Create RESULT PixelFormat pf1bit RESULT Height BitmapSize RESULT Width BitmapSize RESULT Palette CreatePalette pLogPalette Palette Not clear why this is need to clear whole background to white otherwise only sometimes part of bitmap is black instead RESULT Canvas Brush Color clWhite RESULT Canvas FillRect RESULT Canvas ClipRect RESULT Canvas Font Name UnicodeFont RESULT Canvas Font Height BitmapSize GetTextExtentPoint32W RESULT Canvas Handle w 1 Size TextOutW RESULT Canvas Handle RESULT Width size cx DIV 2 0 center left to right w 1 END GetUnicodeBitmap GetUnicodeBitmap was used both in TFormUnicode DisplayUnicodeGraphic and TFormSave DisplayUnicodeGraphic Displaying a Unicode String is about the same amount of work How to Display a Unicode String in a Bitmap PROCEDURE TFormUnicode DisplayUnicodeString VAR Bitmap TBitmap Size TSize BEGIN Bitmap TBitmap Create TRY Bitmap Width ImageUnicodeString Width Bitmap Height ImageUnicodeString Height Bitmap PixelFormat pf1bit Bitmap Canvas Brush Color clWhite Bitmap Canvas FillRect Bitmap Canvas ClipRect Bitmap Canvas Font Name UnicodeFont Bitmap Canvas Font Height Bitmap Height scroll left as necessary to make sure most recent character fits GetTextExtentPoint32W Bitmap Canvas Handle pWideChar UnicodeString Length UnicodeString size WHILE Size cx Bitmap Width DO BEGIN Delete UnicodeString 1 1 GetTextExtentPoint32W Bitmap Canvas Handle pWideChar UnicodeString Length UnicodeString size END TextOutW Bitmap Canvas Handle 0 0 pWideChar UnicodeString Length UnicodeString ImageUnicodeString Picture Graphic Bitmap FINALLY Bitmap Free END END DisplayUnicodeString Why doesn t DisplayUnicodeString deal with palettes when GetUnicodeBitmap does I don t know this was discovered quite by accident For now I m calling this a pf1bit enigma and will investigate this more when time permits

    Original URL path: http://www.efg2.com/Lab/OtherProjects/Unicode.htm (2016-02-14)
    Open archived version from archive

  • efg's Delphi Reference Library
    Graphics Color Image Processing Mathematics Geometry F Multimedia G Resources Math Functions A Constants B General Math Functions Arithmetic Functions Logarithm Exponential Functions Trigonometric Functions Conversions and Formatting Financial Functions Sorting Discrete Mathematics Miscellaneous C Engineering Mathematics Hyperbolic Functions Special Functions Complex Math and Functions Linear Algebra Matrices Eigenvectors Digital Signal Processing FFTs ODEs and PDEs D Numerical Methods Interpolation Extrapolation Numerical Integration Derivatives Polynomials Function Evaluation Optimization Root Finding

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

  • efg's Delphi Algorithms Page
    http fuzzy sonalysts com Genetic Algorithms The Genetic Programming component is designed to simplify implementation of a GP System handling all the GP specific tasks for the user http delphi icm edu pl ftp d40free gp zip Graph Theory ftp ftp ifi unizh ch pub listen baeume graphen LBG TEXT Introducing Graphs No not those pretty things you do on squared paper but computer science graphs used for example in calculating the smallest distance to drive between appointments in several places Clever stuff from Julian Bucknall Delphi Magazine Issue 32 October 1998 To progress his discussion of graph algorithms Julian Bucknall takes a slight detour to discuss priority queues and how to work with them handily showing how to implement the heapsort algorithm along the way too Delphi Magazine Issue 39 November 1998 Topological sorts solving the travelling salesmen problem the algorithms of Prim and Dijkstra it s all here so come join the party Delphi Magazine Issue 41 January 1999 PlanB PlanB predstavlja interaktivnu mapu i poslovni imenik Bečeja Omogu ava lako pronala enje ulica trgova firmi i drugih va nijih mesta i objekata na mapi http solair eunet yu ilicv PlanB htm Graph Theory Lesson www ftd fr odahan docs GTL zip Graph Traverse www delphiforfun org Programs graph traverse htm Also see Shortest Paths Graphics Algorithms efg s Delphi Graphics Algorithms General Graphics Color Image Processing Mathematics Geometry also see general Computer Graphics Reference Library page Greatest Common Divisor GCD Euclid s algorithm in UseNet Post by Hans van Kruijssen Fibonacci Numbers Numerical Methods in Pascal page Prime Numbers Fibonacci Numbers Pi http www rab larc nasa gov nmp nmpIndex htm PrimeNumbers Hashing Colin Sarsfield s UseNet Post with HashN function Making a Hash Of It Setting up an Abstract Hash Table Delphi Informant Sept 1999 pp 31 37 Hash It Out Using Hash Tables to Manipulate Key based Data Delphi Informant Feb 1999 Hash Alogrithm MD4 MD5 RipeMD160 SHA1 Haval 128 256 http delphi icm edu pl ftp d20free cipher zip Hashing www delphiforfun org Programs Math Topics hashing htm HashTrie is an efficient data structure for fast searching http delphi icm edu pl ftp d20free hashtrie zip Hash function for strings www scalabium com faq dct0093 htm Hash It Out Using Hash Tables to Manipulate Key based Data A hash table is a data structure that allows you to store and retrieve items based on a key Delphi Informant Feb 1999 pp 31 37 di199902rs f zip How can you find items in a list really quickly Julian Bucknall knows how to get your data dancing to the right tune and this month begins his explanation of hash tables Delphi Magazine Issue 30 February 1998 Julian Bucknall concludes his 2 parter exploration of hash tables and how to use them in your Delphi applications to make finding text strings in long lists really quick plus there s a natty hash index record manager ready to plug right into your programs Delphi Magazine Issue 31 March 1998 Brad Stower s UseNet Post about using Windows Atom functions as hash functions Huffman See Compression Image Processing efg s Delphi Graphics Algorithms Image Processing also see general Image Processing Reference Library page Interpolation 16 bit Assembly Routine from UseNet Post Inverse Inverse and n th roots of large numbers http xavier gourdon free fr Constants Algorithms inverse html Least Common Denominator Borland s How can I compute the lowest common denominator FAQ 2895D Hans van Kruijssen UseNet Post Lightning Nelson Chu Siu Hang s Ideas Behind My Lightning Effect www cs ust hk cpegnel lightning html Lists The EZDSL units provide an OOP interface for classical data structures for Delphi stacks queues including deques and priority queues lists single double and skip hash tables binary trees including search and red black and so forth http www boyet com EZDSL default htm Lists Linked Linked Lists When the Data Is Too Dynamic for Arrays Delphi Informant May 1998 Section 6 List Processing with Singly Linked Lists Turbo Algorithms Section 7 List Processing with Doubly Linked and Circular Lists F Double linked list queue stack www ibrtses com delphi dllist html Saving Linked Lists www 209software com books p4dp SaveLink html Map Coloring A Look at Four and Five Color Algorithms Delphi Informant May 1999 pp 40 47 Map Projections The MapProject DLL software component library provides functions for transforming vector map data from one map projection to another including changes of datums and spheroids of the earth www graticule com products mapproject html Maps See Maps on Delphi Graphics Algorithms page Mastermind www delphiforfun org Programs MasterMind htm Mathematics Mathematical Algorithms Delphi Math Info and Links Delphi Math Functions Graphics Math Geometry Section 3 Mathematical Algorithms Turbo Algorithms Arithmetic Algorithms http www dcc uchile cl rbaeza handbook arit a html Algorithmes mathématiques www chez com algor math math htm also see general Mathematics Reference Library page Mathematics Recreational Insert and signs as necessary into the string 123456789 to form an expression that evaluates to 100 Expressions 100 www delphiforfun org Programs Expression100 htm Magic Squares www delphiforfun org Programs magic squares1 htm Knight s Tour www delphiforfun org Programs knight s tour htm Roman Numerals www delphiforfun org Programs roman numerals htm Cards1 www delphiforfun org Programs cards1 htm Cards2 www delphiforfun org Programs cards2 htm TCardDeck including Shuffle method and BlackJack game in Delphi 5 Developer s Guide by Teixeira and Pacheco Multiple Precision Arithmetic efg s Cryptography page N th Digit Computation http xavier gourdon free fr Constants Algorithms nthdigit html Neural Networks NeuralBase components library for Delphi Neural Networks www basegroup ru download neuralbase en htm Artificial Neuronal Network ANN which is based on a back propagation algorithm http delphi icm edu pl ftp d30share neuronalnetworktrial zip Neural Networks www ibrtses com delphi neuralnets html An Introduction to Back Propagation Neural Networks www seattlerobotics org encoder nov98 neural html Pascal code A component with methods for building train run show store retreive neural nets and is

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

  • efg's Reference Library: Delphi Dates and Times
    http www pjh2 de datetime weeknumber index php http delphi pjh2 de units download DTWeeks zip GetLocalTime The GetLocalTime function retrieves the current local date and time See Borland s Getting the time and date in Universal Time for an example Windows FAQ 1157D GetSystemTime The GetSystemTime function retrieves the current system date and time The system time is expressed in Coordinated Universal Time UTC See Borland s Getting the time and date in Universal Time for an example System FAQ 1157D GetSystemTimeAsFileTime The GetSystemTimeAsFileTime function obtains the current system date and time The information is in Coordinated Universal Time UTC format System GetSystemTimeAdjustment The GetSystemTimeAdjustment function determines whether the system is applying periodic time adjustments to its time of day clock at each clock interrupt along with the value and period of any such adjustments Windows GetThreadLocale See SetLocaleWeekSetting procedure in DTWeek PAS unit by Peter Haas http home t online de home PeterJHaas ISO8601 htm Peter s examples show how to use GetLocaleChar values for LOCALE IFIRSTDAYOFWEEK and LOCALE IFIRSTWEEKOFYEAR e g GetLocaleChar DefaultLCID LOCALE IFIRSTDAYOFWEEK 0 See GetWinLocaleWeekDef function in DTWeeks pas unit by Peter Haas http www pjh2 de datetime weeknumber index php http delphi pjh2 de units download DTWeeks zip GetThreadTimes Windows NT 2000 only function GetThreadTimes hThread THandle var lpCreationTime lpExitTime lpKernelTime lpUserTime TFileTime BOOL stdcall Delphi 5 Developer s Guide pp 291 292 Windows 95 98 returns FALSE Windows GetTickCount VAR Start DWORD D2 D5 Stop DWORD Start GetTickCount Sleep 2000 2000 milliseconds 2 seconds Stop GetTickCount ShowMessage IntToStr Stop Start Format 3f Stop Start 1000 seconds Sample Output 2001 2 001 seconds The GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started The internal timer wraps around to zero if Windows is run continuously for approximately 49 7 days Editorial Can Windows run that long without crashing Take a look at MS s Computer Hangs After 49 7 Days Borland s Timed beeps from the PC speaker FAQ 1838D Also see QueryPerformanceCounter and GetCycleCount Windows GetTimeZoneInformation The GetTimeZoneInformation function retrieves the current time zone parameters These parameters control the translations between Coordinated Universal Time UTC and local time See also TTimeZoneInformation Erez Steinberg s UseNet Post about using GetTimeZoneInformation Read and translate the info in a TTimeZoneInformation record http delphi pjh2 de units download TZView zip PROCEDURE TFormSystemInfo ShowDateTime VAR TimeZoneInformation TTimeZoneInformation FUNCTION DayInMonth CONST w WORD STRING BEGIN CASE w OF 1 RESULT 1st 2 RESULT 2nd 3 RESULT 3rd 4 RESULT 4th 5 RESULT Last ELSE RESULT Unknown END END DayInMonth BEGIN MemoInfo Lines Add Date Time MemoInfo Lines Add Current Time FormatDateTime mm dd yyyy hh nn ss Now See pp 700 702 of Tomes of Delphi 3 Win32 Core API GetTimeZoneInformation TimeZoneInformation WITH TimeZoneInformation DO BEGIN IF StandardDate wYear 0 THEN MemoInfo Lines Add StandardName Starts DayInMonth StandardDate wDay LongDayNames 1 StandardDate wDayofWeek of LongMonthNames StandardDate wMonth ELSE MemoInfo Lines Add StandardName Starts Format 2 2d 2 2d 4 4d 2 2d 2 2d 2 2d StandardDate wMonth StandardDate wDay StandardDate wYear StandardDate wHour StandardDate wMinute StandardDate wSecond END WITH TimeZoneInformation DO BEGIN IF DaylightDate wYear 0 THEN MemoInfo Lines Add DaylightName Starts DayInMonth DaylightDate wDay LongDayNames 1 DaylightDate wDayofWeek of LongMonthNames DaylightDate wMonth ELSE MemoInfo Lines Add DaylightName Starts Format 2 2d 2 2d 4 4 2 2d 2 2d 2 2d DaylightDate wMonth DaylightDate wDay DaylightDate wYear DaylightDate wHour DaylightDate wMinute DaylightDate wSecond END END ShowDateTime Getting a list of valid time zones from Windows Borland s FAQ 2700D Using GetTimeZoneInformation function FAQ 2630D System IncMonth Function IncMonth const Date TDateTime NumberOfMonths Integer TDateTime IncMonth returns Date shifted by the specified number of months NumberOfMonths parameter can be negative to return a date N months ago If the input day of month is greater than the last day of the resulting month the day is set to the last day of the resulting month Input time of day is copied to the DateTime result SysUtils InstallDate InstallDate Widows NT and FirstInstallDateTime Windows 95 98 are Windows registry keys See examples of reading these keys under FileDateToDateTime IsLeapYear Function IsLeapYear Year Word Boolean Function that identifies whether specified year is a leap year SysUtils IsLeapYear function IsLeapYear const Year Integer Boolean overload function IsLeapYear const DateTime TDateTime Boolean overload Delphi Jedi Code Library JCLDateTime Pas unit ISODateStrToDateTime Graham Harris UseNet Post with ISODateStrToDateTime function Julian Day Business A Julian day is the number of the day of the year e g Jan 1 1 Jan 2 2 etc and Dec 31 365 or 366 in a leap year If Year is a word variable that contains the year of interest and you want the Julian day for a given Month and Day also stored in word variables the Julian day is JulianDay TRUNC EncodeDate year month day TRUNC EncodeDate year 1 1 1 Alternate Solution Meeus91 p 65 DayOfYear 1978 11 14 318 DayOfYear 2000 11 14 319 FUNCTION DayOfYear CONST Year Month Day WORD INTEGER VAR k WORD BEGIN IF IsLeapYear Year THEN k 1 ELSE k 2 RESULT TRUNC 275 Month 9 k TRUNC Month 9 12 Day 30 END DayOfYear LastDayInMonth Last day in month is day before first day of next month FUNCTION LastDayInMonth CONST year month WORD TDateTime BEGIN IF month 12 THEN RESULT EncodeDate Year 1 1 1 1 ELSE RESULT EncodeDate Year Month 1 1 1 END Usage ShowMessage FormatDateTime mmmm dd yyyy LastDayInMonth SpinEditYear Value SpinEditMonth Value LocalFileTimeToFileTime The LocalFileTimeToFileTime function converts a local file time to a file time based on the Coordinated Universal Time UTC LongDateFormat Windows definition of long date format e g dddd MMMM dd yyyy See also ShortDateFormat SysUtils LongDayNames Array of strings containing long day names e g LongDayNames 1 Sunday and LongDayNames 7 Saturday depends on locale settings See also ShortDayNames array SysUtils LongTimeFormat Windows definition of long time format e g h mm ss AMPM See also ShortTimeFormat SysUtils LongMonthNameToInteger Requires LongMonthNames from SysUtils Returns 1 for January 12 for December 0 if invalid FUNCTION LongMonthNameToInteger CONST Month STRING INTEGER VAR MonthIndex INTEGER NotFound BOOLEAN BEGIN RESULT 0 NotFound TRUE MonthIndex 0 WHILE MonthIndex 12 AND NotFound DO BEGIN INC MonthIndex IF Month LongMonthNames MonthIndex THEN BEGIN NotFound FALSE RESULT MonthIndex END END END SysUtils and efg s function LongMonthNames Array of strings containing long month names e g LongMonthNames 1 January and LongMonthNames 12 December depends on locale settings See also ShortMonthNames array SysUtils MonthDays Number of days in a month MonthDays IsLeapYear MonthNumber SysUtils MonthOfDate function MonthOfDate const DateTime TDateTime Integer Delphi Jedi Code Library JCLDateTime Pas unit MSecsPerDay SecsPerDay 1000 SysUtils MSecsToTimeStamp D3 function MSecsToTimeStamp MSecs Comp TTimeStamp Call MSecsToTimeStamp to convert MSecs a number of milliseconds into the number of days represented plus the number of milliseconds remaining The days and milliseconds are expressed as a TTimeStamp value where the Date field is the number of days and the Time field is the remainder in milliseconds Unclear why Comp type is used in D4 and after when Int64 is available SysUtils Multimedia Timers Tomes of Delphi Win 32 MultiMedia API Chapter 7 Timers and Joysticks NextYear 1 EncodeDate StrToInt FormatDateTime yyyy Now 1 1 Now Now returns the current date and time Now Date Time SysUtils QueryPerformance Counter HowTo Use QueryPerformanceCounter To Time Code http support microsoft com support kb articles Q172 3 38 ASP VAR Frequency Int64 Start Int64 D4 D5 Stop Int64 QueryPerformanceFrequency Frequency QueryPerformanceCounter Start Sleep 2000 2000 milliseconds 2 seconds QueryPerformanceCounter Stop ShowMessage IntToStr Stop Start IntToStr Frequency Format 6f Stop Start Frequency seconds Sample output 2389176 1193180 2 002360 seconds JCLCounter pas unit is part of Delphi Jedi Code Library See also GetTickCount and GetCycleCount Windows RDTSC Read Time Stamp Counter returns the number of clock cycles since the CPU was powered up or reset www midnightbeach com jon pubs rdtsc htm ReadDate TRegistry method Retrieves a date value from a specified data value associated with the current key Registry ReadDateTime TRegistry method Retrieves a date and time value from a specified data value associated with the current key Registry ReplaceDate D5 procedure ReplaceDate var DateTime TDateTime const NewDate TDateTime ReplaceDate changes the value of the DateTime parameter so that it has the same date as the NewDate parameter The time portion of DateTime remains the same ReplaceDate makes any necessary adjustments for negative dates before 1900 SysUtils ReplaceTime D5 procedure ReplaceTime var DateTime TDateTime const NewTime TDateTime ReplaceTime changes the value of the DateTime parameter so that it has the same time as the NewTime parameter The date portion of DateTime remains the same ReplaceTime makes any necessary adjustments for negative dates before 1900 SysUtils SecsPerDay 24 60 60 SysUtils SetFileTime The SetFileTime function sets the date and time that a file was created last accessed or last modified Peter Below s UseNet Post about setting CreatedDateTime of a file System SetLocalTime The SetLocalTime function sets the current local time and date System SetSystemTime The SetSystemTime function sets the current system time and date The system time is expressed in Coordinated Universal Time UTC System SetSystemTimeAdjustment The SetSystemTimeAdjustment function tells the system to enable or disable periodic time adjustments to its time of day clock Windows SetTimeZoneInformation The SetTimeZoneInformation function sets the current time zone parameters These parameters control translations from Coordinated Universal Time UTC to local time System ShortDateFormat Windows definition of short date format e g M d yy See also LongDateFormat SysUtils ShortDayNames Array of strings containing short day names e g ShortDayNames 1 Sun and ShortDayNames 12 Sat depends on locale settings See also LongDayNames array SysUtils ShortMonthNames Array of strings containing long month names e g ShortMonthNames 1 Jan and ShortMonthNames 12 Dec depends on locale settings See also LongMonthNames array SysUtils ShortTimeFormat Windows definition of short time format e g h mm AMPM See also LongTimeFormat SysUtils SLongDayNameSun SLongDayNameSat Sunday Saturday SysConst Delphi 4 SLongMonthNameJan SLongMonthNameDec January December SysConst Delphi 4 SShortDayNameSun SSShortNameSat Sun Sat SysConst Delphi 4 SShortMonthNameJan SShortMonthNameDec Jan Dec SysConst Delphi 4 StrToDate StrToDate converts a string to a date format In Delphi 4 the TwoDigitCenturyWindow global variable affects what StrToDate returns Here are some examples Current Year TwoDigit Cenury Window Century Pivot StrToDate of 01 01 03 01 01 68 01 01 50 1998 0 default 1900 1903 1968 1950 2002 0 2000 2003 2068 2050 1998 50 1948 2003 1968 1950 2002 50 1952 2003 1968 2050 2020 50 1970 2003 2068 2050 SysUtils StrToDateTime StrToDateTime converts a string into TDateTime format TargetTime StrToDateTime TargetDateString TargetTimeString TargetTime StrToDateTime EditTestTime Text SysUtils SystemTimeToDateTime Returns TDateTime given a TSystemTime Jamie Frater s UseNet Post with UnixTimeToDateTime by code by Philippe Ranger showing use of SystemTimeToTzSpecifiedLocalTime SysUtils SystemTimeToFileTime The SystemTimeToFileTime function converts a system time to a file time Delphi 5 Developer s Guide pp 291 292 Windows SystemTimeTo TzSpecifiedLocalTime The SystemTimeToTzSpecificLocalTime function converts a Coordinated Universal Time UTC to a specified time zone s corresponding local time Jamie Frater s UseNet Post with UnixTimeToDateTime by code by Philippe Ranger showing use of SystemTimeToTzSpecifiedLocalTime Windows TCalendar Displays month calendar list box for entering selecting a date Palette Samples TDate TYPE TDate TYPE TDateTime Controls TDatePicker Functionality of the Delphi 3 TDateTimePicke r component but with enhanced capabilities and compatibility with Delphi 1 DatePicker ZIP with source by Michael Williams TDateTime TYPE TDateTime TYPE Double TDateTime is just a floating point Double The integer part of the value INT x is the number of days The fractional part FRAC x is a fractional part of a day 86400 FRAC x yields the number of seconds In Delphi 1 Delphi defined a TDateTime as the number of days that have passed since 1 1 0001 The fractional part represents a fractional part of a day In Delphi 2 and later the TDateTime represents the number of days since 30 December 1899 A TDateTime of 0 corresponds to 30 Dec 1899 a value of 1 is 31 Dec 1899 0 Jan 1900 A TDateTime can be any date through 31 Dec 9999 decimal value 2 958 465 You get the error invalid argument to date encode if you try EncodeDate 10000 1 1 TDateTime values can also be negative The decimal value 693593 which can be represented as EncodeDate 1 1 1 or DateDelta 1 corresponds to 1 Jan 0001 The DateDelta constant 693594 can be used to convert from D1 to post D1 TDateTime values A Matter of Time Exploring the TDateTime Object Delphi Informant Nov 1996 See Borland s TDateTime component commonly ignores key input FAQ 966D System TDateTimePicker TDateTimePicker is a wrapper around Microsoft s common control It uses the Windows date settings not Delphi s internal ShortDateFormat Displays a list box for entering dates or times Brian Bushay s UseNet Post about how to force the drop down calendar to open Dave Nottage s UseNet Post about how to force a TDateTimePicker to drop down programmatically See follow up comments by Frank Aluttis with an improved way to do this In D6 and later use the Format property to change display of date or time In D5 and earlier use the DateTime SetFormat call as shown next How to have 4 digit years or 24 hour clocks with a TDateTimePicker 4 Digit Year USES CommCtrl put this in the FormCreate 4 digit year for 3 y s Microsoft s idea not mine or 4 y s Example 3 13 2000 Use arrow keys to make selections field by field or use drop down calendar DateTime SetFormat DateTimePickerBirthDate Handle pChar M d yyy Example 13 Mar 2000 DateTime SetFormat DateTimePickerBirthDate Handle pChar d MMM yyyy Unclear how to format Today above to be 6 Mar 2000 Could display dates with DateMode of dmUpDown to suppress calendar 24 Hour Clock 24 hour clock Be sure to set Kind to dtkTime DateTime SetFormat DateTimePickerTest Handle pChar H mm ss Instead of using the DateTime SetFormat function you can send a message to the control directly SendMessage DateTimePicker1 Handle DTM SETFORMAT 0 DWORD pChar H mm ss Both Date and Clock in Single Control This appears to work DateTime SetFormat DateTimePickerTest Handle pChar d MMM yyyy H mm ss but you can only edit the date or the time depending on the Kind dtkTime or dtkDate Must a DateTimePicker always show a date Alan G Lloyd s UseNet Post about changing the format string to do this How can I display a blank date D6 Solution i mplementation USES CommCtrl To set format of TDateTimePicker DateTimePicker1 Format is set in IDE to quote quote procedure TForm1 DateTimePicker1Change Sender TObject begin DateTimePicker1 Format M d yyy end procedure TForm1 ButtonClearClick Sender TObject begin DateTimePicker1 Format end procedure TForm1 ButtonStatusClick Sender TObject begin IF DateTimePicker1 Format THEN ShowMessage Date is blank ELSE ShowMessage Date format is DateTimePicker1 Format end Similar D5 Solution for blank dates without using D6 Format property also works in D3 and D4 Date property isn t updated while the calendar is dropped down D4 and later Mark Reichert s UseNet Post about the OnChange handler for the TDateTimePicker control DT SelDate A Better TDateTimePicker www bhnet com br simonet tipstricks pickerex htm Vanyó Tamás UseNet Post with a TwoDBDateTimePicker to work as a TDBDateTimePicker Note about D3 bug with TabStop by Rick Rogers The following routines are from the CommCtrl unit not to be confused with ComCtrls Be sure to add a USES CommCtrl statement to use these functions These routines appear to be equivalents of C macros e g DateTime SetFormat is a C macro for the DTM SETFORMAT message function DateTime GetSystemTime hdp HWND var pst TSystemTime DWORD function DateTime SetSystemTime hdp HWND gd DWORD const pst TSystemTime BOOL function DateTime GetRange hdp HWND rgst PSystemTime DWORD function DateTime SetRange hdp HWND gdtr DWORD rgst PSystemTime BOOL function DateTime SetFormat hdp HWND sz PChar BOOL Format Characters from Microsoft Example also see the FormCreate in AgeCalculation TXT USES CommCtrl 4 digit year for 3 y s DateTime SetFormat DateTimePickerBirthDate Handle pChar M dd yyy DateTime SetFormat DateTimePickerTest Handle pChar H mm ss 24 hour clock function DateTime SetMonthCalColor hdp HWND iColor DWORD clr TColorRef TColorRef function DateTime GetMonthCalColor hdp HWND iColor DWORD TColorRef function DateTime GetMonthCal hdp HWND HWND procedure DateTime SetMonthCalFont hdp HWND hfont HFONT fRedraw BOOL function DateTime GetMonthCalFont hdp HWND HFONT Microsoft SDK information about Date and Time Picker Controls Date Picker Control Does Not Allow 4 Digit Year Input After 2035 http support microsoft com support kb articles q223 2 92 asp Formatting a DateTimePicker Control www undu com Articles 980707a html Enhancing the TDateTimePicker www undu com Articles 980714b html Palette Win32 Units ComCtrls CommCtrl TDateTimePickerLink Non visual Component that is linking two DateTimePicker controls If the value of the first DateTimePicker control is higher than the value of the second DateTimePicker control a message is shown and the changed value will be set to the value of the other DateTimePicker control http delphi icm edu pl ftp d50free dtplink zip TFileTime TYPE TFileTime RECORD dwLowDateTime DWORD dwHighDateTime DWORD END Number of 100 nanosecond intervals since January 1 1601 Typecast a TFileTime to an Int64 D4 or later to perform arithmetic Steve Schafer s UseNet Post about TFileTime to TDateTime See GetThreadTimes Delphi 5 Developer s Guide pp 291 292 Section TFileTime see above Peter Haas converting function use a lossless direct converting only a addition and a multiplication Windows ThisYear EncodeDate StrToInt FormatDateTime yyyy Now 1 1 Till Till Count Down Timer Time Time returns the current time Label1 Caption The time is TimeToStr Time SysUtils Time Zone information Time Travels Of Time Zones Daylight Savings and other Delights Delphi Informant Feb 2000 Time Zones Borland s Get a list of valid time zones from Windows FAQ 2700D Registry Keys HKEY LOCAL MACHINE System CurrentControlSet Control TimeZoneInformation HKEY LOCAL MACHINE SOFTWARE Microsoft Windows NT CurrentVersion Time Zones TimeAMString Windows definition of AM for given locale SysUtils TimeBeginPeriod TimeEndPeriod Sets clears the

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