flat assembler
Message board for the users of flat assembler.

Index > Windows > COMBOBOX in dialog resource

Author
Thread Post new topic Reply to topic
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 20 Apr 2011, 20:58
Might be a noob question - but assuming I've got a dialog resource with a COMBOBOX dialogitem, how do I add a string to the combobox?

_________________
Doug Herr
Sacramento
http://www.wildlightphoto.com
Post 20 Apr 2011, 20:58
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
ctl3d32



Joined: 30 Dec 2009
Posts: 206
Location: Brazil
ctl3d32 20 Apr 2011, 21:15
Here it is:
Code:
        invoke        GetDlgItem,[hdlg],IDC_CBO1 ;this will get the handle of the ComboBox
        mov     [Trigger_CBO],eax ; Trigger_CBO holds the handle
    invoke  SendMessage,[Trigger_CBO],CB_ADDSTRING,NULL,Trigger0 ;This will add the string to the combobox - Trigger0 holds the string
  invoke  SendMessage,[Trigger_CBO],CB_ADDSTRING,NULL,Trigger1
        invoke  SendMessage,[Trigger_CBO],CB_ADDSTRING,NULL,Trigger2
        invoke  SendMessage,[Trigger_CBO],CB_ADDSTRING,NULL,Trigger3
        invoke  SendMessage,[Trigger_CBO],CB_SELECTSTRING,NULL,Trigger3 ;This will select the item you want from the combobox list
    


ctl3d32
Post 20 Apr 2011, 21:15
View user's profile Send private message Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 20 Apr 2011, 21:25
thanks!

_________________
Doug Herr
Sacramento
http://www.wildlightphoto.com
Post 20 Apr 2011, 21:25
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Apr 2011, 21:32
u r welcome
Post 20 Apr 2011, 21:32
View user's profile Send private message Reply with quote
ctl3d32



Joined: 30 Dec 2009
Posts: 206
Location: Brazil
ctl3d32 20 Apr 2011, 22:27
@Doug Herr

Nice pictures
Post 20 Apr 2011, 22:27
View user's profile Send private message Reply with quote
LiuGuoHua(Chinese)



Joined: 26 Sep 2003
Posts: 25
LiuGuoHua(Chinese) 18 May 2011, 18:48
Really nice photos Smile
Post 18 May 2011, 18:48
View user's profile Send private message Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 09 Aug 2011, 16:28
New problem with my dialog box. It works fine in an EXE program but in a DLL Windows can't find the menu resource, giving me an extended error code of 1812. Is there an emoticon for beating my head on the wall?

_________________
Doug Herr
Sacramento
http://www.wildlightphoto.com
Post 09 Aug 2011, 16:28
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu 09 Aug 2011, 17:48
I guess your hInstance-parameter is wrong
Code:
push 0
push WndProc
push 0
push IDD_DIALOG
push [hInstance] ; <--
call [DialogBoxParam]    

This parameter needs to be the imagebase of your pe file in memory, which you get via DllMain

so if your dll gets loaded, you should save hinstance/hmodule/the imagebase like this
Code:
format PE GUI 4.0 DLL
entry DllMain

include 'win32ax.inc'

section '.text' code readable executable

DllMain:
  cmp     byte [esp+8],DLL_PROCESS_ATTACH
  jnz        .return
  mov        eax,[esp+4]
  mov    [hInstance],eax
 .return:
  mov       eax,TRUE
  retn      0Ch    


If not you should elaborate a little and post some code


Last edited by yoshimitsu on 09 Aug 2011, 21:45; edited 1 time in total
Post 09 Aug 2011, 17:48
View user's profile Send private message Reply with quote
Doug Herr



Joined: 19 Sep 2010
Posts: 14
Location: Sacramento
Doug Herr 09 Aug 2011, 17:51
Ah! That makes sense, I'll give it a try. Thanks.

EDIT: Works, thanks!
Post 09 Aug 2011, 17:51
View user's profile Send private message Send e-mail Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.