007
01.11.2004, 12:52 Uhr
RedEagle
|
Dank DEV-CPP läuft allerdings sieht man nicht (außer im Task-manager) hier mal der Komplette code:
C++: |
//////////////////// Main.cpp ////////////////////
//#pragma comment(lib, "ddraw.lib") // jetzt verwende libddraw.a von DEV-CPP //#pragma comment(lib, "dxguid.lib") // jetzt verwende libdxguid.a von DEV-CPP
#define WIN32_LEAN_AND_MEAN // MFC abschalten (Nur unnötiger Ballast) #include <windows.h> #include <dx\ddraw.h>
LPDIRECTDRAW7 DirectDraw; // Pointer auf das DirectDraw-Object HRESULT ddrval; // Wichtig für unsere Rückgabewerte
LRESULT CALLBACK WindowProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { switch (message) { case WM_DESTROY: { DirectDraw->Release(); DirectDraw = NULL; PostQuitMessage(0); return(0); } break;
default: break; } return (DefWindowProc(hwnd,message,wparam,lparam)); }
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE hprevinst,LPSTR lpcmdline,int ncmdshow) { WNDCLASSEX winclass; // Die Fensterstruktur HWND hwnd; MSG message; const char szclassname[]="Klassenname";
winclass.cbSize = sizeof (WNDCLASSEX); winclass.style = CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hinst; winclass.hIcon = LoadIcon (NULL,IDI_APPLICATION); winclass.hCursor = LoadCursor(NULL,IDC_ARROW); winclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = szclassname;
//HIER HABE ICH DEN ERSTEN PARAMETER BEAREITET hwnd = CreateWindowEx (/*NULL*/WS_EX_APPWINDOW, szclassname, "Titelleiste", WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hinst, NULL);
ShowWindow(hwnd,ncmdshow); UpdateWindow(hwnd);
ddrval = DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL); ddrval = DirectDraw->SetCooperativeLevel (hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ddrval = DirectDraw->SetDisplayMode (800,600,16, 0, 0);
while (GetMessage(&message,NULL,0,0)) { TranslateMessage(&message); DispatchMessage(&message); } return message.wParam ; }
|
-- MFG RedEagle |