user-0 提问: 子窗口控件问题

回复:
user: user-1
content: CreateWindow             参数 lpClassName     EDIT    检查创建编辑框 给的参数给的对不对。

user: user-2
content: 稍微修改了下LZ的代码，请参考。 #include<Windows.h> //#include "header.h"  /* header.h start */ #define BUTTONS 3 #define MAXSIZE 20 // ??? struct ChildWindow { 	ULONG iStyle; 	CONST TCHAR* szText; }; /* header.h end */  LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { 	TCHAR szAppName[] = TEXT("Computation"); 	WNDCLASS		wndclass; 	HWND			hwnd; 	MSG				msg;  	wndclass.style = CS_VREDRAW | CS_HREDRAW; 	wndclass.lpfnWndProc = WndProc;									//设定窗口消息处理程序 	wndclass.cbClsExtra = 0;										//在窗口类别结构中预留一些额外空间 	wndclass.cbWndExtra = 0;										//在Windows内部保存的窗口结构中预留一些额外空间 	wndclass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);	//设定画刷 	wndclass.hInstance = hInstance;								//程序的执行实体句柄 	wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);			//设定程序图标 	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);			//设定光标 	wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);		//窗口的背景颜色 	wndclass.lpszMenuName = NULL;									//指定窗口类别菜单 	wndclass.lpszClassName = szAppName;								//窗口类别的名称  	RegisterClass(&wndclass);												//注册窗口  	hwnd = CreateWindow(szAppName,											//窗口类别的名称 		TEXT("计算方法"),													//窗口标题 		WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX,			//标准窗口且窗口不能缩放 		CW_USEDEFAULT,														//窗口左上角相对于屏幕左上角的初始位置(x坐标轴方向) 		CW_USEDEFAULT,														//窗口左上角相对于屏幕左上角的初始位置(y坐标轴方向) 		600,																//窗口x轴方向的大小 		400,																//窗口y轴方向的大小 		NULL,																//父母窗口句柄 		NULL,																//窗口菜单句柄 		hInstance,															//程序执行实体句柄 		NULL																//执行参数 		);  	ShowWindow(hwnd, iCmdShow);						//显示窗口 	UpdateWindow(hwnd);					        //重画窗口，发送消息WM_PAINT   	while (GetMessage(&msg, NULL, 0, 0)) 	{ 		TranslateMessage(&msg); 		DispatchMessage(&msg); 	} 	return msg.wParam; }  LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { 	static int			cxChar, cyChar, i, j; 	static	HWND		hwndButton[BUTTONS], hwndEdit[MAXSIZE*MAXSIZE]; 	static	HWND		temp; 	HDC					hdc; 	PAINTSTRUCT			ps; 	struct ChildWindow	childwindow[] = { 		BS_PUSHBUTTON, TEXT("高斯顺序消元法"), 		BS_PUSHBUTTON, TEXT("高斯列主元消元法"), 		BS_PUSHBUTTON, TEXT("LU分解"), 		WS_BORDER, NULL, 	};  	switch (message) 	{ 	case WM_CREATE:					//函数CreateWindow调用发送VM_CREATE #if 1 		temp = CreateWindow(TEXT("edit"), TEXT("YEDS"), 			WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT, 			100, 120, 100, 100, 			hwnd, (HMENU)20,  			((LPCREATESTRUCT)lParam)->hInstance, NULL); #else 		temp = CreateWindow(TEXT("input"), TEXT("YEDS"), 			WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 			0, 0, 0, 0, 			//100, 10, 100, 100, 			hwnd, (HMENU)20, ((LPCREATESTRUCT)lParam)->hInstance, NULL 			); #endif 		for (i = 0; i < BUTTONS; i++) 		{ 			hwndButton[i] = CreateWindow(TEXT("button"), childwindow[i].szText, 				WS_CHILD | WS_VISIBLE | childwindow[i].iStyle, 				0, 0, 0, 0, 				hwnd, (HMENU)i, ((LPCREATESTRUCT)lParam)->hInstance, NULL 				); 		}  		return 0;  	case WM_SETFOCUS: 		SetFocus(temp); 		return 0;  	case WM_SIZE: 		cxChar = LOWORD(GetDialogBaseUnits()); 		cyChar = HIWORD(GetDialogBaseUnits());  		for (i = 0; i < BUTTONS; i++) 		{ 			MoveWindow(hwndButton[i], cxChar, cyChar*(1 + 2 * i), 20 * cxChar, 7 * cyChar / 4, TRUE); 		} 		return 0;  	case WM_PAINT: 		hdc = BeginPaint(hwnd, &ps); 		EndPaint(hwnd, &ps); 		return 0;  	case WM_DESTROY: 		PostQuitMessage(0);				//在消息队列中加入WM_QUIT消息 		return 0; 	} 	return DefWindowProc(hwnd, message, wParam, lParam); }