HWND CreateEdit(HWND hWnd,int x,int y,int width,int height)
{
HWND hEdit = CreateWindow(
TEXT("edit"),//文本控件
NULL,//没有标题
WS_CHILDWINDOW|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL//窗口样式
|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL,//文本框样式
x,y,//位置
width,height,//大小
hWnd,//父窗口句柄
(HMENU)NULL,//没有菜单
(HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE),//实例句柄
NULL//没有图标
);
if(!hEdit)
{
return NULL;
} ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hEdit);
return hEdit;
}主窗口的创建一般是
注册窗口类 
(编写窗口回调函数) 
然后创建窗口 
显示窗口
如果是创建控件需不需要这样呢?

解决方案 »

  1.   

    hMenu
    [in] Handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window. 
      

  2.   

    你上面的代码不是正好说明了这一点了吗?
    系统已经定义并注册了一些标准的控件类
    如:BUTTON, COMBOBOX,EDIT, LISTBOX,....