Password Dialog



  • Hallo,

    ich benötige noch mal eure Hilfe.

    Ich wollte eine Passwortabfrage beim Starten des Projektes hinzufügen.

    Ich habe dazu aus einen alten Projekt den Code kopiert, der da ohne Probleme lief.

    Mit dem Builder 10.2 funktioniert das aber leider nicht mehr.

    Hier der Code:

    int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
    {
    try

    std::auto_ptr<TPasswordDlg> passwordfrm (new TPasswordDlg(NULL));
    passwordfrm->ShowModal();

    if (passwordfrm->Password->Text == "abcd")

    {
    Application->Initialize();
    Application->MainFormOnTaskBar = true;
    Application->CreateForm(__classid(TForm1), &Form1);
    Application->CreateForm(__classid(TPasswordDlg), &PasswordDlg);
    Application->Run();
    }

    else {
    ShowMessage("Passwort falsch!");
    exit(0);
    }

    catch (Exception &exception)

    ------------------------------------------------------------------------

    PassWord.h:

    //----------------------------------------------------------------------------
    #ifndef PassWordH
    #define PassWordH
    //----------------------------------------------------------------------------
    #include <Vcl.Buttons.hpp>
    #include <Vcl.StdCtrls.hpp>
    #include <Vcl.Controls.hpp>
    #include <Vcl.Forms.hpp>
    #include <Vcl.Graphics.hpp>
    #include <System.Classes.hpp>
    #include <System.SysUtils.hpp>
    #include <Winapi.Windows.hpp>
    #include <System.hpp>
    //----------------------------------------------------------------------------
    class TPasswordDlg : public TForm
    {
    __published:
    TLabel *Label1;
    TEdit *Password;
    TButton *OKBtn;
    TButton CancelBtn;
    private:
    public:
    virtual __fastcall TPasswordDlg(TComponent
    AOwner);
    };
    //----------------------------------------------------------------------------
    extern PACKAGE TPasswordDlg *PasswordDlg;
    //----------------------------------------------------------------------------
    #endif



  • Hat sich erledigt, ich hab es gefunden.

    Da fehlte eine }.


Anmelden zum Antworten