Save Dialog / Move File problem

Posted on 2006-04-20
Last Modified: 2010-04-05


I have an application that creates a file name output.html in the same directory as the application.  I'm trying to give the user the option to save this file to a different name and location.

Here's the code that I have right now:

    sDialog.Title := 'Save your file...';
    sDialog.Filter := 'HTML File (*.html)|*.html';
    sDialog.DefaultExt := 'html';
    sDialog.FilterIndex := 1;

    If sDialog.Execute Then

This doesn't work.  I don't receive any errors, but it simply doesn't move the file to any location.

Question by:light_bulb
    LVL 17

    Accepted Solution

    provide full path for source file

            MoveFile(PChar(ExtractFilePath(Paramstr(0))+ 'output.html'),PChar(sDialog.FileName));
    LVL 3

    Author Comment

    That worked!  


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now