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 |
1>.\Demo.rc(11) : fatal error RC1015: cannot open include file 'afxres.h'. |
Alter Hase
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 101 102 103 104 105 106 107 108 |
# include <stdio.h> # include <windows.h> # include <ddraw.h> # include <dsound.h> # include "ddutil.h" # include "dsutil.h" # include "resource.h" const int ultris_nettobreite = 360; // Breite des Inneren des Haupfensters const int ultris_nettohoehe = 520; // Hoehe des Inneren des Hauptfensters int ultris_bruttobreite; // Breite des gesamten Haupfensters (incl. Rahmen) int ultris_bruttohoehe; // Hoehe des gesamten Haupfensters (incl. Rahmen) HINSTANCE ultris_instance; // Instanz der Ultris Applikation HWND ultris_window; // Das Hauptfenster von Ultris HMENU ultris_menu; // Das Menu von Ultris // ultris_windowhandler LRESULT CALLBACK ultris_windowhandler( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_COMMAND: switch( LOWORD( wParam)) { case IDM_EXIT: PostMessage( hWnd, WM_CLOSE, 0, 0); return 0; } break; case WM_GETMINMAXINFO: ((MINMAXINFO *)lParam)->ptMinTrackSize.x = ((MINMAXINFO *)lParam)->ptMaxTrackSize.x = ultris_bruttobreite; ((MINMAXINFO *)lParam)->ptMinTrackSize.y = ((MINMAXINFO *)lParam)->ptMaxTrackSize.y = ultris_bruttohoehe; return 0; case WM_DESTROY: PostQuitMessage( 0); return 0; } return DefWindowProc(hWnd, msg, wParam, lParam); } /* ** WinMain */ int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pCmdLine, int nCmdShow) { MSG msg; HACCEL acc; WNDCLASSEX wcx; ultris_instance = hInst; wcx.cbSize = sizeof( wcx); wcx.lpszClassName = TEXT( "Ultris"); wcx.lpfnWndProc = ultris_windowhandler; wcx.style = CS_VREDRAW | CS_HREDRAW; wcx.hInstance = hInst; wcx.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( IDI_MAIN)); wcx.hIconSm = LoadIcon( hInst, MAKEINTRESOURCE( IDI_MAIN)); wcx.hCursor = LoadCursor( NULL, IDC_ARROW); wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcx.lpszMenuName = MAKEINTRESOURCE( IDR_MENU); wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; if( !RegisterClassEx( &wcx)) return 0; acc = LoadAccelerators( hInst, MAKEINTRESOURCE(IDR_ACCEL)); ultris_bruttohoehe = ultris_nettohoehe + 2*GetSystemMetrics( SM_CYSIZEFRAME) + GetSystemMetrics( SM_CYMENU) + GetSystemMetrics( SM_CYCAPTION); ultris_bruttobreite = ultris_nettobreite + 2*GetSystemMetrics( SM_CXSIZEFRAME); ultris_window = CreateWindowEx( 0, TEXT( "Ultris"), TEXT( "Ultris"), WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, ultris_bruttobreite, ultris_bruttohoehe, NULL, NULL, hInst, NULL); if( !ultris_window) return 0; ultris_menu = GetMenu( ultris_window); MoveWindow( ultris_window, (GetSystemMetrics(SM_CXSCREEN)-ultris_bruttobreite)/2, (GetSystemMetrics(SM_CYSCREEN)-ultris_bruttohoehe)/2, ultris_bruttobreite, ultris_bruttohoehe, TRUE); ShowWindow( ultris_window, nCmdShow); while( TRUE) { if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE)) { if( GetMessage( &msg, NULL, 0, 0 ) == 0) return 0; // Message ist WM_QUIT if( TranslateAccelerator( ultris_window, acc, &msg) == 0) { TranslateMessage( &msg); DispatchMessage( &msg); } } else { // Hier koennen wir uns um das Spiel kuemmern } } } |
Werbeanzeige