Discussion:
setup file with Innosetup - additional problem
(too old to reply)
Thomas Willms
2008-01-02 10:31:34 UTC
Permalink
Hello,
Files are searched in subfolders because I put them there to get them compiled. How can I create the subfolders on the target drive ?
Also there is another problem.
Delphi tells me that the given mdb files are not under "document& settings/user/". Why is it searching there ? I never put this path.
How resolve this problem ?

Thanks

Thomas Willms
MikeR
2008-01-02 13:38:10 UTC
Permalink
Post by Thomas Willms
Hello,
Files are searched in subfolders because I put them there to get them compiled. How can I create the subfolders on the target drive ?
Are you using ISTool? Its wizards can go a long way toward making this a lot easier.
To create a subfolder - DestDir: {app}\MyFolderName;
The Inno newsgroups are very active, check them out. The Inno archives also contain
a wealth of material.
Post by Thomas Willms
Also there is another problem.
Delphi tells me that the given mdb files are not under "document& settings/user/". Why is it searching there ? I never put this path.
How resolve this problem ?
Not clear what you mean by "Delphi tells me ....." When you run the app? During
compile time? My guess is that you're getting that message because the given mdb
files are not under 'documents & settings/user/'.
So where are they? Probably should be under one of the appdata constants. NEVER hard
code an install path.
What is the target OS? Show your script line(s) that install the mdbs.
Mike
Thomas Willms
2008-01-03 19:29:56 UTC
Permalink
Hello,
Ok creating the folder works... there is still the other one...

very strange:
compiling the script works, even starting directly afterwards the project to install it.
but...

starting the programm after installation there is a message:

"document& settings/user/ abcd.mdb not found"


Source: TED1local\KopieTheredaPriv.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\Thereda.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\TheredaPrivate.mdb; DestDir: {app}; Flags: ignoreversion


So "source" and "destination" are ok. How is it possible that the installed program searches in the subfolder document and settings ? Why does it work, if I am just compiling the script and launching the program directly after compilation?
Something to do with windows ???

If I want to copy it in the folder where it searches , so on a hard disk C : , D: or else how search the (corresponding) user folder ?
How to handle different names of this folders (user, proprietaire, ???) in an english french or german version ?


Thanks very much

Thomas Willms


PS: Thanks for the idea with ISTools. I did not look in the newsgroups yet ...but I will do it..
Post by MikeR
Hello,Files are searched in subfolders because I put them there to get them compiled. How can I create the subfolders on the target drive ? Are you using ISTool? Its wizards can go a long way toward making this a lot easier.
To create a subfolder - DestDir: {app}\MyFolderName;
The Inno newsgroups are very active, check them out. The Inno archives also contain a wealth of material.
Also there is another problem.
Delphi tells me that the given mdb files are not under "document& settings/user/". Why is it searching there ? I never put this path. How resolve this problem ?
Not clear what you mean by "Delphi tells me ....." When you run the app? During compile time? My guess is that you're getting that message because the given mdb
files are not under 'documents & settings/user/'.
So where are they? Probably should be under one of the appdata constants. NEVER hard
code an install path.
What is the target OS? Show your script line(s) that install the mdbs.
Mike
MikeR
2008-01-04 14:13:35 UTC
Permalink
Post by Thomas Willms
"document& settings/user/ abcd.mdb not found"
Source: TED1local\KopieTheredaPriv.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\Thereda.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\TheredaPrivate.mdb; DestDir: {app}; Flags: ignoreversion
So "source" and "destination" are ok. How is it possible that the installed
program searches in the subfolder document and settings ? Why does it work, if
I am just compiling the script and launching the program directly after compilation?
Post by Thomas Willms
Something to do with windows ???
Well obviously destination is not OK (it doesn't agree with where your app is
looking), and I could make a case that source may not be. Again, where does abcd.mdb
install to? You are telling it to install the .mdbs into the {app} directory. That
probably should not equate to "document& settings/user/".

Files which you write to should not be put under "Program Files" (wherever that
evaluates to on the target system).

What is the connection string in your application? That's what tells where it's
searching.
Post by Thomas Willms
If I want to copy it in the folder where it searches , so on a hard disk C : , D: or else how search the (corresponding) user folder ?
How to handle different names of this folders (user, proprietaire, ???) in an english french or german version ?
Use the Inno constants {like {commonappdata} or {userappdata}) for them. See the help
file for definitions.
Thomas Willms
2008-01-04 19:14:00 UTC
Permalink
Hello,

Innoset up proposes for the {app } directory the name of the
application. So the directory for which {app } stands is the one proposed by the installer and accepted by the user.

if {userappdata} corresponds to the directory "document& settings/user/ " then there might be a problem with this.
Otherwise what is the term corresponding to this ?

After having resolved some other problems with my second problem I have now the same problem in both cases.
So it is important to me to understand this.
Nevertheless these files should be copied to the directory of the application. If not there must be somewhere an option which makes that mdb files are copied elsewhere... all others in the right one.

Thanks

Thomas Willms

PS: ISTools indicates no problem. destination directory is the same as for the project file.
Post by Thomas Willms
Post by Thomas Willms
"document& settings/user/ abcd.mdb not found"
Source: TED1local\KopieTheredaPriv.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\Thereda.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\TheredaPrivate.mdb; DestDir: {app}; Flags: ignoreversion
So "source" and "destination" are ok. How is it possible that the installed
program searches in the subfolder document and settings ? Why does it work, if
I am just compiling the script and launching the program directly after compilation?
Post by Thomas Willms
Something to do with windows ???
Well obviously destination is not OK (it doesn't agree with where your app is
looking), and I could make a case that source may not be. Again, where does abcd.mdb
install to? You are telling it to install the .mdbs into the {app} directory. That
probably should not equate to "document& settings/user/".
Files which you write to should not be put under "Program Files" (wherever that
evaluates to on the target system).
What is the connection string in your application? That's what tells where it's
searching.
Post by Thomas Willms
If I want to copy it in the folder where it searches , so on a hard disk C : , D: or else how search the (corresponding) user folder ?
How to handle different names of this folders (user, proprietaire, ???) in an english french or german version ?
Use the Inno constants {like {commonappdata} or {userappdata}) for them. See the help
file for definitions.
MikeR
2008-01-04 23:30:23 UTC
Permalink
Post by Thomas Willms
Hello,
Innoset up proposes for the {app } directory the name of the
application. So the directory for which {app } stands is the one proposed by the installer and accepted by the user.
OK. That's as it should be. The application and any *READ ONLY* files go there.
Post by Thomas Willms
if {userappdata} corresponds to the directory "document& settings/user/ " then there might be a problem with this.
Otherwise what is the term corresponding to this ?
That is the directory that {userappdata} resolves to on English language versions of
Windows. What exactly is the problem with this?
Post by Thomas Willms
After having resolved some other problems with my second problem I have now the same problem in both cases.
So it is important to me to understand this.
Nevertheless these files should be copied to the directory of the application. If not there must be somewhere an option which makes that mdb files are copied elsewhere... all others in the right one.
I'm a bit confused. The only issue I have been addressing has been the correct
placement of the mdb files. It there is another problem, I missed it.
If you are talking about your database (mdb) files then no, they should *NOT* be
copied to the {app} directory, unless that resolves to "document& settings/user/ ",
or one of the other data directories.

You indicated in previous posts that your application was looking for them in
"document& settings/user/", and that would be the correct place, if your app is
installed on a per user basis.

You still have not answered my question about where the install is actually putting
the files, and where your connection string is looking for them. I need for you to
answer this, and tell me clearly why you are so adamant about putting your mdb files
in the wrong place?

This link explains some of the considerations of file placement.
http://www.jrsoftware.org/iskb.php?cantwritetoapp

It has been a rule in Windows since maybe NT4 that writable files should not be
placed under "Program files/" . We've gotten away with it because so many users are
administrators. Vista is a real stickler about it though. If you do it wrong, you'll
get support calls.
Post by Thomas Willms
PS: ISTools indicates no problem. destination directory is the same as for the project file.
I wouldn't expect it to report a problem, it's valid syntax. Delphi doesn't report
logic errors either. It expects you to know what you're doing. <vbg>
Thomas Willms
2008-01-05 11:36:04 UTC
Permalink
Hello,

it seems that you know well this subject, it is my very first compilation....
Post by MikeR
Innoset up proposes for the {app } directory the name of the application. So the directory for which {app } stands is the one proposed by the installer and accepted by the user.
OK. That's as it should be. The application and any *READ ONLY* files go there.
I didn't know this convention.
Post by MikeR
if {userappdata} corresponds to the directory "document& settings/user/ " then there might be a problem with this.
Otherwise what is the term corresponding to this ?
That is the directory that {userappdata} resolves to on English language versions of Windows. What exactly is the problem with this?
The problem is that the path of the databank in my application is the same as for the application, so databank operations which are essential are not possible.
I would not really like to put my files there. But, when I accept it how must I write the line ? Like this ?

Source: TRechner-Test5\tabellen.mdb; DestDir: {userappdata}; Flags: ignoreversion
Post by MikeR
I'm a bit confused. The only issue I have been addressing has been the correct placement of the mdb files. It there is another problem, I missed it.
before, my program didn't start because of an issue with the bde now I use ADO and it works perect now.
Post by MikeR
If you are talking about your database (mdb) files then no, they should *NOT* be copied to the {app} directory, unless that resolves to "document& settings/user/ ",
or one of the other data directories.
You indicated in previous posts that your application was looking for them in "document& settings/user/", and that would be the correct place, if your app is installed on a per user basis. You still have not answered my question about where the install is actually putting the files, and where your connection string is looking for them. I need for you to
answer this, and tell me clearly why you are so adamant about putting your mdb files in the wrong place?
Before I copied the mdb files to {app}
That is were is pointing the connectionstring.

If it is not in {app} how construct the connectionstring ???
I cannot put "C:\document and settings\user"
in the connection string.
It might be D: or else.
also, it might be a frensh or german version of windows....
Post by MikeR
This link explains some of the considerations of file placement.
http://www.jrsoftware.org/iskb.php?cantwritetoapp
It has been a rule in Windows since maybe NT4 that writable files should not be placed under "Program files/" . We've gotten away with it because so many users are administrators. Vista is a real stickler about it though. If you do it wrong, you'll get support calls.
Clearer now ?

Thanks

Thomas
MikeR
2008-01-05 13:28:20 UTC
Permalink
Post by Thomas Willms
Hello,
it seems that you know well this subject, it is my very first compilation....
I've used it a while. There is a learning curve, and the documentation becomes more
useful as you learn.
Post by Thomas Willms
The problem is that the path of the databank in my application is the same as for the application, so databank operations which are essential are not possible.
I would not really like to put my files there. But, when I accept it how must I write the line ? Like this ?
Source: TRechner-Test5\tabellen.mdb; DestDir: {userappdata}; Flags: ignoreversion
Yes.
Post by Thomas Willms
Before I copied the mdb files to {app}
That is were is pointing the connectionstring.
If it is not in {app} how construct the connectionstring ???
I cannot put "C:\document and settings\user"
in the connection string.
It might be D: or else.
also, it might be a frensh or german version of windows....
I do it this way. WritePath is a string property.
Add shfolder to your uses clause. Look in the shfolder unit for all the constants
like CSIDL_COMMON_APPDATA.

WritePath := GetFolder(CSIDL_COMMON_APPDATA, True);

function TfrmMyApp.GetFolder(ID: Cardinal; Create: Boolean): string;
var
Res: HResult;
Path: array[0..Max_Path] of Char;
const
shgfp_Type_Current: cardinal = $0;
begin
if Create then ID := ID or csidl_Flag_Create;
Res := ShGetFolderPath(0, ID, 0, shgfp_Type_Current, @Path[0]);
Result := Path + '\MyFolder\';
if S_OK <> Res then
raise Exception.Create('Could not determine folder path');
end;
Post by Thomas Willms
Clearer now ?
Yes.
Thomas Willms
2008-01-13 13:37:19 UTC
Permalink
Hello,
I tried it nearly as you said.
I determined with shfolder and constant CSIDL_COMMON_Documents the folder where my databases should be needed. I copied the databases mdb in this folder. Then I construct with the same path string the connectionstring.
At design conditions it worked (winxP Pro). But when I tried to install it on another computer with winXP home, it didn't.
During installation I got a message: 'C:\Program files\TED\DBFiles\thereda.mdb' not found !!!
(where "TED" is the application directory, "DBfiles" a directory that I used before but even not in this compiled Innoset up script and only in the original delphi code, and "thereda.mdb" the database)
Where, except in the string, it is written where to search for the database ?
Might it be in the ACCESS File (options/General ?: I changed it but it did not change anything)
So last time it was in "Document and Settings" now it searches in "Program files/TED/DBFiles/", a folder which does not exist .... I had this problem before... seems that the constant is not constantly the same ???

When I used winXP pro, fiels are copied in "Document and settings/all users", under windows XP home they are copied in "Document and settings/all users/shared documents"

And the program searches nearly each time I change something / the system at another place, even not in the special folder.
Where is it specified ? I have to read out this path and/ or create my own folder. How can I create a folder by the way in Delphi?
This letter action would also be interesting if it is possible to evaluate the error "database" not found with the path. Best would probably extract the path from the windows message and copy files to this place. How can I do this ?


I also found the problem that the

Thanks very much.

Thomas Willms

PS: I would nearly like to create a simplified extra version of my program to you to get rid of this problem .... and send it by mail. The code I used is :



function GetFolder(ID: Cardinal; Create: Boolean): string;
var Res: HResult;
Path: array[0..Max_Path] of Char;
const
shgfp_Type_Current: cardinal = $0;
begin
if Create then ID := ID or csidl_Flag_Create;
Res := ShGetFolderPath(0, ID, 0, shgfp_Type_Current, @Path[0]);
Result := Path ; /// '\MyFolder\'Welcher Name ist das ?
if S_OK <> Res then
raise Exception.Create('Could not determine folder path');
end;

procedure mdbfilelocation(verzE,WRITEpATH1 : STRING);
var filesource,filedest : string;
begin
fileSource := verze + '\Thereda.mdb';fileDest := WritePath1 +'\'+ 'Thereda.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
fileSource := verze + '\Theredaprivate.mdb';fileDest := WritePath1 +'\'+ 'Theredaprivate.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
fileSource := verze + '\KopieTheredapriv.mdb';fileDest := WritePath1 + '\'+ 'KopieTheredapriv.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
end;

procedure ADOConnectTest(cst1,cst2,cst3 : widestring;resultC : boolean);
begin
resultC :=true;
try Form1.adoConnection1.connected := false;Form1.adoConnection1.connectionstring := cst1;
Form1.adoConnection1.connected :=true;
Form1.ADOConnection2.GetTableNames(Form1.ListBox3.Items, False);
Form1.adoConnection2.connected := false;Form1.adoConnection2.connectionstring := cst2;
Form1.adoConnection2.connected :=true; Form1.adoConnection3.connected := false;
Form1.adoConnection3.connectionstring := cst3;
Form1.adoConnection3.connected :=true;
except resultC :=false; end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var Dateiname,error1,m ,w,writepath,filesource,filedest : string; cs1,cs2,cs3: widestring;
option1,i,Feldnamenzahl : integer;ok : boolean;
begin
Sendergruppe := 'Nichts'; IDZahl:=0; IDAnfang:=0;
TabbedNB1.PageIndex := 0; Listbox2.Items.Clear;Listbox3.Items.Clear;
verz := extractFilepath(ParamStr(0));Form1.ListBox3.Clear;
WritePath := GetFolder( CSIDL_COMMON_DOCUMENTS, True);
mdbfilelocation(verz,WRITEpATH);
cs1 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\Thereda.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';
cs2 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\Theredaprivate.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';
cs3 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\KopieTheredapriv.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';

//Showmessage('Bitte notieren Sie sich das folgende Verzeichnis in dem die Thereda-Datenbankdateien gesucht werden !');
ADOConnectTest(cs1,cs2,cs3,ok);
if OK = true then
begin
Showmessage('Die Thereda-Datenbankdateien befinden sich in: ' + writepath);
end //WritePath := '.\Theredaprivate.mdb'; //Showmessage('Die Thereda-Datenbankdateien befinden sich in: ' + writepath);
else begin
//writepath := inputbox('Geben Sie den notierten Pfad ein: ','Datenbank','');
mdbfilelocation(verz,WRITEpATH);
cs1 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\Thereda.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';
cs2 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\Theredaprivate.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';
cs3 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\KopieTheredapriv.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';

ADOConnectTest(cs1,cs2,cs3,ok);
end;
end;

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
AppName=TED
AppVerName=TED1.0
AppPublisher=GRS, Inc.
AppPublisherURL=http://www.thereda.de
AppSupportURL=http://www.thereda.de
AppUpdatesURL=http://www.thereda.de
DefaultDirName={pf}\TED
DefaultGroupName=TED
OutputDir=G:\compiled\TEDEXE\exe
OutputBaseFilename=setup
Compression=lzma
SolidCompression=true
DirExistsWarning=yes

[Languages]
Name: english; MessagesFile: compiler:Default.isl
Name: french; MessagesFile: compiler:Languages\French.isl
Name: german; MessagesFile: compiler:Languages\German.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: TED1local\Project1.exe; DestDir: {app}; Flags: ignoreversion

Source: TED1local\KopieTheredaPriv.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\Thereda.mdb; DestDir: {app}; Flags: ignoreversion
Source: TED1local\TheredaPrivate.mdb; DestDir: {app}; Flags: ignoreversion

Source: files\rtl90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\adortl90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\dbrtl90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\bdertl90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\vcl90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\vcldb90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\vclx90.bpl; DestDir: {app}; Flags: ignoreversion
;Source: files\vclib90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\vcljpg90.bpl; DestDir: {app}; Flags: ignoreversion
Source: files\tmsd2005.bdsgroup; DestDir: {app}; Flags: ignoreversion
Source: files\tmsded2005.bdsproj; DestDir: {app}; Flags: ignoreversion

Source: TED1local\TOLOAD\aqPhase1.dat; DestDir: {app}\TOLOAD\; Flags: ignoreversion
Source: TED1local\TOLOAD\Phase1.dat; DestDir: {app}\TOLOAD\; Flags: ignoreversion

Source: TED1local\TheredaADO.dsn; DestDir: {app}; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\TED; Filename: {app}\Project1.exe
Name: {group}\{cm:UninstallProgram,TED}; Filename: {uninstallexe}
Name: {commondesktop}\TED; Filename: {app}\Project1.exe; Tasks: desktopicon

[Run]
Filename: {app}\Project1.exe; Description: {cm:LaunchProgram,TED}; Flags: nowait postinstall skipifsilent
[_ISTool]
UseAbsolutePaths=true
Post by MikeR
Post by Thomas Willms
The problem is that the path of the databank in my application is the same as for the application, so databank operations which are essential are not possible.
I would not really like to put my files there. But, when I accept it how must I write the line ? Like this ?
Source: TRechner-Test5\tabellen.mdb; DestDir: {userappdata}; Flags: ignoreversion
Yes.
Post by Thomas Willms
Before I copied the mdb files to {app}
That is were is pointing the connectionstring.
If it is not in {app} how construct the connectionstring ???
I cannot put "C:\document and settings\user"
in the connection string. It might be D: or else.
also, it might be a frensh or german version of windows....
I do it this way. WritePath is a string property.
Add shfolder to your uses clause. Look in the shfolder unit for all the constants like CSIDL_COMMON_APPDATA.
WritePath := GetFolder(CSIDL_COMMON_APPDATA, True);
function TfrmMyApp.GetFolder(ID: Cardinal; Create: Boolean): string;
var Res: HResult;
Path: array[0..Max_Path] of Char;
const
shgfp_Type_Current: cardinal = $0;
begin
if Create then ID := ID or csidl_Flag_Create;
Result := Path + '\MyFolder\';
if S_OK <> Res then
raise Exception.Create('Could not determine folder path');
end;
MikeR
2008-01-14 15:09:16 UTC
Permalink
Post by Thomas Willms
Hello,
I tried it nearly as you said.
Nearly? Why not exactly?
Post by Thomas Willms
I determined with shfolder and constant CSIDL_COMMON_Documents the folder where my databases should be needed. I copied the databases mdb in this folder. Then I construct with the same path string the connectionstring.
For right now, lets use CSIDL_COMMON_APPDATA instead.
Post by Thomas Willms
At design conditions it worked (winxP Pro). But when I tried to install it on another computer with winXP home, it didn't.
During installation I got a message: 'C:\Program files\TED\DBFiles\thereda.mdb' not found !!!
(where "TED" is the application directory, "DBfiles" a directory that I used before but even not in this compiled Innoset up script and only in the original delphi code, and "thereda.mdb" the database)
Where, except in the string, it is written where to search for the database ?
Nowhere.
Post by Thomas Willms
Might it be in the ACCESS File (options/General ?: I changed it but it did not change anything)
What options? Where? This is a database file, isn't it?
Post by Thomas Willms
So last time it was in "Document and Settings" now it searches in "Program files/TED/DBFiles/", a folder which does not exist .... I had this problem before... seems that the constant is not constantly the same ???
When I used winXP pro, fiels are copied in "Document and settings/all users", under windows XP home they are copied in "Document and settings/all users/shared documents"
Why are you copying the file at all? Why not just have Inno install it where needed?
Post by Thomas Willms
And the program searches nearly each time I change something / the system at another place, even not in the special folder.
Where is it specified ? I have to read out this path and/ or create my own folder. How can I create a folder by the way in Delphi?
This letter action would also be interesting if it is possible to evaluate the error "database" not found with the path. Best would probably extract the path from the windows message and copy files to this place. How can I do this ?
I don't know how to get the path from the error message, but please DON'T try to copy
the file there! You need to use the other stuff I gave you correctly. If you put the
file in a known place, and then look there, the file WILL be there. I'm going to put
some comments inline with your code. Humor me and do them *EXACTLY*. <g>
OK, you can send it to me by mail. Take the obvious out of my email address.
Post by Thomas Willms
function GetFolder(ID: Cardinal; Create: Boolean): string;
var Res: HResult;
Path: array[0..Max_Path] of Char;
const
shgfp_Type_Current: cardinal = $0;
begin
if Create then ID := ID or csidl_Flag_Create;
Result := Path ; /// '\MyFolder\'Welcher Name ist das ?
if S_OK <> Res then
raise Exception.Create('Could not determine folder path');
end;
procedure mdbfilelocation(verzE,WRITEpATH1 : STRING);
var filesource,filedest : string;
begin
fileSource := verze + '\Thereda.mdb';fileDest := WritePath1 +'\'+ 'Thereda.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
fileSource := verze + '\Theredaprivate.mdb';fileDest := WritePath1 +'\'+ 'Theredaprivate.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
fileSource := verze + '\KopieTheredapriv.mdb';fileDest := WritePath1 + '\'+ 'KopieTheredapriv.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
end;
procedure ADOConnectTest(cst1,cst2,cst3 : widestring;resultC : boolean);
begin
resultC :=true;
try Form1.adoConnection1.connected := false;
Form1.adoConnection1.connectionstring := cst1;
Put a breakpoint here. Examine the contents of 'cst1'. Tell me what it is.
Post by Thomas Willms
Form1.adoConnection1.connected :=true;
Form1.ADOConnection2.GetTableNames(Form1.ListBox3.Items, False);
Form1.adoConnection2.connected := false;Form1.adoConnection2.connectionstring := cst2;
Form1.adoConnection2.connected :=true; Form1.adoConnection3.connected := false;
Form1.adoConnection3.connectionstring := cst3;
Form1.adoConnection3.connected :=true;
except resultC :=false; end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var Dateiname,error1,m ,w,writepath,filesource,filedest : string; cs1,cs2,cs3: widestring;
option1,i,Feldnamenzahl : integer;ok : boolean;
begin
Sendergruppe := 'Nichts'; IDZahl:=0; IDAnfang:=0;
TabbedNB1.PageIndex := 0; Listbox2.Items.Clear;Listbox3.Items.Clear;
verz := extractFilepath(ParamStr(0))
Put a breakpoint on the above line. Examine the contents of 'verz'. Tell me what it is.
;Form1.ListBox3.Clear;
Post by Thomas Willms
WritePath := GetFolder( CSIDL_COMMON_APPDATA, True);
Change the constant. Put a breakpoint on the above line. Examine the contents of
'Writepath'. Tell me what it is.
Post by Thomas Willms
mdbfilelocation(verz,WRITEpATH);
Comment out the above line. You *DO NOT* need to copy the file. See comments in the
Inno script.
Post by Thomas Willms
cs1 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\Thereda.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';
Put a breakpoint on the above line. Examine the contents of 'cs1'. Tell me what it is.
Post by Thomas Willms
ADOConnectTest(cs1,cs2,cs3,ok);
end;
end;
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=TED
AppVerName=TED1.0
AppPublisher=GRS, Inc.
AppPublisherURL=http://www.thereda.de
AppSupportURL=http://www.thereda.de
AppUpdatesURL=http://www.thereda.de
DefaultDirName={pf}\TED
DefaultGroupName=TED
OutputDir=G:\compiled\TEDEXE\exe
OutputBaseFilename=setup
Compression=lzma
SolidCompression=true
DirExistsWarning=yes
[Languages]
Name: english; MessagesFile: compiler:Default.isl
Name: french; MessagesFile: compiler:Languages\French.isl
Name: german; MessagesFile: compiler:Languages\German.isl
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
[Files]
Source: TED1local\Project1.exe; DestDir: {app}; Flags: ignoreversion
Source: TED1local\Thereda.mdb; DestDir: {commonappdata}; Flags: ignoreversion
Change the constant in the above line.
Post by Thomas Willms
[_ISTool]
UseAbsolutePaths=true
I have never seen this before. What does it do?
Does the program give the error when you run it outside the Inno setup [Run] section?
Thomas Willms
2008-01-18 12:41:07 UTC
Permalink
Hello,
thanks very much for your prescious help...
only posting these questions was probably sufficient to get me to the solution.
it seems that there were just a strange little error somewhere (subfolder 'DBDateien' taken for some strange reason in the connectionstring).
Anyway, now it works perfectly with windows XP Pro and WinXP Home.
My first own program perfectly compiled, installed on a 'virgin system' and ready for its users...

and finishing my trial period successfully in the enterprise I am working

Thanks so much

Thomas Willms
Post by MikeR
Post by Thomas Willms
Hello,
I tried it nearly as you said.
Nearly? Why not exactly?
Post by Thomas Willms
I determined with shfolder and constant CSIDL_COMMON_Documents the folder where my databases should be needed. I copied the databases mdb in this folder. Then I construct with the same path string the connectionstring.
For right now, lets use CSIDL_COMMON_APPDATA instead.
Post by Thomas Willms
At design conditions it worked (winxP Pro). But when I tried to install it on another computer with winXP home, it didn't.
During installation I got a message: 'C:\Program files\TED\DBFiles\thereda.mdb' not found !!!
(where "TED" is the application directory, "DBfiles" a directory that I used before but even not in this compiled Innoset up script and only in the original delphi code, and "thereda.mdb" the database)
Where, except in the string, it is written where to search for the database ?
Nowhere.
Post by Thomas Willms
Might it be in the ACCESS File (options/General ?: I changed it but it did not change anything)
What options? Where? This is a database file, isn't it?
Post by Thomas Willms
So last time it was in "Document and Settings" now it searches in "Program files/TED/DBFiles/", a folder which does not exist .... I had this problem before... seems that the constant is not constantly the same ???
When I used winXP pro, fiels are copied in "Document and settings/all users", under windows XP home they are copied in "Document and settings/all users/shared documents"
Why are you copying the file at all? Why not just have Inno install it where needed?
Post by Thomas Willms
And the program searches nearly each time I change something / the system at another place, even not in the special folder.
Where is it specified ? I have to read out this path and/ or create my own folder. How can I create a folder by the way in Delphi?
This letter action would also be interesting if it is possible to evaluate the error "database" not found with the path. Best would probably extract the path from the windows message and copy files to this place. How can I do this ?
I don't know how to get the path from the error message, but please DON'T try to copy
the file there! You need to use the other stuff I gave you correctly. If you put the
file in a known place, and then look there, the file WILL be there. I'm going to put
some comments inline with your code. Humor me and do them *EXACTLY*. <g>
OK, you can send it to me by mail. Take the obvious out of my email address.
Post by Thomas Willms
function GetFolder(ID: Cardinal; Create: Boolean): string;
var Res: HResult;
Path: array[0..Max_Path] of Char;
const
shgfp_Type_Current: cardinal = $0;
begin
if Create then ID := ID or csidl_Flag_Create;
Result := Path ; /// '\MyFolder\'Welcher Name ist das ?
if S_OK <> Res then
raise Exception.Create('Could not determine folder path');
end;
procedure mdbfilelocation(verzE,WRITEpATH1 : STRING);
var filesource,filedest : string;
begin
fileSource := verze + '\Thereda.mdb';fileDest := WritePath1 +'\'+ 'Thereda.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
fileSource := verze + '\Theredaprivate.mdb';fileDest := WritePath1 +'\'+ 'Theredaprivate.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
fileSource := verze + '\KopieTheredapriv.mdb';fileDest := WritePath1 + '\'+ 'KopieTheredapriv.mdb';
CopyFile(PChar(fileSource), PChar(fileDest), False);
//try DeleteFile(fileSource); finally end;
end;
procedure ADOConnectTest(cst1,cst2,cst3 : widestring;resultC : boolean);
begin
resultC :=true;
try Form1.adoConnection1.connected := false;
Form1.adoConnection1.connectionstring := cst1;
Put a breakpoint here. Examine the contents of 'cst1'. Tell me what it is.
Post by Thomas Willms
Form1.adoConnection1.connected :=true;
Form1.ADOConnection2.GetTableNames(Form1.ListBox3.Items, False);
Form1.adoConnection2.connected := false;Form1.adoConnection2.connectionstring := cst2;
Form1.adoConnection2.connected :=true; Form1.adoConnection3.connected := false;
Form1.adoConnection3.connectionstring := cst3;
Form1.adoConnection3.connected :=true;
except resultC :=false; end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var Dateiname,error1,m ,w,writepath,filesource,filedest : string; cs1,cs2,cs3: widestring;
option1,i,Feldnamenzahl : integer;ok : boolean;
begin
Sendergruppe := 'Nichts'; IDZahl:=0; IDAnfang:=0;
TabbedNB1.PageIndex := 0; Listbox2.Items.Clear;Listbox3.Items.Clear;
verz := extractFilepath(ParamStr(0))
Put a breakpoint on the above line. Examine the contents of 'verz'. Tell me what it is.
;Form1.ListBox3.Clear;
Post by Thomas Willms
WritePath := GetFolder( CSIDL_COMMON_APPDATA, True);
Change the constant. Put a breakpoint on the above line. Examine the contents of
'Writepath'. Tell me what it is.
Post by Thomas Willms
mdbfilelocation(verz,WRITEpATH);
Comment out the above line. You *DO NOT* need to copy the file. See comments in the
Inno script.
Post by Thomas Willms
cs1 := 'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+
writepath + '\Thereda.mdb;Mode=ReadWrite;Extended Properties="";Persist Security Info=False';
Put a breakpoint on the above line. Examine the contents of 'cs1'. Tell me what it is.
Post by Thomas Willms
ADOConnectTest(cs1,cs2,cs3,ok);
end;
end;
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=TED
AppVerName=TED1.0
AppPublisher=GRS, Inc.
AppPublisherURL=http://www.thereda.de
AppSupportURL=http://www.thereda.de
AppUpdatesURL=http://www.thereda.de
DefaultDirName={pf}\TED
DefaultGroupName=TED
OutputDir=G:\compiled\TEDEXE\exe
OutputBaseFilename=setup
Compression=lzma
SolidCompression=true
DirExistsWarning=yes
[Languages]
Name: english; MessagesFile: compiler:Default.isl
Name: french; MessagesFile: compiler:Languages\French.isl
Name: german; MessagesFile: compiler:Languages\German.isl
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
[Files]
Source: TED1local\Project1.exe; DestDir: {app}; Flags: ignoreversion
Source: TED1local\Thereda.mdb; DestDir: {commonappdata}; Flags: ignoreversion
Change the constant in the above line.
Post by Thomas Willms
[_ISTool]
UseAbsolutePaths=true
I have never seen this before. What does it do?
Does the program give the error when you run it outside the Inno setup [Run] section?
MikeR
2008-01-18 19:50:38 UTC
Permalink
Post by Thomas Willms
Hello,
thanks very much for your prescious help...
only posting these questions was probably sufficient to get me to the solution.
it seems that there were just a strange little error somewhere (subfolder 'DBDateien' taken for some strange reason in the connectionstring).
Anyway, now it works perfectly with windows XP Pro and WinXP Home.
My first own program perfectly compiled, installed on a 'virgin system' and ready for its users...
and finishing my trial period successfully in the enterprise I am working
Thanks so much
Thomas Willms
Ich bin froh, dass Sie es Arbeit.
Bis spater,
Mike
Meftah Tayeb
2008-05-06 14:09:33 UTC
Permalink
hi,
your MDB Database File is Copied in the folder: "Document and settings/all
users/shared
documents"
this is a knone Path, this is a Securiti Problem !
please try to copy it to a other (not knone path) (personalised folder)
Loading...