Avatar of inampudi1
inampudi1
 asked on

Delphi EXE is not running

       My delphi-7 application is running properly from code(Delphi-IDE), but it is not running if i double click directly on exe, Just it is blinking , I thought that it is opening and closing automatically.

please give the solution if any one knows.
DelphiPascal

Avatar of undefined
Last Comment
ChrisBerry

8/22/2022 - Mon
btframework

It may happen if there is some dlls missing. First, check
Project->Options->Packages->Build with runtime packages
is unchecked.
inampudi1

ASKER
dear expert, thank you for your reply But,

 If I check that it is not running from Delphi IDE also,
btframework

Add ShowMessage("LaLa") in main project file (between begin and end) before Application.CreateForm and check will it appear. Then add it after Application.Run and check again

Also add ShowMessage in main form OnCreate event handler.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
inampudi1

ASKER
Thank You, for your suggestion,
but i am unable to decide by that also.

please give me any other solution.
btframework

Does any one of ShowMessage appear? It is hard to say what can be wrong with your project becasue you gave too little info.
How many forms created on startup? What is in OnCreate and OnShow of those forms? Do you open some files wher your app starts? Database connections? It seems like unhandled exception raises when your app starts.
ChrisBerry

Does your code run from the exe if the IDE is running? Have you used any components that will only run if the IDE is running?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
senad

check your project options which one is the main form and the creation order of other components.You have a component that is getting created/displayed when it should not (before your main form) so that is why your mainform is blanked out.
this error is common when using datamodule.
inampudi1

ASKER
These are the answers i am providing to all Experts who raised the Queries.

Q : Does any one of ShowMessage appear?
A : Appearing like blink, means no user control. message boxes are coming closing without pressing OK button also

Q : How many forms created on startup?
A : i am creating one form and checking some parameters if needed i am continuing with application or else terminating this is the code  for project file
(*********************************************************)
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2},
  Unit3 in 'Unit3.pas' {Form3},
  uQueue in 'uQueue.pas',
  Unit4 in 'Unit4.pas' {Form4},
  uReportQueue in 'uReportQueue.pas',
  uReport in 'uReport.pas' {fReport},
  uDailyReport in 'uDailyReport.pas',
  uEffectReport in 'uEffectReport.pas';

{$R *.res}

begin

  Application.Initialize;
  Application.Title := 'XXXXXXXXXXX';
  Application.CreateForm(TForm3, Form3);
  if not valid then
  Begin
    Application.Terminate;
  End;
    Application.CreateForm(TForm1, Form1);
    Application.CreateForm(TForm2, Form2);
    Application.CreateForm(TForm4, Form4);
    Application.CreateForm(TfReport, fReport);

  Application.Run;
end.


(*******************************************************)

Q : Database connections?
A : No Database connections


Q : Does your code run from the exe if the IDE is running?
A : Yes EXE is running like same(Opening and closing) if Application is running from IDE also.



Q : Do you open some files wher your app starts?
A : Yes, I can

btframework

This code lines:
  if not valid then
  Begin
    Application.Terminate;
  End;
what is "valid" value? It seems like from outside IDE valid is false.

How do you open files? With AssignFile method? If yes, do files exist? Are paths to the files valid?
Your help has saved me hundreds of hours of internet surfing.
fblack61
btframework

Also,

rewrite your begin-end section like this:

  Application.Initialize;
  Application.Title := 'XXXXXXXXXXX';
  //Application.CreateForm(TForm3, Form3);
  if not valid then
   ShowMessage('Not valid')
    //Application.Terminate
  else begin
  ShowMessage('Valid')
    //Application.CreateForm(TForm1, Form1);
    //Application.CreateForm(TForm2, Form2);
    //Application.CreateForm(TForm4, Form4);
    //Application.CreateForm(TfReport, fReport);
    Application.Run;
  end;

then uncomment CreateForm one by one to find where is the problem
inampudi1

ASKER
Thank You for your Response
But
If I write ShowMessage in Project file it is giving error as "undeclared identifier : 'showmessage' "
senad

Yes, " if not valid then" crap is nonsense.
You do not check something that is to be created automatically.
If you want form out of compiler routine then set your form to list of "available" forms.
You either have it or you dont.... :-)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
inampudi1

ASKER
"Valid" is a Boolean type Variable, and it is changed in form3 create event.
btframework

Add in your uses section of project file
Dialogs
then ShowMesssge will work

It seems valid does not changed without IDE :)
senad

to run your form3 use something like they use in splash screen
(set form 3 to available forms) ...;

SplashScreen := TSplashScreen.Create(Application) ;
SplashScreen.Show;
Application.Initialize; //this line exists!
SplashScreen.Update;

After the final Application.Create() and before Application.Run statement add:
SplashScreen.Hide;
SplashScreen.Free;

your form then does whatever you want it to do and after it does it lets application run on...
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
inampudi1

ASKER
if I remove that condition and by simply writing the form creations then also it in not working.
senad

rename your form3 to splashscreen...
btframework

Well. I think it would be god to see Form3.Create source code. If you afraid about source code leaking you may contact me directly (MSN or e-mail) or lets try to use remote debuggin session (with TeamViewer). It is the case when it is very hard to say what may happen. It is like do madical diagnostic with using just a photo of patient.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
senad

You do not check for "creation" of forms in Delphi.
Application does that for you.
You just set which is the main one and creation orders.
It seems to me your mainform is Form1 and you are trying to create Form3 before it.
btframework

to senad

Actually if his Form3 is splash screen then it does not matter. I think the problem is in Valid variable which may set up after some checks. The check may failed if something wrong with path.

And of course, it may run different from IDE because debugger.
inampudi1

ASKER
hi experts,
  I am using ProfGrid Version 3.4.4.8 for Delphi7. After struggling a lot I found that because of ProfGrid my application is not running from EXE (but running from Delphi Code). Please find the attachment for sample code.

Please remove the file extension "txt" from  the attached zip achieve.

                 Thank You.
Profgrid-test.zip
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
btframework

But that was asked by ChrisBerry

"Does your code run from the exe if the IDE is running? Have you used any components that will only run if the IDE is running?"
inampudi1

ASKER
These are the answers for your queries,

Q : Does your code run from the exe if the IDE is running?
A : Not Working.

Q : Have you used any components that will only run if the IDE is running?
A : I dont know really about that type of components.
ASKER CERTIFIED SOLUTION
btframework

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
ChrisBerry

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
inampudi1

ASKER
I am using trial version,
any solution for this...
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
ChrisBerry

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.