Visual C++ für anfänger



  • Moin Moin,
    ich möchte in einem Win32-konsole-application ein Bitmap erzeugen und abspeichern, bisher sieht der versuch so aus:

    HWND hConsoleWindow = FindWindow("ConsoleWindowClass",NULL); 
    	HDC hDC = GetDC(hConsoleWindow); 
    	HDC hBitmapDC = CreateCompatibleDC(hDC);
    
    	HBITMAP  img = CreateCompatibleBitmap(hBitmapDC,600,600);
    
    	SelectObject(hBitmapDC,img); 
    
    	SetPixel(hBitmapDC, 1, 1, RGB(0,255,255) );
    	SetPixel(hBitmapDC, 1, 2, RGB(255,0,255) );
    	SetPixel(hBitmapDC, 1, 3, RGB(255,0,255) );
    	SetPixel(hBitmapDC, 1, 4, RGB(255,255,255) );
    	SetPixel(hBitmapDC, 1, 5, RGB(0,255,255)  );
    
    	Rectangle(hBitmapDC,0,0,10,10);	
    	int a = saveNow(hBitmapDC,600,600,&"Test.bmp");
    

    das funktioniert auch soweit,
    allerdings ist das gespeicherte bitmap nur schwarz weis, wie krieg ich sowas bunt hin?


Anmelden zum Antworten