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 |
#include <windows.h> LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { char szClassName[] = "HelloWin"; HWND hwnd; MSG msg; WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = szClassName; if(!RegisterClass(&wc)) { MessageBox(NULL, "FEHLER", "FEHLER!!!", MB_OK); } hwnd = CreateWindow (szClassName, "HALLO WINDOWS!!!", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, iCmdShow); UpdateWindow(hwnd); while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); return 0; } } DefWindowProc(hwnd, message, wParam, lParam); } |
Anonymous
unregistriert
Anonymous
unregistriert
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 109 110 111 112 113 114 115 116 117 118 119 120 |
// \file: main.cpp // ########################################################################### // \created: 26.12.2008 // \author: Patrick Ullmann // \purpose: Hauptdatei. // ########################################################################### // \changes: // // 1 26.12.2008/Patrick Ullmann // Datei erstellt. // ########################################################################### // I N C L U D E S ########################################################### #include <windows.h> #include <windowsx.h> #include <tchar.h> // F U N K T I O N E N ####################################################### // /////////////////////////////////////////////////////////////////////////// // LOCAL // // Implementierung der Fenster-Nachricht: WM_CREATE. // // \param hwnd: Handle auf das Fenster, dem diese Message zugewiesen ist. // \param create_struct: Daten für die Erstellung des Fensters. // \result: 'true' wenn alles in Ordnung war, ansonsten 'false'. // /////////////////////////////////////////////////////////////////////////// bool on_create (::HWND hwnd, CREATESTRUCT* create_struct) { return (true); } // /////////////////////////////////////////////////////////////////////////// // LOCAL // // Implementierung der Fenster-Nachricht: WM_DESTROY. // // \param hwnd: Handle auf das Fenster, dem diese Message zugewiesen ist. // /////////////////////////////////////////////////////////////////////////// void on_destroy (::HWND hwnd) { ::PostQuitMessage (0); } // /////////////////////////////////////////////////////////////////////////// // LOCAL // // Fenster-Prozedur. // // \param hwnd: Handle auf das Fenster, dem diese Prozedur zugewiesen ist. // \param message: Message die Verarbeitet werden muss. // \param wParam: wParam der Nachricht. // \param lParam: lParam der Nachricht. // \result: Status-Code der Fensterprozedur. // /////////////////////////////////////////////////////////////////////////// ::LRESULT CALLBACK window_procedure (::HWND hwnd, ::UINT message, ::WPARAM wParam, ::LPARAM lParam) { switch (message) { HANDLE_MSG (hwnd, WM_CREATE, on_create); HANDLE_MSG (hwnd, WM_DESTROY, on_destroy); } return (::DefWindowProc (hwnd, message, wParam, lParam)); } // /////////////////////////////////////////////////////////////////////////// // LOCAL // // Programmeinsprungspunkt. // // \param instance: Instanz des Programms. // \param prev_instance: Vorherige Programminstanz (wird nicht mehr benutzt.) // \param argument: Übergabeargumente an das Programm. // \param show: SW_-Code des Programms. // \result: Exit-Code. // /////////////////////////////////////////////////////////////////////////// int WINAPI _tWinMain (::HINSTANCE instance, ::HINSTANCE prev_instance, ::TCHAR* argument, int show) { const ::TCHAR* name = _T ("test-fenster"); ::WNDCLASSEX window_class; ::ZeroMemory (&window_class, sizeof (window_class)); window_class.cbSize = sizeof (window_class); window_class.style = CS_VREDRAW | CS_HREDRAW; window_class.lpfnWndProc = window_procedure; window_class.hInstance = instance; window_class.hIcon = ::LoadIcon (NULL, MAKEINTRESOURCE (IDI_APPLICATION)); window_class.hCursor = ::LoadCursor (NULL, IDC_ARROW); window_class.hbrBackground = reinterpret_cast<::HBRUSH>(::GetStockObject (WHITE_BRUSH)); window_class.lpszClassName = name; if (!::RegisterClassEx (&window_class)) return 0; ::HWND hwnd = NULL; if (!::IsWindow (hwnd = ::CreateWindowEx (0, name, name, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, instance, NULL))) return 0; ::ShowWindow (hwnd, show); ::UpdateWindow (hwnd); ::MSG message; while (::GetMessage (&message, NULL, 0, 0)) { ::TranslateMessage (&message); ::DispatchMessage (&message); } return (message.wParam); } |
Anonymous
unregistriert
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 |
Compiler: Default compiler Building Makefile: "C:\Dev-Cpp\Makefile.win" Führt make clean aus rm -f Unbenannt1.o Projekt1.exe g++.exe -D__DEBUG__ -c Unbenannt1.cpp -o Unbenannt1.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -g3 g++.exe -D__DEBUG__ Unbenannt1.o -o "Projekt1.exe" -L"C:/Dev-Cpp/lib" -mwindows -g3 Ausführung beendet Kompilierung erfolgreich |
Quellcode |
|
1 |
Fehler insgesamt: 0 |
Anonymous
unregistriert
Zitat von »"Phil239"«
Was gibts nach deiner Meinung noch so für gute Compiler
Ich guck mir auch mal Code::Blocks an.
Werbeanzeige