Tim has the correct answer, but you may need a little more scope:
procedure TForm56.Button1Click(Sender: TObject); begin if fNeedReinit then ReinitializeDatabase; end; procedure TForm56.FormCreate(Sender: TObject); begin fNeedReinit := False; end; procedure TForm56.FormShow(Sender: TObject); begin fNeedReinit := (GetKeyState(VK_SHIFT) < 0) and (GetKeyState(VK_CONTROL) < 0); end;
Change Button1 Click your later event, which checks if fNeedReinit is installed. You can also install KeyPreview in your main form if you have problems catching it. I just tested the above code and it works, but if you have a splash screen, etc., this can make a difference.
source share