Jump to content

Validate SaveFileName


Recommended Posts

I need to validate the file name returned by the ComDlg Save File dialog of 3rd party application and prevent the save if anything other than a pre-defined file path is used. FWIW, our host OS is currently WinXP 32-bit and will probably remain so. I can think of several ways to do this, which I list below, and have done both a web and forum search (found Siao's samples, for example), but would appreciate any advice on how best to approach this, with the goal of balancing ease of implementation, robustness, and ease of maintenance.

Here are my preliminary thoughts. (I'll admit that my programming knowledge is good enough to get me into challenging, potentially powerful areas, but no better than that and that my related vocabulary reflects that).

1) Using AutoIt's hook/subclassing capabilities to directly hook the app's ComDlg SaveFile dialog using WinAPI_GetSaveFileName and/or $tagOPENFILENAME (perhaps setting the $OFN_NOCHANGEDIR flag) and letting the Windows API do my work.

2) Hiding/suppressing the apps File Save dialog, and creating an AutoIt GUI FileSave dialog to "replace" it, then passing the values retrieved by the AutoIT FileSave to the apps File Save dialog after validation.

3) Placing an AutoIt text box on top of the apps FileSave dialog's Filename Edit control - I've already disabled the navigation combo boxes and other Explorer elements in the apps FileSave dialog - and when the user click's on apps Save button, validating the AutoIt's text box contents before passing it on to the apps FileSave dialog.

Thanks in advance for any feedback.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...