can anyone give me some example how to put an items in combobox?
example i want to put 1,2,3,4,5,6,7,8,9,0 inside the combobox.

thank you in advanced..
Posted on 2003-11-04 02:14:23 by coredump
i'm use dialog for my main window.

.if uMsg==WM_CREATE
invoke SetDlgItemText,hWnd,IDC_EDIT,ADDR AppName

invoke SendDlgItemMessage,hWnd,IDC_COMBOBOX,CB_ADDSTRING,0,ADDR TestString
Posted on 2003-11-04 04:18:41 by coredump
this is my RC code:

EDITTEXT IDC_EDIT, 128,22,71,13, ES_AUTOHSCROLL | ES_LEFT |WS_TABSTOP
PUSHBUTTON "E&xit", IDC_EXIT, 258,22,50,14
CONTROL "Books:",IDC_STATIC1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,14,25,23,8
CONTROL "Books",IDC_COMBOBOX,"ComboBox",CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP,37,22,88,90
Posted on 2003-11-04 04:32:04 by coredump
ok .. i got it but i did not use a dialog. but the problem is i want to change the font of the combobox. can anyone knows how??
this is the whole code:

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

WinMain proto :DWORD,:DWORD,:DWORD,:DWORD

.data
MainClass db "Main Builder",0
AppName db "Main Window",0
ComboClass db "combobox",0
ListboxCLass db "listbox",0
EditClass db "edit",0
szText01 db "Combobox01",0
szText02 db "Listbox01",0
szText03 db "Edit01",0

.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
hCombobox01 dd ?
hListbox01 dd ?
hEdit01 dd ?

.const
ComboboxID equ 2001

.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
invoke ExitProcess,eax

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET MainClass
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc

;---------------------------
invoke GetSystemMetrics,SM_CXSCREEN
sub eax, 624
shr eax, 1
push eax
invoke GetSystemMetrics,SM_CYSCREEN
sub eax, 415
shr eax,1
pop ebx
;------------------------------------------

INVOKE CreateWindowEx,NULL,ADDR MainClass,ADDR AppName,\
DS_MODALFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_POPUP or WS_CAPTION or WS_SYSMENU,ebx,\
eax,624, 415,NULL,NULL,\
hInst,NULL
mov hwnd,eax
invoke ShowWindow, hwnd,SW_SHOWNORMAL
invoke UpdateWindow, hwnd
.WHILE TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_CREATE
invoke CreateWindowEx,NULL,addr ComboClass,addr szText01,WS_VISIBLE or WS_CHILD or WS_VSCROLL or CBS_DROPDOWNLIST,37,22,150,150,hWnd,ComboboxID,hInstance,NULL
mov hCombobox01,eax
invoke SendMessage,hCombobox01,CB_SETITEMDATA,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
invoke SendMessage,hCombobox01,CB_ADDSTRING,0,ADDR szText02
.ELSEIF uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
Posted on 2003-11-05 01:09:08 by coredump