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.
int ruck;
int vergleich(int posx, int posy, int typ)
{
bposx = posx;
bposy = posy;
int q = 0;
int ergebniss = 1;
// GDI+ initialisieren
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// Scopeklammern, damit alle Objekte vor GdiPlusShutdown zerstört sind
{
Bitmap bm1( L"C:\\bilder\\vergleich.bmp" );
// Bitmap bm2( L"C:\\bilder\\desktop.bmp" );
//Bitmap bm2 (BitBlt(GetDC(0), 300, 300, 1600, 900, GetDC(0), 0, 0, SRCCOPY));
HDC Screen = GetDC(0);
HBITMAP Capture = CreateCompatibleBitmap(Screen, 1680, 920);
HDC Image = CreateCompatibleDC(Screen);
HBITMAP OldBitmap = (HBITMAP)SelectObject(Image, Capture);
BitBlt(Image, 0, 0, 1680, 920, Screen,
0, 0, SRCCOPY);
SelectObject(Image, OldBitmap);
Bitmap* bm2 = Bitmap::FromHBITMAP(Capture,NULL);
do {
if( q >= 14)
{
ergebniss = 2;
}
int nDifferentPixels = 0;
Color color1, color2;
for( int x=0; x<22; ++x ) {
for( int y=0; y<15; ++y ) {
if( Ok == bm1.GetPixel( x+(22*q),y, &color1 ) && Ok == bm2->GetPixel( bposx - 22 + x,bposy - 15 + y, &color2 ) ) {
if( color1.GetValue() != color2.GetValue() ) {
++nDifferentPixels;
}
}
}
}
//delete bm2;
if(nDifferentPixels <= 1)
{
//deleteDC(bm2);
//delete bm1;
ruck = q;
break;
}
++q;
} while(ergebniss != 2);
delete OldBitmap;
delete Capture;
DeleteDC(Image);
DeleteDC(Screen);
}
GdiplusShutdown(gdiplusToken);
Sleep(1000);
return ruck;
}