Downloadfortschritt!



  • Wahrscheinlich hat dein Projekt irgendwo 'ne Macke. 🙂
    Mail mich mal an (siehe Profil), dann schick ich dir das Beispielprojekt, wahlweise für BCB5 oder BCB6.



  • So ihr lieben Leute, folgendes ist mitlerweile! Zunächst an Jansen vielen Dank! Aber es funzt immernoch nicht!

    Nochmal eine kurze Beschreibung:
    Ich würde gerne eine Art Downloadfenster wie beim Internet Explorer bauen, mit Fortschrittsanzeige!

    Hier nun der Quellcode, falls jemand eine Idee hat, ich bin für alles offen 🙂

    update.cpp

    //---------------------------------------------------------------------------
    
    #include <vcl.h>
    #pragma hdrstop
    #include "update.h"
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm2 *Form2;
    String URL = "http://meinserver.homelinux.com/cpp.exe";
    String filename = "c:\\cpp.exe";
    //---------------------------------------------------------------------------
    __fastcall TForm2::TForm2(TComponent* Owner)
            : TForm(Owner)
    {
             ListBox1->Items->LoadFromFile("update\\update.txt");
    
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm2::AfterShow()
    {
      Show();
      Application->ProcessMessages();
    
      TFileStream *fs = new TFileStream(filename, fmCreate);
      IdHTTP1->Get(URL,fs);
      delete fs;
    
      Button1->Enabled = true;
      Button1->SetFocus();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm2::IdHTTP1WorkBegin(TObject *Sender,
          TWorkMode AWorkMode, const int AWorkCountMax)
    {
      Label2->Caption ="Gesamt: " + String(AWorkCountMax) + " Bytes";
      ProgressBar1->Max = AWorkCountMax;
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm2::IdHTTP1Work(TObject *Sender,
          TWorkMode AWorkMode, const int AWorkCount)
    {
      Label1->Caption ="Aktuell: " + String(AWorkCount) + " Bytes";
      ProgressBar1->Position = AWorkCount;
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm2::Button1Click(TObject *Sender)
    {
    ShellExecute(0, "open", filename.c_str(), 0, 0, SW_SHOW);
    Close();
    }
    //---------------------------------------------------------------------------
    

    Und ihr die update.h

    //---------------------------------------------------------------------------
    
    #ifndef updateH
    #define updateH
    //---------------------------------------------------------------------------
    #include <Classes.hpp>
    #include <Controls.hpp>
    #include <StdCtrls.hpp>
    #include <Forms.hpp>
    #include <ComCtrls.hpp>
    #include <IdBaseComponent.hpp>
    #include <IdComponent.hpp>
    #include <IdHTTP.hpp>
    #include <IdTCPClient.hpp>
    #include <IdTCPConnection.hpp>
    #include <ExtCtrls.hpp>
    //---------------------------------------------------------------------------
    class TForm2 : public TForm
    {
    __published:	// Von der IDE verwaltete Komponenten
            TListBox *ListBox1;
            TLabel *Label1;
            TLabel *Label2;
            TProgressBar *ProgressBar1;
            TStatusBar *StatusBar1;
            TButton *Button1;
            TButton *Button2;
            TIdHTTP *IdHTTP1;
            void __fastcall Button1Click(TObject *Sender);
    private:	// Anwender-Deklarationen
    void __fastcall IdHTTP1Work(TObject *Sender,
          TWorkMode AWorkMode, const int AWorkCount);
          void __fastcall IdHTTP1WorkBegin(TObject *Sender,
          TWorkMode AWorkMode, const int AWorkCountMax);
    public:		// Anwender-Deklarationen
            void __fastcall AfterShow();
            __fastcall TForm2(TComponent* Owner);
    };
    //---------------------------------------------------------------------------
    extern PACKAGE TForm2 *Form2;
    //---------------------------------------------------------------------------
    #endif
    


  • lad dir mal den quelltext von simplesim runter... da findest du im ordner updater ein projekt, das genau das macht, was deins machen soll 🙂
    http://simplesim.sourceforge.net



  • "Funzt nicht" ist keine ausreichende Fehlermeldung oder Problembeschreibung.



  • DreadlockFilbert schrieb:

    lad dir mal den quelltext von simplesim runter... da findest du im ordner updater ein projekt, das genau das macht, was deins machen soll 🙂
    http://simplesim.sourceforge.net

    Vielen Dank für den Tipp, aber in der Version wo man den Quelltext einsehen kann ist leider kein Fortschrittsbalken! Nur in der *.exe Version!

    Des weiterem würde ich mich gerne an den oben geschrieben Quelltext halten!

    Weitere Vrschläge werden gerne angenommen 🙂



  • Falls jemand eine Lösung zu meinem Problem hat, meldet euch bitte! Ist dringend!!

    Vielen Dank


Anmelden zum Antworten