000
22.01.2011, 11:07 Uhr
~niemandname
Gast
|
C++: |
class TWindow { private: HWND hwnd; MSG msg; HINSTANCE hInstance; char lpszWndTitle[256]; public: BOOL Create(WNDCLASSEX wc); BOOL Show(); int Left; int Top; int Width; int Height; char *Caption; };
LPCSTR lpszAppName = "TWindowApp";
// Fenster erstellen
BOOL TWindow::Create(WNDCLASSEX wc) { wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)wc.lpfnWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL,IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszClassName = lpszAppName; wc.lpszMenuName = lpszAppName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wc);
Show();
while (GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }
// Fenster anzeigen
BOOL TWindow::Show() { hwnd = CreateWindowEx(NULL, lpszAppName, Caption, WS_OVERLAPPEDWINDOW, Left, Top, Width, Height, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, 1); UpdateWindow(hwnd);
return 0; }
|
Meine Frage: Was meint ihr über diesen Fensterwrapper? Was kann man verbessern? Ich würde mich auf positive sowie auch auf negative Kritik freuen. |