Silvio,
1) Can you explain to me when I can make the indexes and the packs
I have been trying to tell you this. You cannot build indexes unless you have the files open in exclusive use.
And you should not be building indexes everytime the program is run--there is no need.
If the program has just been installed, then it should check to see if the databases exist, and if not create them. Then it should open them in exclusive use mode, and build the indexes. Then close the files. Files should then be opened shared whenever they are opened.
From then on, when the program is run and does the check for the databases, it will find them and thus just skip that step.
Do you have a lot of deleted records? If so, why? Most times you can avoid doing packs by reusing deleted records. If you don't reuse them, then an Admin will have to have exclusive use of the files needing to be packed.
2) when I deliver the application to the client I also have to deliver the indexes?
No, see explaination above.
3)how to check if the archives are open and create indexes?
If you can't get exclusive use of the files, then they are open by someone else. And you need to get exclusive use of ALL the files BEFORE you delete the indexes and rebuild them.
Also, you seem to think that the indexes need to be created each time the program is run. Not so. Generally, the only time they need to be created is when they don't exist or when they are corrupted.