000
23.06.2004, 18:24 Uhr
~fasmat
Gast
|
Also ich hab hier ein kleines Programm in MVC++ 6.0 geschrieben. Es erstellt ein Fenster mit 3 Buttons und einer Editbox. Und da liegt das Problem: Ich kann nichts in die Editbox eingeben!!!
C++: |
#include <windows.h>
#define BUTTON_READ 1 #define BUTTON_WRITE 2 #define BUTTON_EXIT 3 #define EDIT_FILE 4
char ClassName[] = "Test"; HINSTANCE hInstGlobal;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { hInstGlobal = hInstance;
WNDCLASS WndClass; WndClass.style = 0; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.lpfnWndProc = WndProc; WndClass.hInstance = hInstance; WndClass.hbrBackground = (HBRUSH)COLOR_WINDOW; WndClass.hCursor = LoadCursor (NULL, IDC_ARROW); WndClass.hIcon = LoadIcon (NULL, IDI_APPLICATION); WndClass.lpszMenuName = 0; WndClass.lpszClassName = ClassName; RegisterClass(&WndClass);
HWND hWindow; hWindow = CreateWindow (ClassName,"Test", WS_SYSMENU, 0, 0, 500, 500, NULL, NULL, hInstance, NULL);
ShowWindow (hWindow, nCmdShow); UpdateWindow (hWindow);
MSG Message;
while (GetMessage(&Message, NULL, 0, 0)) DispatchMessage(&Message);
return (Message.wParam); }
LRESULT CALLBACK WndProc (HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam) { switch(uiMessage) { case WM_CREATE: HWND hButtonRead, hButtonWrite, hButtonExit, hEditFile; hButtonRead = CreateWindow("BUTTON", "Lesen", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10, 340, 140, 20, hWnd, (HMENU) BUTTON_READ, hInstGlobal, NULL); hButtonWrite = CreateWindow("BUTTON", "Schreiben", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 160, 340, 140, 20, hWnd, (HMENU) BUTTON_WRITE, hInstGlobal, NULL);
hButtonExit = CreateWindow("BUTTON", "Beenden", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 310, 340, 140, 20, hWnd, (HMENU) BUTTON_EXIT, hInstGlobal, NULL); hEditFile = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, 10, 10, 140, 30, hWnd, (HMENU) EDIT_FILE, hInstGlobal, NULL); return 0;
case WM_COMMAND: if (HIWORD(wParam) == BN_CLICKED) { if (LOWORD(wParam) == BUTTON_READ) { // Hier kommt noch Code hin }
if (LOWORD(wParam) == BUTTON_WRITE) { // Hier kommt noch Code hin }
if (LOWORD(wParam) == BUTTON_EXIT) SendMessage (GetParent((HWND)lParam), WM_DESTROY ,0 ,0); } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProc (hWnd, uiMessage, wParam, lParam); } }
|
Bitte helft mir! |