vitalstates 0 Posted April 8, 2022 hello I'm returning to delphi after a bit of absense...still on XE5 and first post here as the developer network seems to have vanished... this is an old chestnut and the search engines return loads of questions with no answers. I cannot get the initaldir to work in open dialog. I have resorted to hard coding exact locations, e.g c:\pathname\directory and even c:\ but nothing works, the opendialog always opens in mydocuments(win10 and win11) does anybody have a view on this? Share this post Link to post
Uwe Raabe 2057 Posted April 8, 2022 This is expected and even documented (see Windows7 item 1): Quote The initial directory. The algorithm for selecting the initial directory varies on different platforms. Windows 7: If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory. Otherwise, if lpstrFile contains a path, that path is the initial directory. Otherwise, if lpstrInitialDir is not NULL, it specifies the initial directory. If lpstrInitialDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory. Otherwise, the initial directory is the personal files directory of the current user. Otherwise, the initial directory is the Desktop folder. Windows 2000/XP/Vista: If lpstrFile contains a path, that path is the initial directory. Otherwise, lpstrInitialDir specifies the initial directory. Otherwise, if the application has used an Open or Save As dialog box in the past, the path most recently used is selected as the initial directory. However, if an application is not run for a long time, its saved selected path is discarded. If lpstrInitialDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory. Otherwise, the initial directory is the personal files directory of the current user. Otherwise, the initial directory is the Desktop folder. 1 Share this post Link to post
vitalstates 0 Posted April 8, 2022 Thanks for the reply....I'm embarrased to say I've solved the problem...I had set initialdir after the opendialog.execute.... uber stupid on my part....it's a good job I've retired.... apologies and thanks for looking Share this post Link to post