4

May I ask for some guidance please ?

Development machine – Windows 7  64bit
IDE – Delphi 7 pro (with 7.1 update)
Target machine for install – Windows XP (SP3) – NB this is the Win 7 Virtual Machine

I have built a small application, nothing more than a test app. A grid, a TADOConnection connected to an MS accdb file and a few TADOTables. Using Inno Setup I have also built an installer. I promise, it’s a very simple app.

When I install the ‘application’ on the XP virtual machine, everything goes according to plan, ie no error message and the installer completes. However, the application will not start. On the same XP VM, I have D7 installed and, here’s where it get’s weird, if the IDE is running, my application will launch without issue. If I close the IDE, it, my application, will fail to start again.

All I get is an hourglass for a second or two, and that’s it … no error message, no horrible MS dialog asking me if I want to send them info about this dreadful application, in fact I get no feedback whatsoever.

NB - Whether run from the IDE, or outside of the IDE, on the Win 7 machine, the application runs just fine.

I’m obviously missing something quite obvious, but I’m lost. I have even tried ….

program Project1;
uses
  Dialogs,
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}
begin
  Application.Initialize;
  ShowMessage('Starting');
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

But I do not get to see the ShowMessage dialog.

I have read the many ‘Hello World’ tutorials. Gleaned a great deal of knowledge from generous SO contributers (thank you). But there must be another tutorial that teaches me what to do in order to ‘prepare’ my application for inclusion in an installer. I thought that if I unchecked the ‘Build with runtime packages’ in Project Options and then did Project > Project Build, I could build a file with everything I needed to run the application outside of the IDE.

May I ask if anyone could point me to the last piece of the jigsaw, please ?

Incidentally, is there a way to debug an executable outside of the IDE ? Perhaps some switch within Delphi that would produce a log file when the application starts … or tries to.

Thanks for your time ?

Regards, John.

EDIT - I mentioned earlier that the file will run outside of the IDE on my W7 machine. I got this wrong ... it won't run unless D7 is up and running too. Also, I made a copy of the original folder with this file in and started messing with the Project Options switches. Suddenly, the new file is twice the size and runs OK. Problem ... I can't replicate whatever I changed on the original file / Project to know for certain what I have done is the cause / fix.

Edit 2 - OK - the issue definately has something to do with the different file sizes. I have created a folder on the XP volume and dropped a copy of all of my BPLs from the Output directory in Win 7 Delphi install. Dropped my exe (the file that will NOT run outside of the IDE) in there, and also my accdb file too. Double click and ... Hey Presto - it runs. the grid displays my sample data ... beautiful.

Here's the thing ... Project > Options > Packages > Build with Runtime Packages is UNchecked. This should build me a LARGE exe file - (is that correct) but it builds a relatively small exe that needs the BPL's !!!!

Will do some more testing ...

4

1 回答 1

0

您可能已在 ide 中连接了您的 tconnection。

这让您可以看到 IDE 中真实数据的情况,但是现在当您运行您的应用程序时,它会尝试在开始时立即连接,而当时可能还没有正确设置所有内容。

一种可能的解决方案:断开连接组件,并在稍后阶段连接,例如通过“连接”按钮。

至少正确处理这样的异常会更容易。

于 2012-08-06T00:03:21.390 回答