Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
#include <windows.h> #include <ddraw.h> LPDIRECTDRAW7 lpDirectDraw; // DirectDraw-Objekt HRESULT ddrval; LONG FAR WINAPI WndProc (HWND , UINT , UINT , LONG) ; int WINAPI WinMain (HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow) { MSG msg ; HWND hwnd ; WNDCLASS wndclass ; LPCTSTR WindowClassName = L"DDWinClass"; LPCTSTR WindowTitle = L"DirectDraw - Tutorial"; if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL , IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL , IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH)GetStockObject (LTGRAY_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = WindowClassName ; RegisterClass (&wndclass) ; } hwnd = CreateWindow (WindowClassName , WindowTitle , WS_OVERLAPPEDWINDOW , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , NULL , NULL , hInstance , NULL) ; ShowWindow (hwnd , nCmdShow) ; UpdateWindow (hwnd) ; ddrval = DirectDrawCreateEx(NULL, (VOID**)&lpDirectDraw, IID_IDirectDraw7, NULL); if (ddrval != DD_OK) { return (0); } ddrval = lpDirectDraw->SetCooperativeLevel (hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (ddrval != DD_OK) { lpDirectDraw->Release(); lpDirectDraw = NULL; return (0); } ddrval = lpDirectDraw->SetDisplayMode (640, 480, 8, 0, 0); if (ddrval != DD_OK) { lpDirectDraw->Release(); lpDirectDraw = NULL; return (0); } while(1) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } } if (lpDirectDraw != NULL) { lpDirectDraw->Release(); lpDirectDraw = NULL; } return msg.wParam ; } LONG FAR WINAPI WndProc (HWND hwnd , UINT message , UINT wParam , LONG lParam) { switch (message) { case WM_DESTROY: { PostQuitMessage (0) ; return 0 ; } break; } // switch (message) return DefWindowProc (hwnd , message , wParam , lParam) ; } // WndProc |
Zitat
Error 4 error LNK2001: unresolved external symbol _IID_IDirectDraw7 DDraw.obj
...
Error 3 error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced in function _WinMain@16 DDraw.obj
...
Error 5 fatal error LNK1120: 2 unresolved externals C:\Dokumente und Einstellungen\$ilentSnooc\Eigene Dateien\Visual Studio 2005\C++ Projects\3D Programmierung\S37\Übungen\DirectDraw\Debug\DirectDraw.exe 1
Anonymous
unregistriert
Administrator
Zitat von »"DarkRaider"«
In der Directory Einstellungen, wo du das DXSDK eingebunden hast musst du die DXSDK Verzeichnisse an die erste Stelle verschieben, dann gehts!
Anonymous
unregistriert
Zitat von »"David Scherfgen"«
Sagt das Tutorial nicht, dass du ddraw.lib (und wahrscheinlich auch dxguid.lib) linken musst?
Zitat
Error 1 fatal error LNK1104: cannot open file 'ddraw.lib,' DirectDraw
Anonymous
unregistriert
Anonymous
unregistriert
Werbeanzeige