         title   xxxx - DLL Normal Window No (.rc)

         .586
         .model flat, stdcall
         option casemap: none   ; Case sensitive

            include  \AsmEditDir\include\windows.inc
            include  \HutchDir\include\user32.inc
            include  \HutchDir\include\kernel32.inc

     include  \AsmEditDir\include\DSPMACRO.asm

         includelib  \HutchDir\LIB\USER32.LIB
         includelib  \HutchDir\LIB\KERNEL32.LIB

.const
EditID         equ 1

.data
ClassName      db  'xxxx',0
AppName        db  'xxxx - DLL Normal Window No (.rc) 05',0
Edit           db  'Edit',0

hInst          dd  0
hDLL           dd  0
hWnd           dd  0
hEdit          dd  0
.code

;________________________________________________________________________________
DllEntry PROC hInstance:DWORD, reason:DWORD, reserved1:DWORD
      .if reason == DLL_PROCESS_ATTACH  ; When the dll is loaded
           push     hInstance
            pop     hInst
            mov     eax, TRUE
      .endif
         ret
DllEntry ENDP

;________________________________________________________________________________
FunctionEntry PROC 
        call     WinMain
         ret
FunctionEntry Endp

;________________________________________________________________________________
WinMain proc
LOCAL    wc:WNDCLASSEX
LOCAL    msg:MSG
LOCAL    hwnd:HWND

         mov     wc.cbSize, sizeof WNDCLASSEX
         mov     wc.style, CS_HREDRAW or CS_VREDRAW
         mov     wc.lpfnWndProc, offset WndProc
         mov     wc.cbClsExtra, 0
         mov     wc.cbWndExtra, 0
        push     hInst
         pop     wc.hInstance
         mov     wc.hbrBackground, COLOR_WINDOWTEXT+1
         mov     wc.lpszMenuName, 0
         mov     wc.lpszClassName, offset ClassName
      INVOKE     LoadIcon, 0, IDI_APPLICATION
         mov     wc.hIcon, eax
         mov     wc.hIconSm, 0
      INVOKE     LoadCursor, 0, IDC_ARROW
         mov     wc.hCursor, eax
      INVOKE     RegisterClassEx, addr wc

;---------- [Center the window] ----------
      INVOKE     GetSystemMetrics, SM_CXSCREEN
         sub     eax, 350
         shr     eax, 1
        push     eax
      INVOKE     GetSystemMetrics, SM_CYSCREEN
         sub     eax, 250
         shr     eax, 1
         pop     ebx

      INVOKE     CreateWindowEx, WS_EX_CLIENTEDGE, addr ClassName,\
                 addr AppName, WS_OVERLAPPEDWINDOW,\
                 ebx, eax, 350, 250, NULL, NULL, hInst, NULL
         mov     hWnd, eax

      INVOKE     ShowWindow, hWnd, SW_SHOWNORMAL
      INVOKE     UpdateWindow, hWnd
      .while TRUE
         INVOKE     GetMessage, addr msg, 0, 0, 0
         .break .if (!eax)
         INVOKE     TranslateMessage, addr msg
         INVOKE     DispatchMessage, addr msg
      .endw
         mov     eax, msg.wParam
         ret
WinMain endp

;________________________________________________________________________________
WndProc proc  hwnd:DWORD, wMsg, wParam, lParam

      .if wMsg == WM_CREATE
         INVOKE     CreateWindowEx, NULL, addr Edit, NULL,\
                    WS_VISIBLE or WS_CHILD or ES_LEFT or ES_MULTILINE or\
                    ES_AUTOHSCROLL or ES_AUTOVSCROLL,\
                    0, 0, 0, 0, hwnd, EditID, hInst, NULL
            mov     hEdit, eax
         INVOKE     SendMessage, hEdit, EM_EXLIMITTEXT, 0, 100000
         INVOKE     SetFocus, hEdit

      .elseif wMsg == WM_SIZE
            mov     eax, lParam
            mov     edx, eax
            shr     edx, 16
            and     eax, 0ffffh
         INVOKE     MoveWindow, hEdit, 0, 0, eax, edx, TRUE

      .elseif wMsg == WM_CLOSE
         INVOKE     DestroyWindow, hwnd

      .elseif wMsg == WM_DESTROY
         INVOKE     PostQuitMessage, NULL

      .elseif wMsg == WM_COMMAND
            mov     eax, wParam
           cwde                         ; Only low word contains command

;         .if eax == xxxx

;         .endif

      .else

DefWin:
         INVOKE     DefWindowProc, hwnd, wMsg, wParam, lParam
            ret
      .endif

         xor    eax, eax
         ret
WndProc endp

End DllEntry
;INVOKE     MessageBox, NULL, addr szText, addr AppName, MB_OK
