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
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 |
#include <windows.h> #include <tchar.h> LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); LRESULT CALLBACK EditProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_HREDRAW | CS_VREDRAW, WndProc, 0, 0, hInstance, LoadIcon( NULL, IDI_APPLICATION ), LoadCursor( NULL, IDC_ARROW ), GetSysColorBrush( COLOR_BTNFACE ), NULL, _T( "MyCoolWindowClass" ), LoadIcon( NULL, IDI_APPLICATION ) }; if ( !RegisterClassEx( &wc ) ) { OutputDebugString( _T( "RegisterClassEx failed!" ) ); return 0; } HWND hWnd = CreateWindowEx( WS_EX_WINDOWEDGE, _T( "MyCoolWindowClass" ), _T( "Foobar Test" ), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInstance, NULL ); if ( !hWnd ) { OutputDebugString( _T( "CreateWindowEx failed!" ) ); return 0; } HWND hEdit = CreateWindowEx( WS_EX_CLIENTEDGE, _T( "EDIT" ), _T( "Please press enter..." ), WS_VISIBLE | WS_CHILD, 307, 290, 186, 20, hWnd, NULL, hInstance, NULL ); LONG_PTR pWndProc = SetWindowLongPtr( hEdit, GWL_WNDPROC, ( LONG )EditProc ); SetWindowLongPtr( hEdit, GWL_USERDATA, pWndProc ); SetFocus( hEdit ); ShowWindow( hWnd, SW_SHOW ); UpdateWindow( hWnd ); while ( GetMessage( &msg, NULL, 0, 0 ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } return ( int )msg.wParam; } LRESULT CALLBACK EditProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { WNDPROC pWndProc = ( WNDPROC )GetWindowLongPtr( hWnd, GWL_USERDATA ); switch ( uMsg ) { case WM_KEYDOWN: if ( wParam == VK_RETURN ) { MessageBox( hWnd, _T( "Return pressed" ), _T( "Info" ), MB_OK | MB_ICONINFORMATION ); return FALSE; } default: return CallWindowProc( pWndProc, hWnd, uMsg, wParam, lParam ); } return 0; } LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch ( uMsg ) { case WM_CLOSE: PostQuitMessage( 0 ); break; default: return DefWindowProc( hWnd, uMsg, wParam, lParam ); } return 0; } |
Anonymous
unregistriert
Anonymous
unregistriert
Also deregistrieren tu ich immer, weil ich weiß, dass Windows Mobile das nicht macht, aber das Zerstören ist ein automatischer Vorgang.Zitat von »"David_pb"«
Dann müsst man aber, konsequenter Weise, auch das Fenster zerstören und die Fensterklasse deregistrieren.
Werbeanzeige