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 101 102 103 104 105 106 107 108 |
#define UNICODE #include <windows.h> // Namespace fix für das Menü namespace fix { const unsigned short IDM_NEW = 0; const unsigned short IDM_OPEN = 0; const unsigned short IDM_SAVE = 0; const unsigned short IDM_SAVEAS = 0; const unsigned short IDM_QUIT = 0; const unsigned short IDM_UNDO = 0; const unsigned short IDM_REDO = 0; const unsigned short IDM_CUT = 0; const unsigned short IDM_COPY = 0; const unsigned short IDM_PASTE = 0; const unsigned short IDM_SELECTALL = 0; const unsigned short IDM_DESELECTALL = 0; const unsigned short IDM_IMPORT = 0; } LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // Globale Variablen WPARAM wParam; ::HWND hWnd; ::WNDCLASS wndcls; ::MSG msg; HMENU hMenu_ = CreateMenu(); HMENU hMenuTemp = CreateMenu(); HMENU hMenuObject = CreateMenu(); HMENU hMenuTemp2 = CreateMenu(); HMENU hMenuCharakter = CreateMenu(); HMENU hMenuLevel = CreateMenu(); const unsigned short ID_NEWFILE = fix::IDM_NEW; int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow) { // -- Obermenü -- // Das Dateinemü AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_NEW, L"&Neu\tStrg + N"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_OPEN, L"&Öffnen ...\tStrg + 0"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_SAVE, L"&Speichern\tStrg + S"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_SAVEAS, L"&Speichern unter ..."); AppendMenuW(hMenuTemp, MF_SEPARATOR, 0, NULL); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_QUIT, L"&Beenden\tStrg + Q"); AppendMenu(hMenu_, MF_POPUP, (UINT_PTR)hMenuTemp, L"&Datei"); hMenuTemp = CreateMenu(); // Das Bearbeitenmenü AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_UNDO, L"&Rückgängig\tStr + Z"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_REDO, L"&Wiederherstellen\tStr + Y"); AppendMenuW(hMenuTemp, MF_SEPARATOR, 0, NULL); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_CUT, L"&Ausschneiden\tStr + X"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_COPY, L"&Kopieren\tStr + C"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_PASTE, L"&Einfügen\tStr + V"); AppendMenuW(hMenuTemp, MF_SEPARATOR, 0, NULL); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_SELECTALL, L"&Alles auswählen\tStr + A"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_DESELECTALL, L"&Alles auswählen\tStr + Shift + A"); AppendMenu(hMenu_, MF_POPUP, (UINT_PTR)hMenuTemp, L"&Bearbeiten"); hMenuTemp = CreateMenu(); // Informationen für das Fenster wndcls.cbClsExtra = 0; wndcls.cbWndExtra = 0; wndcls.hbrBackground = static_cast<HBRUSH>(::GetStockObject((int)WHITE_BRUSH)); wndcls.hCursor = NULL; wndcls.hIcon = NULL; wndcls.hInstance = hInstance; wndcls.lpfnWndProc = WindowProc; wndcls.lpszClassName = L"app"; wndcls.lpszMenuName = NULL; // <= Menu rein wndcls.style = CS_HREDRAW | CS_VREDRAW; if(!::RegisterClassW(&wndcls)) return -1; // Fenster erstellen hWnd = ::CreateWindowW( L"app", L"Test" , WS_OVERLAPPEDWINDOW, 0, 0, 1280, 782, ::GetDesktopWindow(), hMenu_, hInstance, NULL); if(!hWnd) // Fehler beim erstellen des Fensters return -1; ::ShowWindow(hWnd, nCmdShow); ::UpdateWindow(hWnd); while(::GetMessageW(&msg, NULL, NULL, NULL)) { ::TranslateMessage(&msg); ::DispatchMessageW(&msg); } return 0; } LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CLOSE: PostQuitMessage(0); return 0; case WM_COMMAND: if(HIWORD(wParam) == ID_NEWFILE) MessageBox(hWnd, L"Sie haben auf Neu gedrückt!", L"Neu", MB_OK); }; return ::DefWindowProcW(hwnd, uMsg, wParam, lParam); } |
Zitat von »"Das Gurke"«
AUTSCH!
C-/C++-Quelltext
1 2 3 4 5 6 7 8 9 10 11 Edit: [cpp]namespace fix { const unsigned short IDM_NEW = 0; const unsigned short IDM_OPEN = 0; const unsigned short IDM_SAVE = 0; const unsigned short IDM_SAVEAS = 0; const unsigned short IDM_QUIT = 0; const unsigned short IDM_AREAMANAGER = 0; const unsigned short IDM_DRAWCOORDS = 0; }
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 |
#define UNICODE #include <windows.h> // Namespace fix für das Menü namespace fix { const unsigned short IDM_NEW = 0; const unsigned short IDM_OPEN = 1; const unsigned short IDM_SAVE = 2; const unsigned short IDM_SAVEAS =3; const unsigned short IDM_QUIT = 4; const unsigned short IDM_UNDO = 5; const unsigned short IDM_REDO = 6; const unsigned short IDM_CUT = 7; const unsigned short IDM_COPY = 8; const unsigned short IDM_PASTE = 9; const unsigned short IDM_SELECTALL = 10; const unsigned short IDM_DESELECTALL = 11; const unsigned short IDM_IMPORT = 12; } LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // Globale Variablen WPARAM wParam; ::HWND hWnd; ::WNDCLASS wndcls; ::MSG msg; HMENU hMenu_ = CreateMenu(); HMENU hMenuTemp = CreateMenu(); HMENU hMenuObject = CreateMenu(); HMENU hMenuTemp2 = CreateMenu(); HMENU hMenuCharakter = CreateMenu(); HMENU hMenuLevel = CreateMenu(); const unsigned short ID_NEWFILE = fix::IDM_NEW; int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow) { // -- Obermenü -- // Das Dateinemü AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_NEW, L"&Neu\tStrg + N"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_OPEN, L"&Öffnen ...\tStrg + 0"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_SAVE, L"&Speichern\tStrg + S"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_SAVEAS, L"&Speichern unter ..."); AppendMenuW(hMenuTemp, MF_SEPARATOR, 0, NULL); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_QUIT, L"&Beenden\tStrg + Q"); AppendMenu(hMenu_, MF_POPUP, (UINT_PTR)hMenuTemp, L"&Datei"); hMenuTemp = CreateMenu(); // Das Bearbeitenmenü AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_UNDO, L"&Rückgängig\tStr + Z"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_REDO, L"&Wiederherstellen\tStr + Y"); AppendMenuW(hMenuTemp, MF_SEPARATOR, 0, NULL); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_CUT, L"&Ausschneiden\tStr + X"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_COPY, L"&Kopieren\tStr + C"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_PASTE, L"&Einfügen\tStr + V"); AppendMenuW(hMenuTemp, MF_SEPARATOR, 0, NULL); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_SELECTALL, L"&Alles auswählen\tStr + A"); AppendMenuW(hMenuTemp, MF_STRING, fix::IDM_DESELECTALL, L"&Alles auswählen\tStr + Shift + A"); AppendMenu(hMenu_, MF_POPUP, (UINT_PTR)hMenuTemp, L"&Bearbeiten"); hMenuTemp = CreateMenu(); // Informationen für das Fenster wndcls.cbClsExtra = 0; wndcls.cbWndExtra = 0; wndcls.hbrBackground = static_cast<HBRUSH>(::GetStockObject((int)WHITE_BRUSH)); wndcls.hCursor = NULL; wndcls.hIcon = NULL; wndcls.hInstance = hInstance; wndcls.lpfnWndProc = WindowProc; wndcls.lpszClassName = L"app"; wndcls.lpszMenuName = NULL; // <= Menu rein wndcls.style = CS_HREDRAW | CS_VREDRAW; if(!::RegisterClassW(&wndcls)) return -1; // Fenster erstellen hWnd = ::CreateWindowW( L"app", L"Test" , WS_OVERLAPPEDWINDOW, 0, 0, 1280, 782, ::GetDesktopWindow(), hMenu_, hInstance, NULL); if(!hWnd) // Fehler beim erstellen des Fensters return -1; ::ShowWindow(hWnd, nCmdShow); ::UpdateWindow(hWnd); while(::GetMessageW(&msg, NULL, NULL, NULL)) { ::TranslateMessage(&msg); ::DispatchMessageW(&msg); } return 0; } LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CLOSE: PostQuitMessage(0); return 0; case WM_COMMAND: if(HIWORD(wParam) == ID_NEWFILE) MessageBox(hWnd, L"Sie haben auf Neu gedrückt!", L"Neu", MB_OK); }; return ::DefWindowProcW(hwnd, uMsg, wParam, lParam); } |
C-/C++-Quelltext |
|
1 |
if(HIWORD(wParam) == IDM_NEW) |
Werbeanzeige