HWND btnhwnd=CreateWindow(
"button", //class name
"caption",
BS_PUSHBUTTON, //风格
x, //坐标和长 高
y,
width,
height,
windowhwnd, //父级窗口的HWND,就是这个Button创建在那个窗口里
NULL,
NULL,
NULL,
)
HWND btnhwnd=CreateWindow(
"edit", //class name
"text",
ES_CENTER, //风格
x, //坐标和长 高
y,
width,
height,
windowhwnd, //父级窗口的HWND,就是这个Button创建在那个窗口里
NULL,
NULL,
NULL,
)
更多详情参见
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/createwindow.asp
Top
3 楼sqlaqandy(SQLY)回复于 2006-03-20 23:08:36 得分 0
::CreateWindow("按钮", "Text", BS_PUSHBUTTON, 14,14, 150,123, hWnd, NULL, NULL, NULL);
但还是看不到按钮?Top
4 楼ysc918(白纸人生)回复于 2006-03-21 08:34:08 得分 0
再来一句ShowWindow(btnhwnd,1)Top
5 楼sqlaqandy(SQLY)回复于 2006-03-21 08:49:38 得分 0
加了还是没有buttonTop
6 楼fisker0303(天塌了,地陷了,小花狗不见了.)回复于 2006-03-21 09:15:00 得分 0
看下windows程序设计,找一找,应该有例子。Top
7 楼tufaqing()回复于 2006-03-21 09:15:20 得分 0
ghwndButton = CreateWindowEx( 0, TEXT("button"), NULL,
WS_CHILD | WS_VISIBLE | WS_DISABLED,
0, 0, 10, 20, hwnd, NULL, hInst, NULL );
一定要用"button",这是button窗口的类名,也要hInst,这是程序实例(WinMain的第一个参数)Top
8 楼nkwesley(江南丝竹)回复于 2006-03-21 09:17:51 得分 0
显然能Top
9 楼sqlaqandy(SQLY)回复于 2006-03-21 09:41:08 得分 0
我是在MFC里创建Top
10 楼sqlaqandy(SQLY)回复于 2006-03-21 09:42:59 得分 0
b1 = ::CreateWindow("sdf", TEXT("button"), WS_CHILD | WS_VISIBLE | WS_DISABLED, 150,140, 150,123, this->m_hWnd, NULL, AfxGetInstanceHandle(), NULL);
::ShowWindow(b1, 1);