Tuesday, April 17, 2012

Speed up Delphi 7 loading time

My Delphi 7 loading time is so slow, about 1.30 minute. I know that's to slow, but i am using netbook with AMD E-350 processor. Googling around how to speed it up, and found this wonderful app that can speed up Delphi 7 loading time. And now i can get into my delphi for only 25 seconds!!! wow...  I love this apps.... It's called DelphiSpeedUp 3.1. and it's free, You should check it out. And compiling time is faster too, once my compile time it's about 25 seconds and now after installing it, it took only 16 seconds.

Sunday, April 15, 2012

Fix Illegal character in input file when installing JEDI 3.45

Fix Illegal character in input file when installing JEDI 3.45 for Delphi 7.

Error Messages :
jvcl\run\JvPageSetup.pas(1) Error: Illegal character in input file: 'ï' ($EF)
JvDlgs.dpk(86) Fatal: Could not compile used unit '..\..\run\JvPageSetup.pas'

jvcl\run\JvDialogs.pas(1) Error: Illegal character in input file: 'ï' ($EF)
JvDlgs.dpk(86) Fatal: Could not compile used unit '..\..\run\JvDialogs.pas'

How to fix :
Open the JvPageSetup.pas and JvDialogs.pas using Notepad++



and change the encoding from UTF-8 into ANSI for both files, save them. And run the install.bat again. Now your installation won't give any error message and successful.

Fix Delphi 7 WinHelp

When you are installing Delphi 7 on Windows 7, the Help system inside Delphi 7 is not working. And this is the solution to fix it.

1. Go to Microsoft website to get the MS Update Fix.
here is the MS Update Fix for Winhelp


2. Download the update, and run it, start Delphi 7, and voila the Delphi 7 Help system is working now...


Installing Delphi 7 on Windows 7

If you still love to developing with Delphi 7 and you're using Windows 7. Here's the tricks on how to install it.

1. Make sure you run the install.exe as Administrator.
2. Ignore the compatibility issue and run the program.
3. Install Delphi 7, by click on it.
4. After installation finishes, don't run Delphi yet.
    Because it will pop an error message like this. And it will pop the error message whenever you want to start a new application.
5. Now go to C:\Program Files (x86)\Borland\ (assuming you are using Win7 64bit)
    And right click on Delphi 7 Folder, choose Properties. Uncheck Read-only Checkbox and click apply.
6. Next, click the Security Tab, click on Users, and click Edit button to change the permission for user to allow full access...
    check the Full Control and Modify checkbox, and click the Apply button.

7. Click OK button, to close it. And you can run the Delphi 7.
    If Delphi 7 still pop up the Incompatibility Issue message, Just click the Don't show this message again checkbox and run the program.


The installation of Delphi 7 is now finished.

If you are having trouble of using Delphi 7 Winhelp. Please read next solution to fix delphi 7 help system.

Thursday, April 12, 2012

Hide flickering MDI Child Creation

// To hide annoying flickering MDI Child creation

  try
    SendMessage(Application.MainForm.ClientHandle,WM_SETREDRAW,0,0);
    FormChild:=TBaseChildForm.Create(application);
    FormChild.Caption:='Form '+IntToStr(n);
    FormChild.Show;
  finally
    SendMessage(Application.MainForm.ClientHandle,WM_SETREDRAW,1,0);
    RedrawWindow(Application.MainForm.ClientHandle, nil, 0, RDW_FRAME or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_NOINTERNALPAINT);
  end;

Sunday, April 8, 2012

Parse String with Delimiter into String List

// Parse String with Delimiter into String List

// Screenshot of running sample application

procedure TForm1.btnParseClick(Sender: TObject);
begin
  ParseDelimited(Memo1.lines, edit1.text, edit2.text);
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
  edit3.Text:=Edit1.Text+Edit2.Text;
end;

procedure TForm1.ParseDelimited(const sl: TStrings; const value:string,
  delimiter: string);
// Originally from : http://delphi.about.com/od/adptips2005/qt/parsedelimited.htm
// Tweak a bit by me, to be more understand  to read
// to use it in your own program don't forget to remove all "memo2.lines" Lines.
var
   nPosDeli : integer;
   sGet : string;
   sProcess : string;
   nLenDeli : integer;
begin
   nLenDeli := Length(delimiter) ;
   sProcess := value + delimiter;
   sl.BeginUpdate;
   sl.Clear;
   memo2.lines.clear;
   try
     while Length(sProcess) > 0 do
     begin
       memo2.Lines.Add('[sProcess]                                        : '+sProcess);
       memo2.Lines.Add('Length(sProcess)                                  : '+IntToStr(Length(sProcess)));
       nPosDeli := Pos(delimiter, sProcess) ;
       memo2.Lines.Add('Pos(delimiter, sProcess) [nPosDeli]               : '+IntToStr(nPosDeli));
       sGet := Copy(sProcess,0,nPosDeli-1) ;
       memo2.Lines.Add('Copy(sProcess,0,nPosDeli-1) [sGet]                : '+sGet);
       sl.Add(sGet) ;
       sProcess := Copy(sProcess,nPosDeli+nLenDeli,MaxInt) ;
       memo2.Lines.Add('Copy(sProcess,nPosDeli+nLenDeli,MaxInt) [sProcess]: '+sProcess);
       memo2.Lines.Add(' ');
     end;
   finally
     sl.EndUpdate;
   end;
end;

Sunday, April 1, 2012

Put Application on Windows Startup

{You can Drag and Drop your Application to Windows Startup Group to make it start automatically whenever Windows Startup. Or you can programmatically put it in code using Delphi.}

// *********************************************** //
procedure RunOnStartup(sProgTitle : string;
    sCmdLine: string;
    bRunOnce: boolean;
    bRemove: boolean) ;
// *********************************************** //    
 var
   sKey: string;
   Section: string;

 begin
   if (bRunOnce) then
     sKey := 'Once'
   else
     sKey := '';

   Section := 'Software\Microsoft\Windows\CurrentVersion\Run' + sKey + #0;

   with TRegIniFile.Create('') do
     try
       RootKey := HKEY_LOCAL_MACHINE;
       if bRemove then
         DeleteKey(Section, sProgTitle)
       else
         WriteString(Section, sProgTitle, sCmdLine) ;
     finally
       Free;
     end;
 end;

 {
Parameter Description:
    sProgTitle:
        Name of your program.
    sCmdLine:
        This is the full path name to your program.
    bRunOnce:
        True to run the application once, such as intalling first time application.
        False to run the application everytime windows startup.
    bRemove:
        True to remove startup key.

How to use:
RunOnStartup(
    'MyCalculator',
    'My Own Calculator',
    'MyCalc.exe',
    False );
}