thill
Posts: 111
Joined: Sat Jan 21, 2012 5:58 pm

Change OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST flags

Our installation requires the user to be able to specify the data filename for SQL Server. I am using an SQL script to handle the database creation, and file replace-string operations to alter the SQL script prior to running it.

We would like to use BrowseForFile but it uses the OFN_PATHMUSTEXIST and OFN_FILEMUSTEXIST flags which are not appropriate for a new file that cannot be created by the installer.

Is there an alternative to BrowseForFile that would allow this?

Or a way to set the "must exist" flags?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Change OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST flags

Hello and welcome to Advanced Installer forums,
We would like to use BrowseForFile but it uses the OFN_PATHMUSTEXIST and OFN_FILEMUSTEXIST flags which are not appropriate for a new file that cannot be created by the installer.
You needn't worry about this as long as the external data filename path is stored correctly in a public property after user interaction. Here's another thread that can give you a hint on how to move on.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
thill
Posts: 111
Joined: Sat Jan 21, 2012 5:58 pm

Re: Change OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST flags

I wasn't very clear. The issue is when using a Path Edit control. If the Default Value is empty an error is always displayed "The specified path "" is unavailable."

We'd like to start with an empty field and allow the user to choose whether to enter a path for a file. If the field is empty then a default path inside our software is used.

Is it possible to disable the MUST EXIST flags for a Path Edit control?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Change OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST flags

Hello,

I'm not sure I understand. Have you followed this article step by step. I assumed so in my last post.
It also has a sample project that demonstrates its functionality.

The next step after that would be to use SQL Script Replacements predefined functionality with the hint from the thread I linked in my last post.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
thill
Posts: 111
Joined: Sat Jan 21, 2012 5:58 pm

Re: Change OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST flags

Thanks - I went a different way with it.

Return to “Building Installers”