flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > how can i add an item to the listbox (newbie)

Author
Thread Post new topic Reply to topic
sina



Joined: 18 Aug 2003
Posts: 132
Location: istanbul turkey
its just one or two days i have downloaded fams and i try to learn somethings from the examples
just have a look at my source code and tell me about the wrong things i have done and how to solve the listbox problem that i got please...


format PE GUI 4.0
entry start

include '%include%\win32a.inc'

IDC_Button1 = 1
IDC_Static1 = 2
IDC_Static2 = 3
IDC_Edit1 = 4
IDC_Button2 = 5
IDC_Button3 = 6
IDC_Listbox1 = 7

section '.data' data readable writeable

flags dd ?
;LB_ADDSTRING = &H180
caption rb 40h
message rb 100h
infotext1 db 'Bu program FASM v1.48 (Flat Assembler)',0dh,0ah,\
'Kullanılarak VeSCeRa-YSG Tarafından',0dh,0ah,\
'Deneme Amaçlı Olarak Yazılmıştır',0
infotext2 db 'Program Hakkında',0

section '.code' 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
enter
push ebx esi edi
cmp [msg],WM_INITDIALOG
je wminitdialog
cmp [msg],WM_COMMAND
je wmcommand
cmp [msg],WM_CLOSE
je wmclose
xor eax,eax
jmp finish

wminitdialog:

jmp processed


wmcommand:
cmp [wparam],BN_CLICKED shl 16 + IDC_Button1
je wmclose
cmp [wparam],BN_CLICKED shl 16 + IDC_Button2
je addtolist
cmp [wparam],BN_CLICKED shl 16 + IDC_Button3
je showinfo
jmp processed

showinfo:
invoke MessageBox,[hwnddlg],infotext1,infotext2,MB_OK
jmp processed

addtolist:
invoke SendMessage,[hwnddlg],LB_ADDSTRING,'test',IDC_Listbox1
; i know that this is wrong but i guess it is something like this
; can you show me a source to have all these stuff written and tells how to use the calls
; i am first trying to add 'test' than i will try to add the
;string from IDC_Edit1 if you can help about that it will be great too
jmp processed

wmclose:
invoke EndDialog,[hwnddlg],0

processed:
mov eax,1

finish:
pop edi esi ebx
return

section '.idata' import data readable writeable

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

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

import user,\
DialogBoxParam,'DialogBoxParamA',\
MessageBox,'MessageBoxA',\
SendMessage,'SendMessageA',\
EndDialog,'EndDialog'

section '.rsrc' resource data readable

directory RT_DIALOG,dialogs

resource dialogs,\
37,LANG_TURKISH+SUBLANG_DEFAULT,demonstration

dialog demonstration,'Assembly ile Win32',100,100,185,175,WS_CAPTION+WS_POPUP+WS_SYSMENU
dialogitem 'BUTTON','Kapat',IDC_Button1,130,156,45,15,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON
dialogitem 'BUTTON','Bilgi',IDC_Button3,80,156,45,15,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON
dialogitem 'STATIC','Bu program Flat Assembler v1.48 kullanılarak',IDC_Static1,10,10,200,8,WS_VISIBLE
dialogitem 'STATIC','VeSCeRa-YSG tarafından yazılmıştır.',IDC_Static2,10,18,200,8,WS_VISIBLE
dialogitem 'LISTBOX',NULL,IDC_Listbox1, 10, 30, 165, 60, WS_VISIBLE+WS_BORDER
dialogitem 'EDIT','',IDC_Edit1,10,80,165,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP
dialogitem 'BUTTON','Ekle',IDC_Button2,130,95,45,15,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON
enddialog
Post 18 Aug 2003, 13:14
View user's profile Send private message ICQ Number Reply with quote
sina



Joined: 18 Aug 2003
Posts: 132
Location: istanbul turkey
its ok i have found it on win32.hlp from mshelp
invoke SendDlgItemMessage,[hwnddlg],IDC_Listbox1,LB_ADDSTRING,0,temp
i have used this and it seems ok
so do i have some stupid things in my code?
Post 18 Aug 2003, 13:45
View user's profile Send private message ICQ Number 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-2019, Tomasz Grysztar.

Powered by rwasa.