flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > Example Window

Author
Thread Post new topic Reply to topic
MIHIP



Joined: 14 Feb 2013
Posts: 130
MIHIP 28 Jul 2013, 16:11
Hello, peoples! New example for FASM (or Casm Laughing ) =)
This is default window with text...
Code:
format PE GUI 4.0
entry start

include 'C:\Program Files\Casm\win32a.inc' ; Include file win32a.inc

section '.text' code readable executable

  start:

        invoke  GetModuleHandle,0
        invoke  DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0
        or      eax,eax
        jz      exit
  exit:
        invoke  ExitProcess,0

proc DialogProc hwnddlg,msg,wparam,lparam
        push    ebx esi edi
        cmp     [msg],WM_INITDIALOG
        je      .wminitdialog
        cmp     [msg],WM_CLOSE
        je      .wmclose
        xor     eax,eax
        jmp     .finish
  .wminitdialog:
        jmp     .processed
  .wmclose:
        invoke  EndDialog,[hwnddlg],0
  .processed:
        mov     eax,1
  .finish:
        pop     edi esi ebx
        ret
endp

section '.bss' readable writeable

  flags dd ?
  caption rb 40h
  message rb 100h

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL'

  import kernel,\
         GetModuleHandle,'GetModuleHandleA',\
         ExitProcess,'ExitProcess'

  import user,\
         DialogBoxParam,'DialogBoxParamA',\
         EndDialog,'EndDialog'

section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs

  resource dialogs,\
           37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration

  dialog demonstration,'TestProgram',170,170,105,75,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME
  dialogitem 'STATIC','Compile',-1,10,10,70,29,WS_VISIBLE
  dialogitem 'STATIC','WITH...',-1,10,20,70,8,WS_VISIBLE
  dialogitem 'STATIC','C',-1,10,30,70,8,WS_VISIBLE
  dialogitem 'STATIC','A',-1,10,40,70,8,WS_VISIBLE
  dialogitem 'STATIC','S',-1,10,50,70,8,WS_VISIBLE
  dialogitem 'STATIC','M',-1,10,60,70,8,WS_VISIBLE
  enddialog
    

Thanks for reading! Rolling Eyes
Post 28 Jul 2013, 16:11
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 30 Jul 2013, 02:08
Moved to "Examples and Tutorials"
Post 30 Jul 2013, 02:08
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.