flat assembler
Message board for the users of flat assembler.

Index > Windows > newbie question, ES_MULTILINE....?

Author
Thread Post new topic Reply to topic
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
halo everybody,

i wanna ask "how to make multiline on edit box..?"
Code:
include 'win32ax.inc'
.data
  _title db 'Win32 program template',0
  _class db 'FASMWIN32',0

  mainhwnd dd ?
  hinstance dd ?
  client RECT
  _edit db 'EdiT',0
  edithwnd dd ?
  msg MSG
  wc WNDCLASS
  editfont dd ?
.code
        start:
                invoke  GetModuleHandle,0
        mov     [hinstance],eax
        invoke  LoadIcon,0,IDI_APPLICATION
        mov     [wc.hIcon],eax
        invoke  LoadCursor,0,IDC_ARROW
        mov     [wc.hCursor],eax
        mov     [wc.style],0
        mov     [wc.lpfnWndProc],WindowProc
        mov     [wc.cbClsExtra],0
        mov     [wc.cbWndExtra],0
        mov     eax,[hinstance]
        mov     [wc.hInstance],eax
        mov     [wc.hbrBackground],COLOR_BTNFACE+1
        mov     [wc.lpszMenuName],0
        mov     [wc.lpszClassName],_class
        invoke  RegisterClass,wc
        invoke CreateDialogParam,[hinstance],1,0,0,0
        cmp   eax,0
        jne   @f
        push  [hinstance]
        call  ShowLastError
        jmp   end_loop
    @@:
        mov   [mainhwnd],eax
      invoke ShowWindow,[mainhwnd],SW_SHOWNORMAL
      invoke UpdateWindow,[mainhwnd]
msgloop:
      invoke GetMessage,msg,0,0,0
      cmp eax,0
      je end_loop
      invoke IsDialogMessage,[mainhwnd],msg
      cmp eax,0
      jne msgloop
      invoke TranslateMessage,msg
      invoke DispatchMessage,msg
      jmp msgloop

  end_loop:
        invoke  ExitProcess,0


proc WindowProc, hwnd,wmsg,wparam,lparam
        push    ebx esi edi
        cmp     [wmsg],WM_CREATE
        je      wmcreate
        cmp     [wmsg],WM_DESTROY
        je      wmdestroy
  defwndproc:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        jmp     finish
  wmcreate:
        invoke  GetClientRect,[hwnd],client
        invoke  CreateWindowEx,WS_EX_CLIENTEDGE,_edit,0,WS_VISIBLE+WS_CHILD+WS_HSCROLL+WS_VSCROLL+ES_AUTOHSCROLL+ES_AUTOVSCROLL+ES_MULTILINE,[client.left],[client.top],[client.right],[client.bottom],[hwnd],0,[hinstance],NULL ;pick up  from minipad example
        or      eax,eax
        jz      failed
        mov     [edithwnd],eax
        invoke  CreateFont,16,0,0,0,0,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_RASTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH+FF_DONTCARE,NULL
        or      eax,eax
        jz      failed
        mov     [editfont],eax
        invoke  SendMessage,[edithwnd],WM_SETFONT,eax,FALSE
        xor     eax,eax
        jmp     finish
      failed:
        or      eax,-1
        jmp     finish

        jmp finish
  wmdestroy:
        invoke  PostQuitMessage,0
        xor     eax,eax
  finish:
        pop     edi esi ebx
        return
endp


proc ShowErrorMessage, hWnd,dwError
  .lpBuffer dd ?
        enter
        lea     eax,[.lpBuffer]
        invoke  FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
        invoke  MessageBox,[hWnd],[.lpBuffer],NULL,MB_ICONERROR+MB_OK
        invoke  LocalFree,[.lpBuffer]
        return
endp

; VOID ShowLastError(HWND hWnd);
proc ShowLastError, hWnd
        invoke  GetLastError
        stdcall ShowErrorMessage,[hWnd],eax
        return
endp

.end start
section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs

  resource dialogs,\
           1,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration

  dialog demonstration,'FASMWIN32','Examples',70,70,190,175,DS_CENTER + WS_CAPTION + WS_OVERLAPPED + DS_3DLOOK + WS_SYSMENU
  enddialog
    

resource.inc, i pick from Kevin Zheng corection (thanks for the correction) "adding class on dialog resource macro"
Code:
macro dialog label,class,title,x,y,cx,cy,style,menu,exstyle,fontname,fontsize
 { local data,size,items
   label dd RVA data,size,0,0
   data dd style or DS_SETFONT,exstyle +0
   dw items,x,y,cx,cy
   if menu+0 <> 0
   dw 0FFFFh
   end if
   if        ~class eq
           du menu+0,class,0,title,0
   else
        du menu+0,0,title,0
   end if
   if fontname eq
   du 8,'MS Sans Serif',0
   else
   du fontsize+0,fontname,0
   end if
   align 4
   dialog_size equ size = $ - data
   dialog_items equ items = dialog_items_counter
   dialog_items_counter = 0
 }
    


my code is running but why the editbox not do multiline..?

thanks for the help

my regard,
Senolc_Eht

_________________
sorry if i always asking.....
Post 02 Jun 2005, 00:36
View user's profile Send private message Yahoo Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
There is a strange event - <EnterKey> defaults to a button on a dialog so it deFocuses your box and there are two solutions - 1) to disable default OK-button 2) to press <CtrlKey>+<EnterKey> like in a messanger window.
Post 02 Jun 2005, 10:32
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.