Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <vcl.h>
#include<shlobj.h>
#include<SHELLAPI.H>
#include<cstdio>
#include<fstream>
using namespace std;
#pragma hdrstop
#include "Exercise.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
// SaveDialog = new TSaveDialog(Form1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete SaveDialog;
SaveDialog = NULL;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
if (OpenDialog->Execute() == true) {
ShowMessage("File:" + OpenDialog->FileName);
Edit1->Text = OpenDialog->FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton2Click(TObject *Sender)
{
if (SaveDialog->Execute() == true) {
Edit2->Text = SaveDialog->FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char FileFrom[MAX_PATH], FileTo[MAX_PATH];
Edit1->Text = "C:\\Users\\Andrew\\Desktop\\zzz.txt";
Edit2->Text = "C:\\Users\\Andrew\\Desktop\\back.txt";
const String fileFrom = Edit1->Text.c_str();
const String fileTo = Edit2->Text.c_str();
CopyFile(FileFrom, FileTo, false ) ;
}
// Set up
Screen->Cursor = crHourGlass;
// From files
AnsiString TempStr = Edit1->Text.c_str() + '\0'; // Double null termination
AnsiString FromFilesStr = TempStr;
// To location
TempStr = Edit2->Text.c_str() + '\0'; // Double null termination
AnsiString ToFilesStr = TempStr;
try
{
SHFILEOPSTRUCT FileOp;
::ZeroMemory(&FileOp, sizeof(FileOp));
FileOp.wFunc = FO_COPY; // copy
FileOp.pFrom = FromFilesStr.c_str(); // Local DB files
FileOp.pTo = ToFilesStr.c_str(); // Network file location
FileOp.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI;
//FileOp.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR;
SHFileOperation(&FileOp);
}
__finally
{
Screen->Cursor = crDefault;
};