假如不用MFC的类,该如何用一般api函数(或说SDK)来创建例如状态窗口(STATUESBAR),树状结构等控件呐?
例如:listBox,button...可以用createwindow来创建。
创建那些控件该使用什么,或者需要连入什么文件,麻烦大家给了方法,谢谢!
代码有没有都行的,仅仅一个思路也是可以的,如果100分还不够我可以再加!

解决方案 »

  1.   

    CButton btn;
    btn.Create(NULL,WS_CHILD | WS_VISIBLE ,CRect(736,6,736+25,23+6),this,IDC_BUTTON_MAX);
    btn.ShowWindow(SW_SHOW);
    大概是这样
      

  2.   

    在Windows中所有的控件都是窗口,都可以用createwindow来创建!
      

  3.   

    可以使用CreateWindnow()函数来实现,包含#include <windows.h>
    创建按钮hBtnWnd = CreateWindow("button",....)和CButton的Create()创建按钮一样
    主要是第一个参数要设置创建的类型,返回的是控件的句柄。
    再如hEditWnd = CreateWindow("edit",...)
      

  4.   

    CreateWindowEx类名填上系统 内置的即可 BUTTON RichEdit SCROLLBAR MDICLIENT 等等某些控件需要 先调用InitCommonControlsEx或者InitCommonControls才能创建成功
      

  5.   

    就是普通的dialogbox或createwindow等等
      

  6.   

    其实可以用资源编辑器偷懒的,把东西弄好了以后,再把.rc文件的代码拷贝过来就行了,但不知道这个算不算是API的方式?
      

  7.   

    HWND CreateWindow(
        LPCTSTR lpClassName,//BUTTON,LISTBOX
        LPCTSTR lpWindowName,
        DWORD dwStyle, 
        int x,
        int y,
        int nWidth,
        int nHeight,
        HWND hWndParent,
        HMENU hMenu,
        HINSTANCE hInstance,
        LPVOID lpParam
    );主要第一个参数LPCTSTR lpClassName,//BUTTON,LISTBOX
    使用系统组册好的字符BUTTON,LISTBOX等来创建按钮,listbox等
      

  8.   

    其实我主要指的是状态窗口(STATUESBAR),树状结构等控件
    至于按钮之类的就不用了,不过还是谢谢大家的回答吧,我试试
      

  9.   

    CreateStatusWindow
    Creates a status window, which is typically used to display the status of an application. The window generally appears at the bottom of the parent window, and it contains the specified text. Note   This function is obsolete. Use CreateWindow instead.
    // CreateATreeView - creates a tree-view control. 
    // Returns the handle to the new control if successful,
    // or NULL otherwise. 
    // hwndParent - handle to the control's parent window. 
    // lpszFileName - name of the file to parse for tree-view items.HWND CreateATreeView(HWND hwndParent, LPSTR lpszFileName) 

        RECT rcClient;  // dimensions of client area 
        HWND hwndTV;    // handle to tree-view control     // Ensure that the common control DLL is loaded. 
        InitCommonControls();     // Get the dimensions of the parent window's client area, and create 
        // the tree-view control. 
        GetClientRect(hwndParent, &rcClient); 
        hwndTV = CreateWindowEx(0,
                                WC_TREEVIEW,
                                "Tree View",
                                WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES, 
                                0, 
                                0, 
                                rcClient.right, 
                                rcClient.bottom,
                                hwndParent, 
                                (HMENU)ID_TREEVIEW, 
                                g_hinst, 
                                NULL);     // Initialize the image list, and add items to the control. 
        // InitTreeViewImageLists and InitTreeViewItems are application- 
        // defined functions. 
        if (!InitTreeViewImageLists(hwndTV) || 
                    !InitTreeViewItems(hwndTV, lpszFileName))
        { 
            DestroyWindow(hwndTV); 
            return FALSE; 
        } 
        return hwndTV;

      

  10.   

    HWND hwndBar ;
    hwndBar = CreateStatusWindow(WS_CHILD   |   WS_VISIBLE,  TEXT( "1 "),   hwnd,   IDC_STATUS); 
    SendMessage(hwndBar,SB_SETPARTS,3,(LPARAM)pint);
    SendMessage(hwndBar,SB_SETTEXT,1,(LPARAM)TEXT("2")););
    SendMessage(hwndBar,SB_SETTEXT,2,(LPARAM)TEXT("3"));
      

  11.   

    int pint[3]={110,300,-1};//110,300设定间隔
      

  12.   

    10楼的缺少什么头文件,哎,都怪自己太菜,请赐教。
    11,12楼的好像也是这样,CreateStatusWindow没有定义。
      

  13.   

    comctl32.dll
    是不是要加载这个链接库?
      

  14.   

    Minimum DLL Version comctl32.dll 
    Header commctrl.h 
    Import library comctl32.lib 
    Minimum operating systems Windows NT 3.51, Windows 95 
    Unicode Implemented as ANSI and Unicode versions