是不错,可惜可视化不如VC,又没有MFC

解决方案 »

  1.   

    这是最简单的win32编程,不要嚷了,丢人
      

  2.   

    编译这个用了半秒钟:/*@@ Wedit generated application. Written Mon Oct 08 15:43:16 2001
     @@header: c:\test\aaaares.h
     @@resources: c:\test\aaaa.rc
     Do not edit outside the indicated areas */
    /*<---------------------------------------------------------------------->*/
    /*<---------------------------------------------------------------------->*/
    #include <windows.h>
    #include <windowsx.h>
    #include <commctrl.h>
    #include <string.h>
    #include <winsock2.h>
    #include "aaaares.h"
    /*<---------------------------------------------------------------------->*/
    HINSTANCE hInst; // Instance handle
    HWND hwndMain; //Main window handleHWND hwndMDIClient; //Mdi client window handle
    WSADATA *WsaData;
    HWND hwndToolBar;
    LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
    LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
    /* --- The following code comes from e:\lcc\lib\wizard\statbar.tpl. */// Global Variables for the status bar control.HWND  hWndStatusbar;/*------------------------------------------------------------------------
     Procedure:     UpdateStatusBar ID:1
     Purpose:       Updates the statusbar control with the appropiate
                    text
     Input:         lpszStatusString: Charactar string that will be shown
                    partNumber: index of the status bar part number.
                    displayFlags: Decoration flags
     Output:        none
     Errors:        none------------------------------------------------------------------------*/
    void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
    {
        SendMessage(hWndStatusbar,
                    SB_SETTEXT,
                    partNumber | displayFlags,
                    (LPARAM)lpszStatusString);
    }
    /*------------------------------------------------------------------------
     Procedure:     MsgMenuSelect ID:1
     Purpose:       Shows in the status bar a descriptive explaation of
                    the purpose of each menu item.The message
                    WM_MENUSELECT is sent when the user starts browsing
                    the menu for each menu item where the mouse passes.
     Input:         Standard windows.
     Output:        The string from the resources string table is shown
     Errors:        If the string is not found nothing will be shown.
    ------------------------------------------------------------------------*/
    LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
    {
        static char szBuffer[256];
        UINT   nStringID = 0;
        UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
        UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
        HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);    szBuffer[0] = 0;                            // First reset the buffer
        if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
            nStringID = 0;    else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
            nStringID = 0;    else if (fuFlags & MF_POPUP)                // Popup menu
        {
            if (fuFlags & MF_SYSMENU)               // System menu
                nStringID = IDS_SYSMENU;
            else
                // Get string ID for popup menu from idPopup array.
                nStringID = 0;
        }  // for MF_POPUP
        else                                        // Must be a command item
            nStringID = uCmd;                       // String ID == Command ID    // Load the string if we have an ID
        if (0 != nStringID)
            LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
        // Finally... send the string to the status bar
        UpdateStatusBar(szBuffer, 0, 0);
        return 0;
    }
    /*------------------------------------------------------------------------
     Procedure:     InitializeStatusBar ID:1
     Purpose:       Initialize the status bar
     Input:         hwndParent: the parent window
                    nrOfParts: The status bar can contain more than one
                    part. What is difficult, is to figure out how this
                    should be drawn. So, for the time being only one is
                    being used...
     Output:        The status bar is created
     Errors:
    ------------------------------------------------------------------------*/
    void InitializeStatusBar(HWND hwndParent,int nrOfParts)
    {
        const int cSpaceInBetween = 8;
        int   ptArray[40];   // Array defining the number of parts/sections
        RECT  rect;
        HDC   hDC;   /* * Fill in the ptArray...  */    hDC = GetDC(hwndParent);
        GetClientRect(hwndParent, &rect);    ptArray[nrOfParts-1] = rect.right;
        //---TODO--- Add code to calculate the size of each part of the status
        // bar here.    ReleaseDC(hwndParent, hDC);
        SendMessage(hWndStatusbar,
                    SB_SETPARTS,
                    nrOfParts,
                    (LPARAM)(LPINT)ptArray);    UpdateStatusBar("Ready", 0, 0);
        //---TODO--- Add code to update all fields of the status bar here.
        // As an example, look at the calls commented out below.//    UpdateStatusBar("Cursor Pos:", 1, SBT_POPOUT);
    //    UpdateStatusBar("Time:", 3, SBT_POPOUT);
    }
    /*------------------------------------------------------------------------
     Procedure:     CreateSBar ID:1
     Purpose:       Calls CreateStatusWindow to create the status bar
     Input:         hwndParent: the parent window
                    initial text: the initial contents of the status bar
     Output:
     Errors:
    ------------------------------------------------------------------------*/
    static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
    {
        hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
                                           initialText,
                                           hwndParent,
                                           IDM_STATUSBAR);
        if(hWndStatusbar)
        {
            InitializeStatusBar(hwndParent,nrOfParts);
            return TRUE;
        }    return FALSE;
    }int GetFileName(char *buffer,int buflen)
    {
    char tmpfilter[37];
    int i = 0;
    OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hInstance = GetModuleHandle(NULL);
    ofn.hwndOwner = GetActiveWindow();
    ofn.lpstrFile = buffer;
    ofn.nMaxFile = buflen;
    ofn.lpstrTitle = "打开";
    ofn.nFilterIndex = 1;
    ofn.lpstrDefExt = "txt";
    strcpy(buffer,"*.txt");
    strcpy(tmpfilter,"文本文件,*.txt,所有文件,*.*");
    while(tmpfilter[i]) {
    if (tmpfilter[i] == ',')
    tmpfilter[i] = 0;
    i++;
    }
    tmpfilter[i++] = 0; tmpfilter[i++] = 0;
    ofn.Flags = 539678;
    ofn.lpstrFilter = tmpfilter;
    return GetOpenFileName(&ofn);}/*<---------------------------------------------------------------------->*/
    /*@@0->@@*/
    static BOOL InitApplication(void)
    {
    WNDCLASS wc; memset(&wc,0,sizeof(WNDCLASS));
    wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
    wc.lpfnWndProc = (WNDPROC)MainWndProc;
    wc.hInstance = hInst;
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszClassName = "aaaaWndClass";
    wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
    wc.hCursor = LoadCursor(NULL,IDC_ARROW);
    wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
    if (!RegisterClass(&wc))
    return 0;
    /* --- The following code comes from e:\lcc\lib\wizard\regmdichild.tpl. */

    wc.style         = 0;
    wc.lpfnWndProc   = (WNDPROC)MdiChildWndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 20;
    wc.hInstance     = hInst;                      // Owner of this class
    wc.hIcon         = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CHILDICON));
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // Default color
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = "MdiChildWndClass";
    if (!RegisterClass((LPWNDCLASS)&wc))
    return FALSE;
    /*@@0<-@@*/
    // ---TODO--- Call module specific initialization routines here return 1;
    }/*<---------------------------------------------------------------------->*/
    /*@@1->@@*/
    HWND CreateaaaaWndClassWnd(void)
    {
    return CreateWindow("aaaaWndClass","aaaa",
    WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
    CW_USEDEFAULT,0,CW_USEDEFAULT,0,
    NULL,
    NULL,
    hInst,
    NULL);
    }
    /*@@1<-@@*/
    /* --- The following code comes from e:\lcc\lib\wizard\mdicmdnew.tpl. */
    /*<---------------------------------------------------------------------->*/HWND MDICmdFileNew(char *title)
    {
    HWND  hwndChild;
    char  rgch[150];
    static int cUntitled;
    MDICREATESTRUCT mcs; if (title == NULL)
    wsprintf(rgch,"Untitled%d", cUntitled++);
    else {
    strncpy(rgch,title,149);
    rgch[149] = 0;
    } // Create the MDI child window        mcs.szClass = "MdiChildWndClass";      // window class name
            mcs.szTitle = rgch;             // window title
            mcs.hOwner  = hInst;            // owner
            mcs.x       = CW_USEDEFAULT;    // x position
            mcs.y       = CW_USEDEFAULT;    // y position
            mcs.cx      = CW_USEDEFAULT;    // width
            mcs.cy      = CW_USEDEFAULT;    // height
            mcs.style   = 0;                // window style
            mcs.lParam  = 0;                // lparam        hwndChild = (HWND) SendMessage(hwndMDIClient,
                                           WM_MDICREATE,
                                           0,
                                           (LPARAM)(LPMDICREATESTRUCT) &mcs); if (hwndChild != NULL)
    ShowWindow(hwndChild, SW_SHOW); return hwndChild;
    }/*<---------------------------------------------------------------------->*/
    /* --- The following code comes from e:\lcc\lib\wizard\aboutdlg.tpl. */
    BOOL _stdcall AboutDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    switch(msg) {
    case WM_CLOSE:
    EndDialog(hwnd,0);
    return 1;
    case WM_COMMAND:
    switch (LOWORD(wParam)) {
    case IDOK:
    EndDialog(hwnd,1);
    return 1;
    }
    break;
    }
    return 0;
    }/*<---------------------------------------------------------------------->*/
    /* --- The following code comes from e:\lcc\lib\wizard\mdidefoncmd.tpl. */
    /* --- The following code comes from e:\lcc\lib\wizard\aboutcmd.tpl. */
    void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
    { char buffer[MAX_PATH]; switch(id) {
    // ---TODO--- Add new menu commands here
    /*@@NEWCOMMANDS@@*/
    case IDM_ABOUT:
    DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT),
    hwndMain,AboutDlg);
    break; case IDM_OPEN:
    GetFileName(buffer,sizeof(buffer));
    break; case IDM_NEW:
    MDICmdFileNew(NULL); // Use a character string if you do not
    // want the default "untitled%d" title
    break;
    case IDM_WINDOWTILE:
    SendMessage(hwndMDIClient,WM_MDITILE,0,0);
    break;
    case IDM_WINDOWCASCADE:
    SendMessage(hwndMDIClient,WM_MDICASCADE,0,0);
    break;
    case IDM_WINDOWICONS:
    SendMessage(hwndMDIClient,WM_MDIICONARRANGE,0,0);
    break;
    case IDM_EXIT:
    PostMessage(hwnd,WM_CLOSE,0,0);
    break;
    }
    }
    /* --- The following code comes from e:\lcc\lib\wizard\creatMdiClient.tpl. */
    //
    //  FUNCTION: CreateMdiClient(HWND)
    //
    //  PURPOSE: To create an MDI client window.
    //
    //  PARAMETERS:
    //    hwnd - The window handing the message.
    //  RETURN VALUE:
    //    The handle of the mdiclient window.
    static HWND CreateMdiClient(HWND hwndparent)
    {
        CLIENTCREATESTRUCT ccs = {0};
        HWND hwndMDIClient;
        int icount = GetMenuItemCount(GetMenu(hwndparent));    // Find window menu where children will be listed
        ccs.hWindowMenu  = GetSubMenu(GetMenu(hwndparent), icount-2);
        ccs.idFirstChild = IDM_WINDOWCHILD;    // Create the MDI client filling the client area
        hwndMDIClient = CreateWindow("mdiclient",
                                     NULL,
                                     WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL |
                                     WS_HSCROLL,
                                     0, 0, 0, 0,
                                     hwndparent,
                                     (HMENU)0xCAC,
                                     hInst,
                                     (LPVOID)&ccs);    ShowWindow(hwndMDIClient, SW_SHOW);    return hwndMDIClient;
    }/* --- The following code comes from e:\lcc\lib\wizard\mdichildwproc.tpl. */
    //
    //  FUNCTION: MDIChildWndProc(HWND, UINT, WPARAM, LPARAM)
    //
    //  PURPOSE:  Processes messages for MDI child windows.
    //
    //  PARAMETERS:
    //    hwnd     - window handle
    //    uMessage - message number
    //    wparam   - additional information (dependant of message number)
    //    lparam   - additional information (dependant of message number)
    //
    //  RETURN VALUE:
    //    Depends on the message number.
    //
    LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
    {
    switch(msg) {
    }
    return DefMDIChildProc(hwnd, msg, wparam, lparam);
    }
    /*<---------------------------------------------------------------------->*/
    /*@@2->@@*/
    LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
    {
    switch (msg) {
    /*@@3->@@*/
    case WM_CREATE:
    hwndMDIClient = CreateMdiClient(hwnd);
    break;
    case WM_SIZE:
    SendMessage(hWndStatusbar,msg,wParam,lParam);
    SendMessage(hwndToolBar,msg,wParam,lParam);
    InitializeStatusBar(hWndStatusbar,1);
    /* --- The following code comes from e:\lcc\lib\wizard\mditoolbarsize.tpl. */
    // Position the MDI client window between the tool and status bars
    if (wParam != SIZE_MINIMIZED) {
    RECT rc, rcClient;

    GetClientRect(hwnd, &rcClient);
    GetWindowRect(hWndStatusbar, &rc);
    ScreenToClient(hwnd, (LPPOINT)&rc.left);
    rcClient.bottom = rc.top;
    GetWindowRect(hwndToolBar,&rc);
    rcClient.top = rc.bottom - rc.top;
    MoveWindow(hwndMDIClient,rcClient.left,rcClient.top,rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, TRUE);
    }

    case WM_MENUSELECT:
    return MsgMenuSelect(hwnd,msg,wParam,lParam);
    case WM_COMMAND:
    HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
    break;
    case WM_DESTROY:
    PostQuitMessage(0);
    break;
    default:
    return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
    }
    /*@@3<-@@*/
    return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
    }
    /*@@2<-@@*/
    /*<---------------------------------------------------------------------->*/
    /* --- The following code comes from e:\lcc\lib\wizard\tcpini.tpl. */
    // WSADATA *InitWS2(void)
    // Routine Description:
    //
    // Calls WSAStartup, makes sure we have a good version of WinSock2
    //
    //
    // Return Value:
    //  A pointer to a WSADATA structure - WinSock 2 DLL successfully started up
    //  NULL - Error starting up WinSock 2 DLL.
    //
    WSADATA *InitWS2(void)
    {
        int           Error;              // catches return value of WSAStartup
        WORD          VersionRequested;   // passed to WSAStartup
        static WSADATA       WsaData;            // receives data from WSAStartup
        BOOL          ReturnValue = TRUE; // return value flag
        
        // Start WinSock 2.  If it fails, we don't need to call
        // WSACleanup().
        VersionRequested = MAKEWORD(2, 0); 
        Error = WSAStartup(VersionRequested, &WsaData);
        if (Error) {
            MessageBox(hwndMain,
                       "Could not find high enough version of WinSock",
                       "Error", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
            ReturnValue = FALSE;
        } else {        // Now confirm that the WinSock 2 DLL supports the exact version
            // we want. If not, make sure to call WSACleanup().
            if (LOBYTE(WsaData.wVersion) != 2) { 
                MessageBox(hwndMain,
                           "Could not find the correct version of WinSock",
                           "Error",  MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
                WSACleanup();
                ReturnValue = FALSE;
            }
        }
        if (ReturnValue)
            return &WsaData;
        return(NULL);
        
    } // InitWS2()
    /*<---------------------------------------------------------------------->*/
    #define NUM_TOOLBAR_BUTTONS 14
    /* --- The following code comes from e:\lcc\lib\wizard\creatToolbar1.tpl. */
    HWND CreateAToolBar(HWND hwndParent) 

    HWND hwndTB; 
    TBADDBITMAP tbab; 
    TBBUTTON tbb[NUM_TOOLBAR_BUTTONS]; 
    int index; 
     
    // Ensure that the common control DLL is loaded. 
    InitCommonControls(); 
     
    // Create a toolbar that the user can customize and that has a 
    // tooltip associated with it. 
    hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL, 
        WS_CHILD|WS_BORDER|CCS_ADJUSTABLE, 
        0, 0, 0, 0, hwndParent, (HMENU) ID_TOOLBAR, hInst, NULL); 
     
    // Send the TB_BUTTONSTRUCTSIZE message, which is required for 
    // backward compatibility. 
    SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE, 
        (WPARAM) sizeof(TBBUTTON), 0); 
     
    // Add the bitmap containing button images to the toolbar. 
    tbab.hInst = HINST_COMMCTRL; 
    tbab.nID   = IDB_STD_SMALL_COLOR; 
    SendMessage(hwndTB, TB_ADDBITMAP, (WPARAM) NUM_TOOLBAR_BUTTONS,(LPARAM) &tbab);  // clean memory before using it
    memset(tbb,0,sizeof tbb);
     
    // Add the strings
     
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Undo");
    tbb[0].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Replace");
    tbb[1].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Redo");
    tbb[2].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Properties");
    tbb[3].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print preview");
    tbb[4].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print");
    tbb[5].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Paste");
    tbb[6].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Help");
    tbb[7].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Find");
    tbb[8].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Open");
    tbb[9].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"New");
    tbb[10].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Delete");
    tbb[11].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Cut");
    tbb[12].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Copy");
    tbb[13].iString = index;
    // Button "Undo"
    tbb[0].iBitmap = STD_UNDO;
    tbb[0].idCommand = IDM_EDITUNDO;
    tbb[0].fsState = TBSTATE_ENABLED;
    tbb[0].fsStyle = TBSTYLE_BUTTON;

    // Button "Replace"
    tbb[1].iBitmap = STD_REPLACE;
    tbb[1].idCommand = IDM_EDITREPLACE;
    tbb[1].fsState = TBSTATE_ENABLED;
    tbb[1].fsStyle = TBSTYLE_BUTTON;

    // Button "Redo"
    tbb[2].iBitmap = STD_REDOW;
    tbb[2].idCommand = IDM_EDITREDO;
    tbb[2].fsState = TBSTATE_ENABLED;
    tbb[2].fsStyle = TBSTYLE_BUTTON;

    // Button "Properties"
    tbb[3].iBitmap = STD_PROPERTIES;
    tbb[3].idCommand = IDM_PROPERTIES;
    tbb[3].fsState = TBSTATE_ENABLED;
    tbb[3].fsStyle = TBSTYLE_BUTTON;

    // Button "Print preview"
    tbb[4].iBitmap = STD_PRINTPRE;
    tbb[4].idCommand = IDM_PRINTPRE;
    tbb[4].fsState = TBSTATE_ENABLED;
    tbb[4].fsStyle = TBSTYLE_BUTTON;

    // Button "Print"
    tbb[5].iBitmap = STD_PRINT;
    tbb[5].idCommand = IDM_PRINT;
    tbb[5].fsState = TBSTATE_ENABLED;
    tbb[5].fsStyle = TBSTYLE_BUTTON;

    // Button "Paste"
    tbb[6].iBitmap = STD_PASTE;
    tbb[6].idCommand = IDM_EDITPASTE;
    tbb[6].fsState = TBSTATE_ENABLED;
    tbb[6].fsStyle = TBSTYLE_BUTTON;

    // Button "Help"
    tbb[7].iBitmap = STD_HELP;
    tbb[7].idCommand = IDM_HELP;
    tbb[7].fsState = TBSTATE_ENABLED;
    tbb[7].fsStyle = TBSTYLE_BUTTON;

    // Button "Find"
    tbb[8].iBitmap = STD_FIND;
    tbb[8].idCommand = IDM_FIND;
    tbb[8].fsState = TBSTATE_ENABLED;
    tbb[8].fsStyle = TBSTYLE_BUTTON;

    // Button "Open"
    tbb[9].iBitmap = STD_FILEOPEN;
    tbb[9].idCommand = IDM_OPEN;
    tbb[9].fsState = TBSTATE_ENABLED;
    tbb[9].fsStyle = TBSTYLE_BUTTON;

    // Button "New"
    tbb[10].iBitmap = STD_FILENEW;
    tbb[10].idCommand = IDM_NEW;
    tbb[10].fsState = TBSTATE_ENABLED;
    tbb[10].fsStyle = TBSTYLE_BUTTON;

    // Button "Delete"
    tbb[11].iBitmap = STD_DELETE;
    tbb[11].idCommand = IDM_EDITDELETE;
    tbb[11].fsState = TBSTATE_ENABLED;
    tbb[11].fsStyle = TBSTYLE_BUTTON;

    // Button "Cut"
    tbb[12].iBitmap = STD_CUT;
    tbb[12].idCommand = IDM_EDITCUT;
    tbb[12].fsState = TBSTATE_ENABLED;
    tbb[12].fsStyle = TBSTYLE_BUTTON;

    // Button "Copy"
    tbb[13].iBitmap = STD_COPY;
    tbb[13].idCommand = IDM_EDITCOPY;
    tbb[13].fsState = TBSTATE_ENABLED;
    tbb[13].fsStyle = TBSTYLE_BUTTON;

    SendMessage(hwndTB,TB_ADDBUTTONS,14,(LPARAM)&tbb);
    ShowWindow(hwndTB,SW_SHOW);
    return hwndTB;
    }/*<---------------------------------------------------------------------->*/
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
    {
    MSG msg;
    HANDLE hAccelTable; hInst = hInstance;
    if (!InitApplication())
    return 0;
    hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
    if ((hwndMain = CreateaaaaWndClassWnd()) == (HWND)0)
    return 0;
    CreateSBar(hwndMain,"Ready",1);
    hwndToolBar = CreateAToolBar(hwndMain);
    ShowWindow(hwndMain,SW_SHOW);
    WsaData = InitWS2();
    if (WsaData == NULL)
    return 0;
    while (GetMessage(&msg,NULL,0,0)) {
    /* --- The following code comes from e:\lcc\lib\wizard\mdimain.tpl. */
    if (!TranslateMDISysAccel(hwndMDIClient, &msg))
    if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
    TranslateMessage(&msg);  // Translates virtual key codes
    DispatchMessage(&msg);   // Dispatches message to window
    }
    }
    WSACleanup();
    return msg.wParam;
    }/*@@ Wedit generated application. Written Mon Oct 08 15:43:16 2001
     @@header: c:\test\aaaares.h
     @@resources: c:\test\aaaa.rc
     Do not edit outside the indicated areas */
    /*<---------------------------------------------------------------------->*/
    /*<---------------------------------------------------------------------->*/
    #include <windows.h>
    #include <windowsx.h>
    #include <commctrl.h>
    #include <string.h>
    #include <winsock2.h>
    #include "aaaares.h"
    /*<---------------------------------------------------------------------->*/
    HINSTANCE hInst; // Instance handle
    HWND hwndMain; //Main window handleHWND hwndMDIClient; //Mdi client window handle
    WSADATA *WsaData;
    HWND hwndToolBar;
    LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
    LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
    /* --- The following code comes from e:\lcc\lib\wizard\statbar.tpl. */// Global Variables for the status bar control.HWND  hWndStatusbar;/*------------------------------------------------------------------------
     Procedure:     UpdateStatusBar ID:1
     Purpose:       Updates the statusbar control with the appropiate
                    text
     Input:         lpszStatusString: Charactar string that will be shown
                    partNumber: index of the status bar part number.
                    displayFlags: Decoration flags
     Output:        none
     Errors:        none------------------------------------------------------------------------*/
    void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
    {
        SendMessage(hWndStatusbar,
                    SB_SETTEXT,
                    partNumber | displayFlags,
                    (LPARAM)lpszStatusString);
    }
    /*------------------------------------------------------------------------
     Procedure:     MsgMenuSelect ID:1
     Purpose:       Shows in the status bar a descriptive explaation of
                    the purpose of each menu item.The message
                    WM_MENUSELECT is sent when the user starts browsing
                    the menu for each menu item where the mouse passes.
     Input:         Standard windows.
     Output:        The string from the resources string table is shown
     Errors:        If the string is not found nothing will be shown.
    ------------------------------------------------------------------------*/
    LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
    {
        static char szBuffer[256];
        UINT   nStringID = 0;
        UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
        UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
        HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);    szBuffer[0] = 0;                            // First reset the buffer
        if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
            nStringID = 0;    else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
            nStringID = 0;    else if (fuFlags & MF_POPUP)                // Popup menu
        {
            if (fuFlags & MF_SYSMENU)               // System menu
                nStringID = IDS_SYSMENU;
            else
                // Get string ID for popup menu from idPopup array.
                nStringID = 0;
        }  // for MF_POPUP
        else                                        // Must be a command item
            nStringID = uCmd;                       // String ID == Command ID    // Load the string if we have an ID
        if (0 != nStringID)
            LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
        // Finally... send the string to the status bar
        UpdateStatusBar(szBuffer, 0, 0);
        return 0;
    }
    /*------------------------------------------------------------------------
     Procedure:     InitializeStatusBar ID:1
     Purpose:       Initialize the status bar
     Input:         hwndParent: the parent window
                    nrOfParts: The status bar can contain more than one
                    part. What is difficult, is to figure out how this
                    should be drawn. So, for the time being only one is
                    being used...
     Output:        The status bar is created
     Errors:
    ------------------------------------------------------------------------*/
    void InitializeStatusBar(HWND hwndParent,int nrOfParts)
    {
        const int cSpaceInBetween = 8;
        int   ptArray[40];   // Array defining the number of parts/sections
        RECT  rect;
        HDC   hDC;   /* * Fill in the ptArray...  */    hDC = GetDC(hwndParent);
        GetClientRect(hwndParent, &rect);    ptArray[nrOfParts-1] = rect.right;
        //---TODO--- Add code to calculate the size of each part of the status
        // bar here.    ReleaseDC(hwndParent, hDC);
        SendMessage(hWndStatusbar,
                    SB_SETPARTS,
                    nrOfParts,
                    (LPARAM)(LPINT)ptArray);    UpdateStatusBar("Ready", 0, 0);
        //---TODO--- Add code to update all fields of the status bar here.
        // As an example, look at the calls commented out below.//    UpdateStatusBar("Cursor Pos:", 1, SBT_POPOUT);
    //    UpdateStatusBar("Time:", 3, SBT_POPOUT);
    }
    /*------------------------------------------------------------------------
     Procedure:     CreateSBar ID:1
     Purpose:       Calls CreateStatusWindow to create the status bar
     Input:         hwndParent: the parent window
                    initial text: the initial contents of the status bar
     Output:
     Errors:
    ------------------------------------------------------------------------*/
    static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
    {
        hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
                                           initialText,
                                           hwndParent,
                                           IDM_STATUSBAR);
        if(hWndStatusbar)
        {
            InitializeStatusBar(hwndParent,nrOfParts);
            return TRUE;
        }    return FALSE;
    }int GetFileName(char *buffer,int buflen)
    {
    char tmpfilter[37];
    int i = 0;
    OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hInstance = GetModuleHandle(NULL);
    ofn.hwndOwner = GetActiveWindow();
    ofn.lpstrFile = buffer;
    ofn.nMaxFile = buflen;
    ofn.lpstrTitle = "打开";
    ofn.nFilterIndex = 1;
    ofn.lpstrDefExt = "txt";
    strcpy(buffer,"*.txt");
    strcpy(tmpfilter,"文本文件,*.txt,所有文件,*.*");
    while(tmpfilter[i]) {
    if (tmpfilter[i] == ',')
    tmpfilter[i] = 0;
    i++;
    }
    tmpfilter[i++] = 0; tmpfilter[i++] = 0;
    ofn.Flags = 539678;
    ofn.lpstrFilter = tmpfilter;
    return GetOpenFileName(&ofn);}/*<---------------------------------------------------------------------->*/
    /*@@0->@@*/
    static BOOL InitApplication(void)
    {
    WNDCLASS wc; memset(&wc,0,sizeof(WNDCLASS));
    wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
    wc.lpfnWndProc = (WNDPROC)MainWndProc;
    wc.hInstance = hInst;
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszClassName = "aaaaWndClass";
    wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
    wc.hCursor = LoadCursor(NULL,IDC_ARROW);
    wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
    if (!RegisterClass(&wc))
    return 0;
    /* --- The following code comes from e:\lcc\lib\wizard\regmdichild.tpl. */

    wc.style         = 0;
    wc.lpfnWndProc   = (WNDPROC)MdiChildWndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 20;
    wc.hInstance     = hInst;                      // Owner of this class
    wc.hIcon         = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CHILDICON));
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // Default color
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = "MdiChildWndClass";
    if (!RegisterClass((LPWNDCLASS)&wc))
    return FALSE;
    /*@@0<-@@*/
    // ---TODO--- Call module specific initialization routines here return 1;
    }/*<---------------------------------------------------------------------->*/
    /*@@1->@@*/
    HWND CreateaaaaWndClassWnd(void)
    {
    return CreateWindow("aaaaWndClass","aaaa",
    WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
    CW_USEDEFAULT,0,CW_USEDEFAULT,0,
    NULL,
    NULL,
    hInst,
    NULL);
    }
    /*@@1<-@@*/
    /* --- The following code comes from e:\lcc\lib\wizard\mdicmdnew.tpl. */
    /*<---------------------------------------------------------------------->*/HWND MDICmdFileNew(char *title)
    {
    HWND  hwndChild;
    char  rgch[150];
    static int cUntitled;
    MDICREATESTRUCT mcs; if (title == NULL)
    wsprintf(rgch,"Untitled%d", cUntitled++);
    else {
    strncpy(rgch,title,149);
    rgch[149] = 0;
    } // Create the MDI child window        mcs.szClass = "MdiChildWndClass";      // window class name
            mcs.szTitle = rgch;             // window title
            mcs.hOwner  = hInst;            // owner
            mcs.x       = CW_USEDEFAULT;    // x position
            mcs.y       = CW_USEDEFAULT;    // y position
            mcs.cx      = CW_USEDEFAULT;    // width
            mcs.cy      = CW_USEDEFAULT;    // height
            mcs.style   = 0;                // window style
            mcs.lParam  = 0;                // lparam        hwndChild = (HWND) SendMessage(hwndMDIClient,
                                           WM_MDICREATE,
                                           0,
                                           (LPARAM)(LPMDICREATESTRUCT) &mcs); if (hwndChild != NULL)
    ShowWindow(hwndChild, SW_SHOW); return hwndChild;
    }/*<---------------------------------------------------------------------->*/
    /* --- The following code comes from e:\lcc\lib\wizard\aboutdlg.tpl. */
    BOOL _stdcall AboutDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    switch(msg) {
    case WM_CLOSE:
    EndDialog(hwnd,0);
    return 1;
    case WM_COMMAND:
    switch (LOWORD(wParam)) {
    case IDOK:
    EndDialog(hwnd,1);
    return 1;
    }
    break;
    }
    return 0;
    }/*<---------------------------------------------------------------------->*/
    /* --- The following code comes from e:\lcc\lib\wizard\mdidefoncmd.tpl. */
    /* --- The following code comes from e:\lcc\lib\wizard\aboutcmd.tpl. */
    void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
    { char buffer[MAX_PATH]; switch(id) {
    // ---TODO--- Add new menu commands here
    /*@@NEWCOMMANDS@@*/
    case IDM_ABOUT:
    DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT),
    hwndMain,AboutDlg);
    break; case IDM_OPEN:
    GetFileName(buffer,sizeof(buffer));
    break; case IDM_NEW:
    MDICmdFileNew(NULL); // Use a character string if you do not
    // want the default "untitled%d" title
    break;
    case IDM_WINDOWTILE:
    SendMessage(hwndMDIClient,WM_MDITILE,0,0);
    break;
    case IDM_WINDOWCASCADE:
    SendMessage(hwndMDIClient,WM_MDICASCADE,0,0);
    break;
    case IDM_WINDOWICONS:
    SendMessage(hwndMDIClient,WM_MDIICONARRANGE,0,0);
    break;
    case IDM_EXIT:
    PostMessage(hwnd,WM_CLOSE,0,0);
    break;
    }
    }
    /* --- The following code comes from e:\lcc\lib\wizard\creatMdiClient.tpl. */
    //
    //  FUNCTION: CreateMdiClient(HWND)
    //
    //  PURPOSE: To create an MDI client window.
    //
    //  PARAMETERS:
    //    hwnd - The window handing the message.
    //  RETURN VALUE:
    //    The handle of the mdiclient window.
    static HWND CreateMdiClient(HWND hwndparent)
    {
        CLIENTCREATESTRUCT ccs = {0};
        HWND hwndMDIClient;
        int icount = GetMenuItemCount(GetMenu(hwndparent));    // Find window menu where children will be listed
        ccs.hWindowMenu  = GetSubMenu(GetMenu(hwndparent), icount-2);
        ccs.idFirstChild = IDM_WINDOWCHILD;    // Create the MDI client filling the client area
        hwndMDIClient = CreateWindow("mdiclient",
                                     NULL,
                                     WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL |
                                     WS_HSCROLL,
                                     0, 0, 0, 0,
                                     hwndparent,
                                     (HMENU)0xCAC,
                                     hInst,
                                     (LPVOID)&ccs);    ShowWindow(hwndMDIClient, SW_SHOW);    return hwndMDIClient;
    }/* --- The following code comes from e:\lcc\lib\wizard\mdichildwproc.tpl. */
    //
    //  FUNCTION: MDIChildWndProc(HWND, UINT, WPARAM, LPARAM)
    //
    //  PURPOSE:  Processes messages for MDI child windows.
    //
    //  PARAMETERS:
    //    hwnd     - window handle
    //    uMessage - message number
    //    wparam   - additional information (dependant of message number)
    //    lparam   - additional information (dependant of message number)
    //
    //  RETURN VALUE:
    //    Depends on the message number.
    //
    LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
    {
    switch(msg) {
    }
    return DefMDIChildProc(hwnd, msg, wparam, lparam);
    }
    /*<---------------------------------------------------------------------->*/
    /*@@2->@@*/
    LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
    {
    switch (msg) {
    /*@@3->@@*/
    case WM_CREATE:
    hwndMDIClient = CreateMdiClient(hwnd);
    break;
    case WM_SIZE:
    SendMessage(hWndStatusbar,msg,wParam,lParam);
    SendMessage(hwndToolBar,msg,wParam,lParam);
    InitializeStatusBar(hWndStatusbar,1);
    /* --- The following code comes from e:\lcc\lib\wizard\mditoolbarsize.tpl. */
    // Position the MDI client window between the tool and status bars
    if (wParam != SIZE_MINIMIZED) {
    RECT rc, rcClient;

    GetClientRect(hwnd, &rcClient);
    GetWindowRect(hWndStatusbar, &rc);
    ScreenToClient(hwnd, (LPPOINT)&rc.left);
    rcClient.bottom = rc.top;
    GetWindowRect(hwndToolBar,&rc);
    rcClient.top = rc.bottom - rc.top;
    MoveWindow(hwndMDIClient,rcClient.left,rcClient.top,rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, TRUE);
    }

    case WM_MENUSELECT:
    return MsgMenuSelect(hwnd,msg,wParam,lParam);
    case WM_COMMAND:
    HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
    break;
    case WM_DESTROY:
    PostQuitMessage(0);
    break;
    default:
    return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
    }
    /*@@3<-@@*/
    return DefFrameProc(hwnd,hwndMDIClient,msg,wParam,lParam);
    }
    /*@@2<-@@*/
    /*<---------------------------------------------------------------------->*/
    /* --- The following code comes from e:\lcc\lib\wizard\tcpini.tpl. */
    // WSADATA *InitWS2(void)
    // Routine Description:
    //
    // Calls WSAStartup, makes sure we have a good version of WinSock2
    //
    //
    // Return Value:
    //  A pointer to a WSADATA structure - WinSock 2 DLL successfully started up
    //  NULL - Error starting up WinSock 2 DLL.
    //
    WSADATA *InitWS2(void)
    {
        int           Error;              // catches return value of WSAStartup
        WORD          VersionRequested;   // passed to WSAStartup
        static WSADATA       WsaData;            // receives data from WSAStartup
        BOOL          ReturnValue = TRUE; // return value flag
        
        // Start WinSock 2.  If it fails, we don't need to call
        // WSACleanup().
        VersionRequested = MAKEWORD(2, 0); 
        Error = WSAStartup(VersionRequested, &WsaData);
        if (Error) {
            MessageBox(hwndMain,
                       "Could not find high enough version of WinSock",
                       "Error", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
            ReturnValue = FALSE;
        } else {        // Now confirm that the WinSock 2 DLL supports the exact version
            // we want. If not, make sure to call WSACleanup().
            if (LOBYTE(WsaData.wVersion) != 2) { 
                MessageBox(hwndMain,
                           "Could not find the correct version of WinSock",
                           "Error",  MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
                WSACleanup();
                ReturnValue = FALSE;
            }
        }
        if (ReturnValue)
            return &WsaData;
        return(NULL);
        
    } // InitWS2()
    /*<---------------------------------------------------------------------->*/
    #define NUM_TOOLBAR_BUTTONS 14
    /* --- The following code comes from e:\lcc\lib\wizard\creatToolbar1.tpl. */
    HWND CreateAToolBar(HWND hwndParent) 

    HWND hwndTB; 
    TBADDBITMAP tbab; 
    TBBUTTON tbb[NUM_TOOLBAR_BUTTONS]; 
    int index; 
     
    // Ensure that the common control DLL is loaded. 
    InitCommonControls(); 
     
    // Create a toolbar that the user can customize and that has a 
    // tooltip associated with it. 
    hwndTB = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL, 
        WS_CHILD|WS_BORDER|CCS_ADJUSTABLE, 
        0, 0, 0, 0, hwndParent, (HMENU) ID_TOOLBAR, hInst, NULL); 
     
    // Send the TB_BUTTONSTRUCTSIZE message, which is required for 
    // backward compatibility. 
    SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE, 
        (WPARAM) sizeof(TBBUTTON), 0); 
     
    // Add the bitmap containing button images to the toolbar. 
    tbab.hInst = HINST_COMMCTRL; 
    tbab.nID   = IDB_STD_SMALL_COLOR; 
    SendMessage(hwndTB, TB_ADDBITMAP, (WPARAM) NUM_TOOLBAR_BUTTONS,(LPARAM) &tbab);  // clean memory before using it
    memset(tbb,0,sizeof tbb);
     
    // Add the strings
     
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Undo");
    tbb[0].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Replace");
    tbb[1].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Redo");
    tbb[2].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Properties");
    tbb[3].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print preview");
    tbb[4].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Print");
    tbb[5].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Paste");
    tbb[6].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Help");
    tbb[7].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Find");
    tbb[8].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Open");
    tbb[9].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"New");
    tbb[10].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Delete");
    tbb[11].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Cut");
    tbb[12].iString = index;
    index = SendMessage(hwndTB,TB_ADDSTRING,0,(LPARAM)"Copy");
    tbb[13].iString = index;
    // Button "Undo"
    tbb[0].iBitmap = STD_UNDO;
    tbb[0].idCommand = IDM_EDITUNDO;
    tbb[0].fsState = TBSTATE_ENABLED;
    tbb[0].fsStyle = TBSTYLE_BUTTON;

    // Button "Replace"
    tbb[1].iBitmap = STD_REPLACE;
    tbb[1].idCommand = IDM_EDITREPLACE;
    tbb[1].fsState = TBSTATE_ENABLED;
    tbb[1].fsStyle = TBSTYLE_BUTTON;

    // Button "Redo"
    tbb[2].iBitmap = STD_REDOW;
    tbb[2].idCommand = IDM_EDITREDO;
    tbb[2].fsState = TBSTATE_ENABLED;
    tbb[2].fsStyle = TBSTYLE_BUTTON;

    // Button "Properties"
    tbb[3].iBitmap = STD_PROPERTIES;
    tbb[3].idCommand = IDM_PROPERTIES;
    tbb[3].fsState = TBSTATE_ENABLED;
    tbb[3].fsStyle = TBSTYLE_BUTTON;

    // Button "Print preview"
    tbb[4].iBitmap = STD_PRINTPRE;
    tbb[4].idCommand = IDM_PRINTPRE;
    tbb[4].fsState = TBSTATE_ENABLED;
    tbb[4].fsStyle = TBSTYLE_BUTTON;

    // Button "Print"
    tbb[5].iBitmap = STD_PRINT;
    tbb[5].idCommand = IDM_PRINT;
    tbb[5].fsState = TBSTATE_ENABLED;
    tbb[5].fsStyle = TBSTYLE_BUTTON;

    // Button "Paste"
    tbb[6].iBitmap = STD_PASTE;
    tbb[6].idCommand = IDM_EDITPASTE;
    tbb[6].fsState = TBSTATE_ENABLED;
    tbb[6].fsStyle = TBSTYLE_BUTTON;

    // Button "Help"
    tbb[7].iBitmap = STD_HELP;
    tbb[7].idCommand = IDM_HELP;
    tbb[7].fsState = TBSTATE_ENABLED;
    tbb[7].fsStyle = TBSTYLE_BUTTON;

    // Button "Find"
    tbb[8].iBitmap = STD_FIND;
    tbb[8].idCommand = IDM_FIND;
    tbb[8].fsState = TBSTATE_ENABLED;
    tbb[8].fsStyle = TBSTYLE_BUTTON;

    // Button "Open"
    tbb[9].iBitmap = STD_FILEOPEN;
    tbb[9].idCommand = IDM_OPEN;
    tbb[9].fsState = TBSTATE_ENABLED;
    tbb[9].fsStyle = TBSTYLE_BUTTON;

    // Button "New"
    tbb[10].iBitmap = STD_FILENEW;
    tbb[10].idCommand = IDM_NEW;
    tbb[10].fsState = TBSTATE_ENABLED;
    tbb[10].fsStyle = TBSTYLE_BUTTON;

    // Button "Delete"
    tbb[11].iBitmap = STD_DELETE;
    tbb[11].idCommand = IDM_EDITDELETE;
    tbb[11].fsState = TBSTATE_ENABLED;
    tbb[11].fsStyle = TBSTYLE_BUTTON;

    // Button "Cut"
    tbb[12].iBitmap = STD_CUT;
    tbb[12].idCommand = IDM_EDITCUT;
    tbb[12].fsState = TBSTATE_ENABLED;
    tbb[12].fsStyle = TBSTYLE_BUTTON;

    // Button "Copy"
    tbb[13].iBitmap = STD_COPY;
    tbb[13].idCommand = IDM_EDITCOPY;
    tbb[13].fsState = TBSTATE_ENABLED;
    tbb[13].fsStyle = TBSTYLE_BUTTON;

    SendMessage(hwndTB,TB_ADDBUTTONS,14,(LPARAM)&tbb);
    ShowWindow(hwndTB,SW_SHOW);
    return hwndTB;
    }/*<---------------------------------------------------------------------->*/
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
    {
    MSG msg;
    HANDLE hAccelTable; hInst = hInstance;
    if (!InitApplication())
    return 0;
    hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
    if ((hwndMain = CreateaaaaWndClassWnd()) == (HWND)0)
    return 0;
    CreateSBar(hwndMain,"Ready",1);
    hwndToolBar = CreateAToolBar(hwndMain);
    ShowWindow(hwndMain,SW_SHOW);
    WsaData = InitWS2();
    if (WsaData == NULL)
    return 0;
    while (GetMessage(&msg,NULL,0,0)) {
    /* --- The following code comes from e:\lcc\lib\wizard\mdimain.tpl. */
    if (!TranslateMDISysAccel(hwndMDIClient, &msg))
    if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
    TranslateMessage(&msg);  // Translates virtual key codes
    DispatchMessage(&msg);   // Dispatches message to window
    }
    }
    WSACleanup();
    return msg.wParam;
    }
      

  3.   

    编译速度的确快,LCC的源代码是公开的,我就奇怪MS干吗不剽窃他的呢(MS不是剽窃大王吗)
      

  4.   

    lcc确实是不错的编译器,我看许多游戏编程网站上都有
      

  5.   

    只可惜不支持C++。
    不如"Dev-C++"好!
      

  6.   

    关注 lcc 的朋友去这里:
    http://www.cs.princeton.edu/software/lcc/
      

  7.   

    呵呵,试试win32asm后,我想你上面的话就白说了
      

  8.   

    不要只看速度!VC++考虑的因素比较多,程序符合MS的PE格式文件的徽标的标准,运行起来稳定,有对程序进行最大优化和调试信息的写入。
      

  9.   

    KAO,LCC不支持C++的,当然快好多,TC不快吗?
      

  10.   

    编译速度快是因为lcc的优化不好吧?
      

  11.   

    Dev-C++
    !!!!!!!!!!!!     !!!!!!!!!! !!!!       !!!! 
    !!!       !!!!   !!!         !!!!     !!!! 
    !!!         !!!  !!!!!!!!!!   !!!!   !!!!
    !!!         !!!  !!!!!!!!!!    !!!! !!!!
    !!!       !!!!   !!!            !!!!!!!
    !!!!!!!!!!!!     !!!!!!!!!!      !!!!! 
      

  12.   

    http://www.cs.virginia.edu/~lcc-win32,我其实一直关注呢,东西是不错,想写pure C的人绝对用的着哇,差不多前年来我一直不停的更新,不过好像还是有些问题
      

  13.   

    LCC现在的源码要收费了,$40。
    几年前就有了,唉,没有类库。
      

  14.   

    是编译速度快重要呢还是程序员操作速度快重要呢?我无法习惯这个东西,以前下过一个,好像有点像记事本,看上去感觉比VC轻很多,听说不支持MFC。