Link to home
Start Free TrialLog in
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.
Avatar of btframework
btframework
Flag of Belarus image

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

ASKER

dear expert, thank you for your reply But,

 If I check that it is not running from Delphi IDE also,
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.
Thank You, for your suggestion,
but i am unable to decide by that also.

please give me any other solution.
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.
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?
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.
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

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?
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
Thank You for your Response
But
If I write ShowMessage in Project file it is giving error as "undeclared identifier : 'showmessage' "
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.... :-)
"Valid" is a Boolean type Variable, and it is changed in form3 create event.
Add in your uses section of project file
Dialogs
then ShowMesssge will work

It seems valid does not changed without IDE :)
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...
if I remove that condition and by simply writing the form creations then also it in not working.
rename your form3 to splashscreen...
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.
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.
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.
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
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?"
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
Avatar of btframework
btframework
Flag of Belarus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am using trial version,
any solution for this...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial