flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
catafest 12 Dec 2017, 21:52
I try to use CB_ADDSTRING to add items to combobox and use it .
I read this https://board.flatassembler.net/topic.php?p=149763, but is not very clear to me. This is the source code: Code: format PE GUI 4.0 entry start include 'win32a.inc' IDD_TEST_DIALOGS = 102 IDC_COMBOBOX_1 = 1000 section '.code' code readable executable start: invoke GetModuleHandle,0 invoke DialogBoxParam,eax,IDD_TEST_DIALOGS,0,DialogProc,0 exit: invoke ExitProcess,0 proc DialogProc uses esi edi ebx,hwnddlg,msg,wparam,lparam cmp [msg],WM_INITDIALOG je .wminitdialog cmp [msg],WM_CLOSE je .wmclose xor eax,eax jmp .quit .wminitdialog: invoke SetDlgItemText,[hwnddlg],IDC_COMBOBOX_1,szInitText jmp .done .wmclose: invoke EndDialog,[hwnddlg],0 .done: mov eax,1 .quit: ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' import user,\ DialogBoxParam,'DialogBoxParamA',\ SetDlgItemText,'SetDlgItemTextA',\ EndDialog,'EndDialog' section '.text' readable writeable szInitText db "Text set by WM_INITDIALOG.",0 section '.rc' resource data readable directory RT_DIALOG,dialogs resource dialogs,IDD_TEST_DIALOGS,LANG_ENGLISH+SUBLANG_DEFAULT,mod_exp_dialog dialog mod_exp_dialog,\ 'FASM - Dialogs Examples - combobox',0,0,160,160,\ DS_MODALFRAME+WS_MINIMIZEBOX+WS_POPUP+WS_VISIBLE+WS_CAPTION+WS_SYSMENU,\ 0,0,"Lucida Console",11 dialogitem 'COMBOBOX',IDC_COMBOBOX_1,-1,10,10,140,12,BS_GROUPBOX+WS_VISIBLE+WS_VSCROLL,0 enddialog |
|||
![]() |
|
catafest 13 Dec 2017, 07:49
@Walter: SendDlgItemMessage into resource ?
I think you make a copy paste from internet I saw many examples. If you try tell me about messaging issue , I know just : SendMessage,'SendMessageA' |
|||
![]() |
|
catafest 13 Dec 2017, 11:04
The next step , try the SendMessage issue:
The FASM compile the source code but when I run the window form is not show. I think is something wrong with code after .wminitdialog . Code: format PE GUI 4.0 entry start include 'win32a.inc' IDD_TEST_DIALOGS = 102 IDC_COMBOBOX_1 = 1000 section '.code' code readable executable start: invoke GetModuleHandle,0 invoke DialogBoxParam,eax,IDD_TEST_DIALOGS,0,DialogProc,0 exit: invoke ExitProcess,0 proc DialogProc uses esi edi ebx,hwnddlg,msg,wparam,lparam cmp [msg],WM_INITDIALOG je .wminitdialog cmp [msg],WM_CLOSE je .wmclose xor eax,eax jmp .quit .wminitdialog: invoke SetDlgItemText,[hwnddlg],IDC_COMBOBOX_1,szInitText mov [ctr_item_ID],eax mov esi,items @@: or eax,eax jz @f push eax invoke SendMessage,[ctr_item_ID],CB_ADDSTRING,NULL,esi pop eax add esi,eax inc esi jmp @r @@: jmp .done .wmclose: invoke EndDialog,[hwnddlg],0 .done: mov eax,1 .quit: ret endp section '.data' readable ctr_item_ID dd ? items db 'Item_1',0 db 'Item_2',0 db 'Item_3',0 db 'Item_4',0 db NULL section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' import user,\ DialogBoxParam,'DialogBoxParamA',\ SetDlgItemText,'SetDlgItemTextA',\ EndDialog,'EndDialog',\ SendMessage,'SendMessageA' section '.text' readable writeable szInitText db "Text set by WM_INITDIALOG.",0 section '.rc' resource data readable directory RT_DIALOG,dialogs resource dialogs,IDD_TEST_DIALOGS,LANG_ENGLISH+SUBLANG_DEFAULT,mod_exp_dialog dialog mod_exp_dialog,\ 'FASM - Dialogs Examples - combobox',0,0,160,160,\ DS_MODALFRAME+WS_MINIMIZEBOX+WS_POPUP+WS_VISIBLE+WS_CAPTION+WS_SYSMENU,\ 0,0,"Lucida Console",11 dialogitem 'COMBOBOX',IDC_COMBOBOX_1,-1,10,10,140,12,BS_GROUPBOX+WS_VISIBLE+WS_VSCROLL,0 enddialog |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.