![]() |
NonVCL auf Buttons reagieren
Delphi-Quellcode:
versuch grad ein existierendes Projekt NonVCL zu machen Allerdings bei Case komm ich net weiter
function WndProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM;
lParam: LPARAM): LRESULT; stdcall; begin Result := 0; case uMsg of WM_CREATE: begin IDLoad := createwindow('BUTTON', 'Load Container', WS_VISIBLE or WS_CHILD, 10, 130, 150, 25, hwnd, 0, hInstance, nil); IDClb := createwindow('BUTTON', 'Save to Clipboard', WS_VISIBLE or WS_CHILD, 160, 130, 150, 25, hwnd, 0, hInstance, nil); IDSav := createwindow('BUTTON', 'Save to File', WS_VISIBLE or WS_CHILD, 310, 130, 150, 25, hwnd, 0, hInstance, nil); IDMemo := CreateWindow('Edit', '', WS_VISIBLE or WS_CHILD, 10, 5, 450, 120, hwnd, 0, hInstance, nil); IDLab := createwindow('Static', 'Test', WS_VISIBLE or WS_CHILD, 130, 190, 150, 25, hwnd, 0, hInstance, nil); end; WM_DESTROY: begin PostQuitMessage(0); end; WM_COMMAND: if hiword(wparam) = BN_CLICKED then begin Case loword(wparam) of IDLoad : MessageBox(hwnd, 'Load Button gedrückt', 'Meldung', 0); //Hier hängts IDClb : MessageBox(hwnd, 'Clipboard Button gedrückt', 'Meldung', 0); IDSav : MessageBox(hwnd, 'Speichern Button gedrückt', 'Meldung', 0); IDMemo : MessageBox(hwnd, 'Memo gedrückt', 'Meldung', 0); else Result := DefWindowProc(hWnd, uMsg, wParam, lParam); end; end; end; end; 1. [Pascal Fehler] NonVCL.dpr(188): E2026 Konstantenausdruck erwartet 2. Frage wird nach Case nicht mit end; geschlossen |
Re: NonVCL auf Buttons reagieren
Rück mal deine "ends" gescheit ein. Und was ist Zeile 188? Dann können wir weiter überkegen, was du falsch machst. Aber du kannst dir ja auch schon mal mein Tutorial angucken:
![]() |
Re: NonVCL auf Buttons reagieren
Delphi-Quellcode:
function WndProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM;
lParam: LPARAM): LRESULT; stdcall; begin Result := 0; case uMsg of WM_CREATE: begin IDLoad := createwindow('BUTTON', 'Load Container', WS_VISIBLE or WS_CHILD, 10, 130, 150, 25, hwnd, 0, hInstance, nil); IDClb := createwindow('BUTTON', 'Save to Clipboard', WS_VISIBLE or WS_CHILD, 160, 130, 150, 25, hwnd, 0, hInstance, nil); IDSav := createwindow('BUTTON', 'Save to File', WS_VISIBLE or WS_CHILD, 310, 130, 150, 25, hwnd, 0, hInstance, nil); IDMemo := CreateWindow('Edit', '', WS_VISIBLE or WS_CHILD, 10, 5, 450, 120, hwnd, 0, hInstance, nil); IDLab := createwindow('Static', 'Test', WS_VISIBLE or WS_CHILD, 130, 190, 150, 25, hwnd, 0, hInstance, nil); end; WM_DESTROY: begin PostQuitMessage(0); end; WM_COMMAND: if hiword(wparam) = BN_CLICKED then begin Case loword(wparam) of IDLoad : MessageBox(hwnd, 'Load Button gedrückt', 'Meldung', 0); //Zeile 188 IDClb : MessageBox(hwnd, 'Clipboard Button gedrückt', 'Meldung', 0); IDSav : MessageBox(hwnd, 'Speichern Button gedrückt', 'Meldung', 0); IDMemo : MessageBox(hwnd, 'Memo gedrückt', 'Meldung', 0); else Result := DefWindowProc(hWnd, uMsg, wParam, lParam); End; end; end; end; |
Re: NonVCL auf Buttons reagieren
1. Im
Delphi-Quellcode:
steht die ID des Fensters und nicht dessen Handle.
loword(wparam)
2. Muss dies eine Konstante sein. 3. Dann klappt es auch mit case. ;) Das Handle brauchst du dir auch nicht zu merken in einer globalen Variable, da du mit ![]() |
Re: NonVCL auf Buttons reagieren
habs Hinbekommen :-D
Man ist das Kompliziert da kommen die nächsten Tage bestimmt noch mehr Fragen Danke |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz