WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
Pages (3) [1] 2 3   ( Go to first unread post )

Add an array string to ComboBox Source snippet, I have i coding an routine for my new toy for add an array string to a combobox.

ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 873
Member No.: 5019
Joined: 13-May 07


Hi

I have i coding an routine for my new toy for add an array string to a combobox.

CODE
.data
szTable db "0", 0
               db "1", 0
               db "2", 0
               db "3", 0
               db "4", 0
               db "5", 0
               db "6", 0
               db "7", 0
               db "8", 0
               db "9", 0,0

;lpSetCursel; set cursel
;szArray; offset to the array
;IDC_ID; Resource id of the combobox
;hwnd  ; hmm no comments :lol:
;call AddComboBoxItems

AddComboBoxItems proc hWnd:HWND,IDC_ID:DWORD,szArray:DWORD,lpSetCursel:BYTE
   push  esi
push  edi
      invoke  GetDlgItem, hWnd,IDC_ID
         mov  esi,eax
         mov  edi, szArray
   .while byte ptr[edi]!= 0
      invoke StrStrI,edi,edi
      invoke SendMessage,esi,CB_ADDSTRING,0,edi
          xor eax,eax
           or ecx, -1
       repnz scasb  
   .endw
   invoke  SendMessage, esi, CB_SETCURSEL, lpSetCursel, 0
pop  edi
   pop  esi
ret
AddComboBoxItems endp



I have me wonder why i cannot post in the source snipped froum wink.gif

Greets,
ragdog

PMUsers Website
Top
ChillyWilly
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 91
Member No.: 5730
Joined: 5-January 08


i tried like this but only monday shows
the list doesnt drop down to show the others sad.gif

CODE
.data
week       db "Monday",0
          db "Tuesday",0
          db "Wednesday",0
          db "Thursday",0
          db "Friday",0
          db "Saturday",0
          db "Sunday",0
          db 0; terminator

.data?
hInstance dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke InitCommonControls
invoke DialogBoxParam, hInstance, IDD_MAIN, 0, offset DlgProc, 0
invoke ExitProcess, eax

AddComboBoxItems proc hWnd:HWND,IDC_ID:DWORD,szArray:DWORD,lpSetCursel:BYTE
  push  esi
push  edi
     invoke  GetDlgItem, hWnd,IDC_ID
        mov  esi,eax
        mov  edi, szArray
  .while byte ptr[edi]!= 0
     invoke StrStrI,edi,edi
     invoke SendMessage,esi,CB_ADDSTRING,0,edi
        xor eax,eax
      repnz scasb  
  .endw
  invoke  SendMessage, esi, CB_SETCURSEL, lpSetCursel, 0
pop  edi
  pop  esi
ret
AddComboBoxItems endp
DlgProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
mov eax,uMsg

.if eax == WM_INITDIALOG
 invoke LoadIcon,hInstance,200
 invoke SendMessage, hWin, WM_SETICON, 1, eax
 invoke AddComboBoxItems,hWin,1002,addr week,0
.elseif eax == WM_COMMAND
 mov eax,wParam
 .if eax == IDB_EXIT
  invoke SendMessage, hWin, WM_CLOSE, 0, 0
 .endif
.elseif eax == WM_CLOSE
 invoke EndDialog, hWin, 0
.endif

xor eax,eax
ret
DlgProc endp

end start
PMEmail Poster
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 873
Member No.: 5019
Joined: 13-May 07


Hi

This works fine you must move the size of the combobox in the resource file


greets,
PMUsers Website
Top
ChillyWilly
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 91
Member No.: 5730
Joined: 5-January 08


there is no option in winasm to put size in?
if i open the .rc i have
CONTROL "IDC_COMBOBOX1002",IDC_COMBOBOX1002,"ComboBox",0x50010003,43,15,164,16,0x00000000
PMEmail Poster
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 873
Member No.: 5019
Joined: 13-May 07


Sorry i use not the winasm studio

In my Radasm have i in the resource file of the combobox by height 109

and this works fine with you code snipped and my routine

PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages (3) [1] 2 3  Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google