Jump to content

Search the Community

Showing results for tags 'community'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 2 results

  1. I have written some code from a tutorial. Now I am stuck with the RenameFile() function from System.SysUtils.hpp The returnValue_ is always false or 0. I tried it as Administrator. I checked the file permissions security. Nothing worked. //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "uTSearchRec.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm2* Form2; TSearchRec SearchRec; //--------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) {} //--------------------------------------------------------------------------- void __fastcall TForm2::btnSearchClick(TObject* Sender) { String FindFirstPath_ = "C:\\Users\\NO_NO\\OneDrive\\TEMP\\*.*"; String Caption1_ = "Current Path:\n" + FindFirstPath_; String Caption2_ = SearchRec.Name + " is " + IntToStr(SearchRec.Size) + "bytes in size"; FindFirst(FindFirstPath_, faAnyFile, SearchRec); lbOutput->Caption = Caption1_ + "\n" + Caption2_; } //--------------------------------------------------------------------------- void __fastcall TForm2::btnAgainClick(TObject* Sender) { if (FindNext(SearchRec) == 0) { lbOutput->Caption = SearchRec.Name + " is " + IntToStr(SearchRec.Size) + " bytes in size"; } else FindClose(SearchRec); } //--------------------------------------------------------------------------- void __fastcall TForm2::btnRenameClick(TObject* Sender) { String const OldFileName_ = SearchRec.Name; String const NewFileName_ = OldFileName_ + "bak"; String const MessageFail_ = "Humpty Bumpty ! Njet Internjet !"; String const MessageOK_ = "The bether its not get !"; bool returnValue_ = true; try { returnValue_ = RenameFile(OldFileName_, NewFileName_); lbControlText->Caption = IntToStr(returnValue_); } catch (...){ lbOutput->Caption = "NewFileName_ : " + NewFileName_ + "\nOldFileName_ :" + OldFileName_ + "\nreturnValue : " + IntToStr(returnValue_); } lbOutput->Caption = MessageOK_; /* if ( (RenameFile(OldFileName_, NewFileName_) == false )) { lOutput->Caption = MessageFail_; } else lOutput->Caption = MessageOK_; */ } //--------------------------------------------------------------------------- Header //--------------------------------------------------------------------------- #ifndef uTSearchRecH #define uTSearchRecH //--------------------------------------------------------------------------- #include <System.Classes.hpp> #include <Vcl.Controls.hpp> #include <Vcl.StdCtrls.hpp> #include <Vcl.Forms.hpp> #include <System.SysUtils.hpp> //--------------------------------------------------------------------------- class TForm2 : public TForm { __published: // IDE-managed Components TLabel *lbOutput; TButton* btnSearch; TButton* btnAgain; TButton* btnRename; TLabel *lbControlText; void __fastcall btnSearchClick(TObject* Sender); void __fastcall btnAgainClick(TObject* Sender); void __fastcall btnRenameClick(TObject* Sender); private: // User declarations public: // User declarations __fastcall TForm2(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm2* Form2; //--------------------------------------------------------------------------- #endif
  2. New official Embarcadero forums online http://community.idera.com/developer-tools/ The sign-up/login is a bit prickly at first, so keep your login name / login email and password at hand, and request a password reset if your get into problems.
×