Save Dialog in Delphi, Data are in a different partition

826 Views Asked by At

Testing my little application, I met a problem with Save dialog in Delphi. Normally Save Dialog appears ( I save image file otherwise), but yesterday I tested my app on a computer where all Data were in another partition - in (D:) directory – while system was in (C:) separetely. It does not work: saveDialog.InitialDir := GetCurrentDir; (Save dialog does not appear.) I am a newbie in Delphi and I don’t know how resolve the problem in case of some computers having the programs and the data in two different directories. Please help me, thanks in advance!

1

There are 1 best solutions below

0
Remy Lebeau On

TSaveDialog handles multiple partitions just fine. Your problem is related to something else.

With that said, you really should not be relying on GetCurrentDir() at all, as it dynamically changes during the course of your app's lifetime, so you can never be sure where it actually points to at any given moment. In any case, that alone would not cause TSaveDialog to fail.

TSaveDialog uses GetSaveFileName() internally, so when it does fail, try calling CommDlgExtendedError() to find out why.