Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
#include <iostream>
#include <cstdlib.>
#include <windows.h>
#include <urlmon.h>
#include <string>
#include <direct.h>
#include "unzip.h" //zum entpacken nötig
using namespace std;
#pragma comment(lib,"URLMon.lib")
void deckbutler()
{
// Datei herunterladen
HRESULT result = URLDownloadToFile(
NULL,
TEXT("http://home.arcor.de/Terra23/DeckButler/DeckButler.zip"), // URL zur Datei
TEXT("C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\DeckButler.zip"), // Lokaler Name der Datei
0,
NULL);
if (result == S_OK)
{
cout << "DeckButler.zip erfolgreich heruntergeladen" << endl;
system("PAUSE");
cout << endl;
}
else
{
cout << "Fehler beim Download" << endl;
system("PAUSE");
}
}
void programmdateien()
{
// Datei herunterladen
HRESULT result2 = URLDownloadToFile(
NULL,
TEXT("http://home.arcor.de/Terra23/DeckButler/Programmdateien.zip"), // URL zur Datei
TEXT("C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\Programmdateien.zip"), // Lokaler Name der Datei
0,
NULL);
if (result2 == S_OK)
{
cout << "Programmdateien.zip erfolgreich heruntergeladen" << endl;
system("PAUSE");
cout << endl;
}
else
{
cout << "Fehler beim Download" << endl;
system("PAUSE");
}
}
void start()
{
cout << "Programm starten? (j/n): ";
char input = ' ';
while ((input != 'j') && (input != 'J') && (input != 'n') && (input != 'N'))
{
cin.sync();
cin.get(input);
}
if (input == 'j' || input == 'J')
{
ShellExecute(NULL,"open","DeckButler.exe",NULL,NULL,SW_SHOWNORMAL);
}
else
{
}
}
void remove()
{
remove("C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\DeckButler.zip");
remove("C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\Programmdateien.zip");
cout << "Dateien geloescht" << endl;
system("PAUSE");
cout << endl;
}
void unzipdb()
{
HZIP hz = OpenZip("C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\DeckButler.zip",0);
ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
for (int i=0; i<numitems; i++)
{
GetZipItem(hz,i,&ze);
//std::string szBasePath = "C:\\Programme\\DeckButler\\";
std::string szBasePath = "C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\";
szBasePath += ze.name;
UnzipItem(hz, i, szBasePath.c_str());
//UnzipItem(hz, i, ze.name);
}
CloseZip(hz);
}
void unzippd()
{
HZIP hz = OpenZip("C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\Programmdateien.zip",0);
ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
for (int i=0; i<numitems; i++)
{
GetZipItem(hz,i,&ze);
//std::string szBasePath = "C:\\Programme\\DeckButler\\";
std::string szBasePath = "C:\\Dokumente und Einstellungen\\%USERPROFILE%\\Eigene Dateien\\DeckButler\\";
szBasePath += ze.name;
UnzipItem(hz, i, szBasePath.c_str());
//UnzipItem(hz, i, ze.name);
}
CloseZip(hz);
}
void menu()
{
int menu;
cout << "<1> Daten downloaden" << endl;
cout << "<2> PM an Entwickler" << endl;
cout << "Was moechten Sie tun:";
cin >> menu;
system("cls");
if(menu==1)
{
deckbutler();
programmdateien();
unzipdb();
unzippd();
remove();
start();
}
else if(menu==2)
{
ShellExecute(NULL,"open","http://etcg.de/forum/pms.php?action=newpm&userid=58167&subject=DeckButler download&message=Probleme,Anregungen,Bugs zum DeckButler download:",NULL,NULL,SW_SHOWNORMAL);
}
}
void login()
{
/*string passwort;
cout << "Passwort:";
cin >> passwort;
if(passwort=="db")
{*/
menu();
/*}
else
{
cout << "Login failed" << endl;
system("PAUSE");
}*/
}
int main()
{
login();
}
HRESULT result = URLDownloadToFile(
NULL,
L"http://example.com/Update.exe", // URL zur Datei
L"Update.exe", // Lokaler Name der Datei
0,
NULL);
if (result == S_OK) {
// Verifizieren, Ausführen, etc.
} else {
// Fehler beim Download
}
#include <iostream>
#include <cstdlib.>
#include <windows.h>
#include <urlmon.h>
#include <string>
#include <direct.h>
#include "unzip.h" //zum entpacken nötig
using namespace std;
#pragma comment(lib,"URLMon.lib")
void deckbutler()
{
// Datei herunterladen
HRESULT result = URLDownloadToFile(
NULL,
TEXT("http://home.arcor.de/Terra23/DeckButler/DeckButler.zip"), // URL zur Datei
TEXT("DeckButler.zip"), // Lokaler Name der Datei
0,
NULL);
/*if (result == S_OK)
{
cout << "DeckButler.zip erfolgreich heruntergeladen" << endl;
system("PAUSE");
cout << endl;
}
else
{
cout << "Fehler beim Download" << endl;
system("PAUSE");
}*/
}
void programmdateien()
{
// Datei herunterladen
HRESULT result2 = URLDownloadToFile(
NULL,
TEXT("http://home.arcor.de/Terra23/DeckButler/Programmdateien.zip"), // URL zur Datei
TEXT("Programmdateien.zip"), // Lokaler Name der Datei
0,
NULL);
/*if (result2 == S_OK)
{
cout << "Programmdateien.zip erfolgreich heruntergeladen" << endl;
system("PAUSE");
cout << endl;
}
else
{
cout << "Fehler beim Download" << endl;
system("PAUSE");
}*/
}
void start()
{
cout << "Programm starten? (j/n): ";
char input = ' ';
while ((input != 'j') && (input != 'J') && (input != 'n') && (input != 'N'))
{
cin.sync();
cin.get(input);
}
if (input == 'j' || input == 'J')
{
ShellExecute(NULL,"open","DeckButler\\DeckButler.exe",NULL,NULL,SW_SHOWNORMAL);
}
else
{
}
}
void remove()
{
remove("DeckButler.zip");
remove("Programmdateien.zip");
/*cout << "Dateien geloescht" << endl;
system("PAUSE");
cout << endl;*/
}
void unzipdb()
{
HZIP hz = OpenZip("DeckButler.zip",0);
ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
for (int i=0; i<numitems; i++)
{
GetZipItem(hz,i,&ze);
string szBasePath = "DeckButler\\";
szBasePath += ze.name;
UnzipItem(hz, i, szBasePath.c_str());
//UnzipItem(hz, i, ze.name);
}
CloseZip(hz);
}
void unzippd()
{
HZIP hz = OpenZip("Programmdateien.zip",0);
ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
for (int i=0; i<numitems; i++)
{
GetZipItem(hz,i,&ze);
string szBasePath = "DeckButler\\";
szBasePath += ze.name;
UnzipItem(hz, i, szBasePath.c_str());
//UnzipItem(hz, i, ze.name);
}
CloseZip(hz);
}
int main()
{
deckbutler();
programmdateien();
unzipdb();
unzippd();
remove();
start();
}