Jump to content

cbPlus

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @Remy Lebeau Thank You. It's late, but aprreciated.
  2. cbPlus

    C++ Builder 11.3 IDE/BDS errors

    @TWBoy Hi. Sorry for the late answer. Maybe you already got it. I mispelled the key. HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\22.0\LSP If this key exists, you made some custom changes. I had. So I deleted it the key beneath the reg-path LSP and it worked again.
  3. Hi. I had 2 years ago the problem to install the C++ Builder CE edition 10.4 after a new install of Windows 10 Pro. The problem was the license (Free) could not be activated again. Another installation was not possible. Is this still so or can I install my current license in a new Windows installation? Thanks.
  4. cbPlus

    C++ Builder 11.3 IDE/BDS errors

    It was something with LSB path in the registrty or configuration. Changed it. Case closed.
  5. Hallo. Is there a chance to repair the C++ Builder 11.3 Community Edition without de- and reinstall? I get some ugly messages like: "No application to execute" when I start/load a project "Access violation in module rtl280.bpl" or "Access violation in module bcbide280.bpl" first time today "Dos command not running" Thank You.
  6. cbPlus

    C++ Builder 11.3 / RenameFile() not working?

    "C:\\Users\\NO_NO\\OneDrive\\TEMP\\*.*" Without the *.* because I thought this is temprorary only for the btnSearch within FindFirst() FindNext() Bad assumption I think.
  7. cbPlus

    C++ Builder 11.3 / RenameFile() not working?

    I used and use the debugger. But as I said. I didn't recognize that I have to use the absolute path prior the filenames NewFileName_ and OldFileName_. So I did debug and thought it's ok. I added improtant variables to the watch list. Simply said, it was a logical thinking error. Recently I bought this book from Mohmad Yakub "C Programming Patterns - The Art of Coding Logic". 🙂
  8. cbPlus

    C++ Builder 11.3 / RenameFile() not working?

    Thanks for all the answers. Very, very helpful. I like this forum. So. I took your advice and tampered my code. It works now. @silvercoder79 This was the final solution. I didn't recognize that the absolute path is needed. Thanks. I know the code's syntax is 'simple' coded. But I need this for now to better understand what's going on. It is actually only a learning code. Any further ideas are welcome. Anyway. Thank you. #include <vcl.h> #pragma hdrstop #include "uTSearchRec.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm2* Form2; TSearchRec SearchRec; String WorkingPath_ = "C:\\Users\\NONO\\OneDrive\\TEMP\\"; //--------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) {} //--------------------------------------------------------------------------- void __fastcall TForm2::btnSearchClick(TObject* Sender) { String FindFirstPath_ = WorkingPath_ + "*.*"; 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_ = WorkingPath_ + 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_); if (returnValue_ == false) RaiseLastOSError(); lbControlText->Caption = IntToStr(returnValue_); } catch (const EOSError& ex){ lbOutput->Caption = "NewFileName_ : " + NewFileName_ + "\nOldFileName_ :" + OldFileName_ + "\nErrorCode : " + String(ex.ErrorCode); } lbOutput->Caption = MessageOK_; } //---------------------------------------------------------------------------
  9. 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
×