    //editex1.cc

    #include <windows.h>
    #include "editex1.h"

    #define BUFFER_SIZE 256

    BOOL CALLBACK EditDlgProc( HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
      char szText[BUFFER_SIZE];

      switch (Message)
       { case WM_INITDIALOG:
          SendDlgItemMessage(hwnd, IDC_EDITDLG_TEXT, EM_SETLIMITTEXT,
                             (WPARAM) BUFFER_SIZE - 1, (LPARAM) 0);
          return TRUE;
         case WM_COMMAND:
          switch (LOWORD(wParam))
           { case IDC_EDITDLG_SETTEXT:
              GetDlgItemText(hwnd, IDC_EDITDLG_TEXT, szText, BUFFER_SIZE);
              SetWindowText(hwnd, szText);
              return TRUE;
             case IDCANCEL:
              EndDialog(hwnd, IDCANCEL);
              return TRUE;
           }
          break;
       }
      return FALSE;
    }

    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       LPSTR lpCmdLine, int nCmdShow)
    {
      DialogBox(hInstance, "EDITDLG", 0, EditDlgProc);
      return 0;
    }

    #define IDC_EDITDLG_TEXT	   8000
    #define IDC_EDITDLG_SETTEXT	8010

    #include <windows.h>
    #include "editex1.h"

    EDITDLG DIALOG 0,0,149,49
    STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | 0x200L | WS_POPUP | \
          WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "A Window"
    FONT 8, "Arial"
    BEGIN

     CONTROL "", IDC_EDITDLG_TEXT, "edit", \
             ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, \
             3, 8, 139, 12

     CONTROL "&Set text", IDC_EDITDLG_SETTEXT, "button", \
             BS_DEFPUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, \
             6, 28, 50, 14

     CONTROL "&Close", IDCANCEL, "button", \
             BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, \
             92, 28, 50, 14
    END

    OBJECTS = editex1.o editex1res.o
    RESCOMP = windres.exe
    CC = g++

    editex1: $(OBJECTS)
    	$(CC) -o editex1 ${OBJECTS} -mwindows

    editex1.o: editex1.h

    editex1res.o: editex1res.rc editex1.h
    	$(RESCOMP) editex1res.rc editex1res.o

    .PHONY : clean

    clean:
    	echo cleaning up
    	rm $(OBJECTS)
    	rm *.$$$$$$