flat assembler
Message board for the users of flat assembler.

Index > Windows > Where can I find a list of EDIT style names/values?

Author
Thread Post new topic Reply to topic
krzys135



Joined: 24 Jan 2013
Posts: 3
krzys135
Hi.
I have question about dialogitem 'EDIT'. I found a example program that have line like this:
dialogitem 'EDIT',"",IDC_EDT_2,12,34,48,15,0x00800000+0x2000+0x10000000+0x0002

That are meaning of this parameters (0x00800000+0x2000+0x10000000+0x0002 )? I know that it have word equivalent for example WS_VISIBLE. Where i can find list of all this words?
[/list]
Post 25 Jan 2013, 12:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Well the very first Google result for me searching for "WS_VISIBLE" (without the quotes) gave this:

Window Styles
Post 25 Jan 2013, 13:06
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1419
Location: Toronto, Canada
AsmGuru62
'+' sometimes will not work properly if a style has not a single bit but more bits.
'or' must be used instead of a '+'.
Code:
WS_VISIBLE or ES_MULTILINE or ES_WANTRETURN or WS_CHILD  ... etc. ..
    
Post 25 Jan 2013, 17:01
View user's profile Send private message Send e-mail Reply with quote
krzys135



Joined: 24 Jan 2013
Posts: 3
krzys135
Thanks for Yours help. But now i have problem with exiting after hitting ESC. I have written something like that.

Code:

 format PE GUI 4.0
 entry start


 include 'WIN32A.INC'
; -------------------------------------------------------------------------------------

 IDD_DIALOG  = 100
 IDC_EDT_1   = 1000
 IDC_EDT_2   = 1001
 IDC_BTN_ADD = 1002
 IDC_BTN_CLR = 1003

 AW_ACTIVATE equ 00020000h
 AW_CENTER   equ 00000010h
 AW_HIDE     equ 00010000h

; -------------------------------------------------------------------------------------


 section '.code' code readable executable

  start:
  
  invoke GetModuleHandle,0
  invoke DialogBoxParam,eax,IDD_DIALOG,HWND_DESKTOP,DialogProc,0
  or    eax,eax
  jz      exit

  exit:
  
  invoke  ExitProcess,0

; -------------------------------------------------------------------------------------

proc DialogProc uses esi edi ebx,hwnddlg,msg,wparam,lparam

  cmp [msg],WM_INITDIALOG
  je .wminitdialog

  cmp [msg],WM_COMMAND
  je .wmcommand

  cmp [msg], WM_KEYDOWN
  je .wmkeydown

  cmp [msg],WM_CLOSE
  je .wmclose

  xor eax,eax

  jmp .quit

.wminitdialog:

invoke AnimateWindow,[hwnddlg],500,AW_ACTIVATE or AW_CENTER
invoke SetFocus,[hwnddlg]
invoke SendDlgItemMessage,[hwnddlg],IDC_EDT_1,EM_LIMITTEXT,8,0
jmp .processed

.wmcommand:

cmp [wparam], BN_CLICKED shl 16 + IDC_BTN_ADD
je .ADD

cmp  [wparam], BN_CLICKED shl 16 + IDC_BTN_CLR
je .CLEAR

cmp     [wparam], VK_ESCAPE
je     .wmclose

jmp .processed


.ADD:
invoke GetDlgItemInt,[hwnddlg],IDC_EDT_1,0,TRUE         
mov ebx,eax                                             
invoke GetDlgItemInt,[hwnddlg],IDC_EDT_2,0,TRUE         
add eax,ebx                                             
invoke SetDlgItemInt,[hwnddlg],IDC_EDT_2,eax,TRUE       
invoke SetDlgItemText,[hwnddlg],IDC_EDT_1,clear         
jmp .processed


.CLEAR:
    invoke SetDlgItemText,[hwnddlg],IDC_EDT_1,clear
    invoke SetDlgItemText,[hwnddlg],IDC_EDT_2,clear
jmp .processed

.wmkeydown:

        ;cmp     [wparam], VK_ESCAPE
        ;jne     .wmclose

.wmclose:

invoke AnimateWindow,[hwnddlg],500,AW_HIDE or AW_CENTER
                    invoke EndDialog,[hwnddlg],NULL
    
    invoke EndDialog,[hwnddlg],0

  .processed:
   mov     eax,1

  .quit:
        ret

endp

; -------------------------------------------------------------------------------------

section '.idata' import data readable writeable

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

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

  import user,\
         DialogBoxParam,'DialogBoxParamA',\ 
         SetDlgItemText,'SetDlgItemTextA',\
         SendDlgItemMessage ,'SendDlgItemMessageW',\
         LoadIcon , 'LoadIconA',\
         SendMessage , 'SendMessageA',\
         AnimateWindow, 'AnimateWindow',\
         SetFocus , 'SetFocus',\
         GetDlgItemInt, 'GetDlgItemInt',\
         SetDlgItemInt, 'SetDlgItemInt',\
         wsprintf, 'wsprintfA',\
         MessageBox, 'MessageBoxA',\
         EndDialog,'EndDialog'

; -------------------------------------------------------------------------------------

section '.text' readable writeable
clear db "",0

; -------------------------------------------------------------------------------------

section '.rc' resource data readable

 
 directory  RT_DIALOG,dialogs
 resource dialogs,IDD_DIALOG,LANG_ENGLISH+SUBLANG_DEFAULT,main_dialog

 dialog main_dialog,'Kalkulator',150,150,150,120,WS_POPUP+WS_VISIBLE+WS_CAPTION+WS_SYSMENU+0x0800+WS_GROUP,0,0,"Lucida Console",11

  dialogitem 'BUTTON','Dodawanie liczb',-1,7,5,140,100,0x00000007+WS_VISIBLE,0             
  dialogitem 'EDIT',"",IDC_EDT_1,12,34,48,15,WS_BORDER+0x2000+WS_VISIBLE+ES_RIGHT          
  dialogitem 'EDIT',"",IDC_EDT_2,12,65,48,15,WS_BORDER+0x2000+WS_VISIBLE+ES_RIGHT+0x0800   
  dialogitem 'BUTTON',"+",IDC_BTN_ADD,80,30,20,20,WS_VISIBLE+WS_OVERLAPPED                 
  dialogitem 'BUTTON',"CLEAR",IDC_BTN_CLR,80,65,26,12, WS_VISIBLE+WS_OVERLAPPED            

  enddialog
    
Post 26 Jan 2013, 17:18
View user's profile Send private message Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 143
Walter
Use

cmp [wparam],IDCANCEL

instead of

cmp [wparam],VK_ESCAPE
Post 26 Jan 2013, 18:17
View user's profile Send private message Reply with quote
krzys135



Joined: 24 Jan 2013
Posts: 3
krzys135
Thanks, it helps a lot Smile

I have another problem i want to save value from eax to variable.
If i declare it like this and want to move eax i have errors.

sum dq 1
mov sum, [eax]
Post 26 Jan 2013, 18:48
View user's profile Send private message Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 143
Walter
Not sure what you are trying to accomplish here, but,
best quess is two things. Instruction syntax and size.

If you are trying to move the value of eax to the variable sum:

mov [sum],eax ; general register to memory

but then you will find that you have a size issue.

eax is 32bits and sum (as you defined it) is 64 bits.
Something will be needed there (perhaps sum defined as dd).

See page 22 of FASM manual.
Post 26 Jan 2013, 19:26
View user's profile Send private message Reply with quote
Force



Joined: 12 Jun 2012
Posts: 29
Force
Hi krzys135

I think you were confused in this code because i just used numbers in resource

dialogitem 'EDIT',"",IDC_EDT_2,12,65,48,15,WS_BORDER+0x2000+WS_VISIBLE+ES_RIGHT+0x0800

0x2000 = ES_NUMBER
0x0800 = DS_CENTER
Post 29 Jan 2013, 01:20
View user's profile Send private message 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.