• Total Source Code: 126
  • Latest Update Code: Feb 22' 14
  • Total Page : 13
  • You currently on page number : 1

Activating the Start Menu by Code

  • 2014-02-22
  • 142
  • menu,activating

Just code this event handler (in this example, a button click): procedure TForm1.Button1Click(Sender: TObject); begin SendMessage(Self.Handle, WM_SYSCOMMAND, SC_TASKLIST, Readmore

Disable the Close X button on a Form

  • 2014-02-22
  • 169
  • disable,close,button

Source code for hide close button from a from procedure TFMain.FormCreate(Sender: TObject); var hMenuHandle: Integer; begin hMenuHandle := GetSystemMenu(Handle, False); if (hMenuHandle 0) then DeleteMenu(hMenuHandle, SC_CLOSE, Readmore

Coloring Cells in a StringGrid

  • 2014-02-22
  • 179
  • color,stringgrid,cell

The Source Code procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); Const //define your color here. Of course you //can use default colors too. clPaleGreen = TColor($CCFFCC); clPaleRed = TColor($CCCCFF); begin //Does the cell have the focus you have to paint it with other colors if (gdFocused in Readmore

Coloring Cells in a DBGrid

  • 2014-02-22
  • 181
  • color,stringgrid,cell

It's much easier to give color to DBGrids. Here you have to use the "OnDrawColumnCell"-Event. The following example is coloring the Cells of Column "Status" when the value is not "a". If you want to color the whole line you only have to delete the "If..." statement (see below) procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; Readmore

Define binary type

  • 2014-02-22
  • 216
  • define,binary,type

Source one   function GetEXEType(FileName: string): string; var BinaryType: DWORD; begin if GetBinaryType(PChar(FileName), Binarytype) then case BinaryType of SCS_32BIT_BINARY: Result := 'Win32 executable'; SCS_DOS_BINARY: Result := 'DOS executable'; SCS_WOW_BINARY: Result := 'Win16 executable'; SCS_PIF_BINARY: Result := 'PIF file'; Readmore

Check two files are equal

  • 2014-02-22
  • 276
  • check,equal,files

Source one   function Are2FilesEqual(const File1, File2: TFileName): Boolean; var ms1, ms2: TMemoryStream; begin Result := False; ms1 := TMemoryStream.Create; try ms1.LoadFromFile(File1); ms2 := TMemoryStream.Create; try ms2.LoadFromFile(File2); if ms1.Size = ms2.Size then Result := CompareMem(ms1.Memory, ms2.memory, ms1.Size); Readmore

Read Record Using AdoQuery with Condition

  • 2014-02-20
  • 226
  • adoquery,record count

Cnt: integer; try AdoQuery1.Sql.Text := 'SELECT * FROM TABLE_NAME'; Cnt := AdoQuery1.ExecSql; if Cnt = 1 then //only one record else if Cnt > 1 then //more 1 records else //exception from condition except //handle exception end; Readmore

Change Current Language

  • 2014-02-19
  • 152
  • change,language,current

To change current language, use LoadKeyboardLayout function.For example, first parameter 0x0407 is German (standard), 0x0409 is English (U.S.). procedure TForm1.Button1Click(Sender: TObject); begin LoadKeyboardLayout('00000407', Readmore

highlight HTML Tags in TRichEdit

  • 2014-02-19
  • 133
  • higthlight,tag,html

This sample code to highlight HTML tags in TRichEdit     procedure HTMLSyntax(RichEdit: TRichEdit; TextCol, TagCol, DopCol: TColor); var i, iDop: Integer; s: string; Col: TColor; isTag, isDop: Boolean; begin iDop := 0; isDop := False; isTag := False; Col := TextCol; RichEdit.SetFocus; for i := 0 to Length(RichEdit.Text) do begin RichEdit.SelStart Readmore

Displaying Indonesian Day of Week

  • 2014-02-19
  • 231
  • date,indonesian,week

Eg, displaying like this : "Tanggal 25/11/2006 adalah hari Sabtu" (in English: Day of week of 25/11/2006 is Saturday), this You can use combination of "DayOfWeek" function with your own dayOfWeek array of String unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls; type TForm1 = class(TForm) Readmore