Screenshot vom aktuellen Fenster
-
Mach erstmal aus
BitBlt("screenie.bmp",0,0,640,480,hBIT,0,0,PATINVERT);HDC dc_dest = CreateCompatibleDC(hDC); // kompatiblen zieldc anlegen HGDIOBJ old = SelectObject(dc_dest, hBit); // selektieren und altes objekt behalten BitBlt(dc_dest,0,0,640,480,hDC,0,0,SRCCOPY); // blitten SelectObject(dc_dest, old); // aufräumen DeleteDC(dc_dest); // aufräumenSo, jetzt solltest du das Bild in hBit haben. Gleich gehts hier weiter...
-
mad_martin schrieb:
Bin mir nicht ganz sicher, aber schau mal in der GDI+ bei der Bitmap-Klasse nach. Die nimmt iirc u.a. ein HBITMAP (also handle) im Konstruktor an, um ein Bitmap-Objekt zu erzeugen. Da müsste es eine Methode geben, die die ganze Sache recht einfach als Datei speichert. Aber alles erstmal ohne Gewähr!
ahh dann hatte ich das doch schon richtig gesehen, ok danke
-
So, nun noch das Speichern:
Hier ist der Konstruktor der Bitmap-Klasse aus GDI+, den ich meinte:
http://msdn2.microsoft.com/en-us/library/ms536314(VS.85).aspxÜber die benötigte Palette bin ich mir nicht mehr ganz im Klaren, da das schon einige Zeit her ist. Glaube, die kann man u.U. ignorieren. Wäre schön, wenn hierzu noch jemand eine Antwort hätte!
Naja, gespeichert wird auf jeden Fall mit:
http://msdn2.microsoft.com/en-us/library/ms535407(VS.85).aspxDen richtige Encoder auszuwählen überlasse ich dem geneigten Leser

-
Sorry dass ich erst so spät antworte, aber ich habe jetzt ne Zeit probiert und gesucht, doch wo kriege ich die gdiplus.h her die ich einbinden muss?
-
Zu finden z.B. im "Windows SDK" oder "Platform SDK"
-
Ok, ich mal wieder. Hab das Platform SDK runtergeladen, alles installiert usw. jetzt will ich kompilieren und:
..\..\..\..\..\Programme\Microsoft SDK\include\winnt.h|674|#error Must define a target architecture.| ..\..\..\..\..\Programme\Microsoft SDK\include\rpcnterr.h|4|warning: "/*" within comment| ..\..\..\..\..\Programme\Microsoft SDK\include\wtypes.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\wtypes.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\unknwn.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\objidl.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\objidl.h|6545|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\objidl.h|6561|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\urlmon.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\oaidl.h|442|pasting "/" and "/" does not give a valid preprocessing token| ..\..\..\..\..\Programme\Microsoft SDK\include\oaidl.h|442|error: expected unqualified-id before '/' token| ..\..\..\..\..\Programme\Microsoft SDK\include\oaidl.h|457|pasting "/" and "/" does not give a valid preprocessing token| ..\..\..\..\..\Programme\Microsoft SDK\include\oaidl.h|457|error: expected unqualified-id before '/' token| ..\..\..\..\..\Programme\Microsoft SDK\include\urlmon.h|277|warning: ignoring #pragma comment | ..\..\..\..\..\Programme\Microsoft SDK\include\propidl.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\propidl.h|310|pasting "/" and "/" does not give a valid preprocessing token| ..\..\..\..\..\Programme\Microsoft SDK\include\propidl.h|310|error: expected unqualified-id before '/' token| ..\..\..\..\..\Programme\Microsoft SDK\include\propidl.h|1423|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\propidl.h|1424|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\oaidl.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\oleidl.h|17|warning: ignoring #pragma warning | ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|534|error: use of enum `EmfPlusRecordType' without previous declaration| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|548|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|548|error: enumerator value for `WmfRecordTypeSetBkColor' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|549|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|549|error: enumerator value for `WmfRecordTypeSetBkMode' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|550|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|550|error: enumerator value for `WmfRecordTypeSetMapMode' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|551|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|551|error: enumerator value for `WmfRecordTypeSetROP2' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|552|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|552|error: enumerator value for `WmfRecordTypeSetRelAbs' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|553|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|553|error: enumerator value for `WmfRecordTypeSetPolyFillMode' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|554|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|554|error: enumerator value for `WmfRecordTypeSetStretchBltMode' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|555|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|555|error: enumerator value for `WmfRecordTypeSetTextCharExtra' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|556|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|556|error: enumerator value for `WmfRecordTypeSetTextColor' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|557|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|557|error: enumerator value for `WmfRecordTypeSetTextJustification' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|558|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|558|error: enumerator value for `WmfRecordTypeSetWindowOrg' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|559|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|559|error: enumerator value for `WmfRecordTypeSetWindowExt' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|560|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|560|error: enumerator value for `WmfRecordTypeSetViewportOrg' not integer constant| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|561|error: invalid use of undefined type `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|543|error: forward declaration of `enum Gdiplus::EmfPlusRecordType'| ..\..\..\..\..\Programme\Microsoft SDK\include\GdiplusEnums.h|561|error: enumerator value for `WmfRecordTypeSetViewportExt' not integer constant| ||More errors follow but not being shown.| ||Edit the max errors limit in compiler options...| ||=== Build finished: 50 errors, 14 warnings ===|Jede Menge Fehler, woran liegts?
-
Weiß wirklich keiner woran es liegt?
-
BlitzBasic303 schrieb:
Wichtig ist bei dem ganzen dass ich es in einem kommerziellen Programm nutzen darf, und dafür möglichst wenig oder garnichts zahlen muss (wobei mir garnix eig. besser gefällt). Also dass es nicht unter einer Lizenz steht.
wieviel willste ausgeben
-
Evtl. falsche Header-Reihenfolge?
http://msdn2.microsoft.com/en-us/library/aa383745(VS.85).aspx beachtet?
-
Ok, den Link versteh ich nicht ganz ^^ Meine Header sind so eingebunden
#include <irrlicht.h> #include <math.h> #include <stdlib.h> #include <iostream> #include <windows.h> #include <winuser.h> #include <winreg.h> #include <time.h> #include <fstream> #include <ctime> #include <string.h> #include <stdio.h> #include <gdiplus.h>