flat assembler
Message board for the users of flat assembler.

Index > Windows > Combo Box Problem

Author
Thread Post new topic Reply to topic
Razneb



Joined: 10 Feb 2005
Posts: 12
Razneb 12 Apr 2005, 02:09
My problem is that even though I send a message to the control's handle, it does't add the string to the combo box's list. Here's my code.

Code:
stdcall control,Cmb1Handle,CmbClassName,NULL,WS_CHILD+WS_VISIBLE+CBS_DROPDOWNLIST,[hWnd],16,140,130,25,1005
        invoke SendMessage,[Cmb1Handle],CB_SETITEMDATA,0,Cmb1Title
        invoke SendMessage,[Cmb1Handle],CB_ADDSTRING,0,Cmb2Title    


I know it's not the call to the control procedure, that works just fine. Other than that I have no idea what the problem is. I've tried alot of things, like just sending the CB_ADDSTRING message, etc.

Any help would be appreciated. Thanks in advanced.
Post 12 Apr 2005, 02:09
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 12 Apr 2005, 02:23
does your control proc return the handle of the newly created combobox? the sendmessage calls look ok, perhaps the error is elsewhere. show some more code, like the control proc
Post 12 Apr 2005, 02:23
View user's profile Send private message Reply with quote
Razneb



Joined: 10 Feb 2005
Posts: 12
Razneb 12 Apr 2005, 02:29
My control procedure returns the control's handle to the target variable's address.

Code:
proc control,Handle,Class,lpText,Style,hParent,x,y,w,h,ID
    invoke CreateWindowEx,0,[Class],[lpText],[Style],[x],[y],[w],[h],[hParent],[ID],[hInstance],NULL
    mov ebx,[Handle]
    mov [ebx],eax
    invoke SendMessage,eax,WM_SETFONT,[hFont],0
    return
endp    
Post 12 Apr 2005, 02:29
View user's profile Send private message Reply with quote
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix 12 Apr 2005, 08:41
Try to use EDX or ECX register instead of EBX (EBX,ESI,EDI must be saved and restored in function, if you use them).
Regards.
Post 12 Apr 2005, 08:41
View user's profile Send private message Reply with quote
Razneb



Joined: 10 Feb 2005
Posts: 12
Razneb 12 Apr 2005, 21:01
Still doesn't work, but thanks for the extra info IronFelix. I didn't know that.
Post 12 Apr 2005, 21:01
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 12 Apr 2005, 22:44
i have modified your code as follows. the problem was in the height of the combobox, make it large enough to display items inside it

calling create_control:

Code:
 stdcall create_control,hwnd_cb,_class_cb,0,WS_CHILD+WS_VISIBLE+CBS_DROPDOWNLIST,[hwnd],16,40,130,100,1005
        ;invoke  SendMessage,[hwnd_cb],CB_SETITEMDATA,0,_title
        invoke  SendMessage,[hwnd_cb],CB_ADDSTRING,0,_class
        invoke  SendMessage,[hwnd_cb],CB_ADDSTRING,0,_class
    


and the create_control proc:

Code:
proc create_control,handle,_class_name,_caption,style,parent,x,y,w,h,control_id
        push    ebx esi edi
        invoke  CreateWindowEx,0,[_class_name],[_caption],[style],[x],[y],[w],[h],[parent],0,[hinstance],[control_id]
        mov     ecx,[handle]
        mov     [ecx],eax
        ;invoke  SendMessage,eax,WM_SETFONT,[hFont],0
        pop     edi esi ebx
        return
endp
    


Description:
Download
Filename: CB.ASM
Filesize: 2.35 KB
Downloaded: 190 Time(s)

Post 12 Apr 2005, 22:44
View user's profile Send private message Reply with quote
Razneb



Joined: 10 Feb 2005
Posts: 12
Razneb 13 Apr 2005, 02:36
Thanks for all the help, works fine now.
Post 13 Apr 2005, 02:36
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.