I am working with controls like treeviews, toolbars, buttons, ect. in RadASM in MASM syntax. I have hit a stumbling block.

Let's say I want to add a node to a treeview:

I note SendMessage, which I think does this. The problem is, what are the parameters after the MSG you pass to it? How do you use them?

They are wParam and lParam, but what am I missing here?

The next thing that confounds me is, how do I get data from the object? In a HLL you would use a namespace, but none exist in ASM.

Thankyou.
Posted on 2004-10-27 09:56:42 by לח&am
Search for the message in msdn, it is all clearly stated there.

btw what objects are you talking about? There are no objects in asm :-D
Posted on 2004-10-27 10:06:56 by roticv
I should correct that, controls, not objects.

I searched msdn, and found nothing (immediately obvious, anyway) in relation to it. Most examples are in c++.
Posted on 2004-10-27 10:54:12 by לח&am
Yes, you have to depend on those c++ examples.

For instance you want to get data or do something to treeview, you would first start by looking through the list to messages for treeview http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/treeview/reflist.asp
and see whether it will get/do what you want/need.
Posted on 2004-10-27 11:21:01 by roticv
Our friend KetilO has some demos on his homepage demo.zip. Very useful.
Posted on 2004-10-27 15:07:40 by minor28
mabye my article can help you?

http://www.codeproject.com/treectrl/treeview.asp
Posted on 2004-10-27 17:32:43 by wizzra
Thanks everyone. Now I just need to figure out an assemble error.

Appearantly I can't use offset, addr, or [] to point to a structure.
Posted on 2004-10-28 02:31:04 by לח&am
assume esi: ptr MY_STRUCT

mov .bla, blabla

:)
Posted on 2004-10-28 04:00:36 by wizzra
Unfortunately, that does not work.

LOCAL Tree:TV_INSERTSTRUCT
LOCAL Item:TV_ITEM
ASSUME ecx: ptr Tree
ASSUME edx: ptr Item

error A2175: invalid qualified type : Tree
error A2158: type is wrong size for register
error A2175: invalid qualified type : Item
error A2158: type is wrong size for register
Posted on 2004-10-28 04:48:12 by לח&am
.data?
tvi TV_INSERTSTRUCT <?>

.code
mov eax, offset tvi
mov .bla, edx


or

LOCAL tvi:TV_INSERTSTRUCT

lea eax, tvi
mov .bla, edx
Posted on 2004-10-28 08:03:11 by JimmyClif
Unfortunately, that does not work.

LOCAL Tree:TV_INSERTSTRUCT
LOCAL Item:TV_ITEM
ASSUME ecx: ptr Tree
ASSUME edx: ptr Item

error A2175: invalid qualified type : Tree
error A2158: type is wrong size for register
error A2175: invalid qualified type : Item
error A2158: type is wrong size for register


not like this: ASSUME ecx: ptr Tree
like this:ASSUME ecx: ptr TV_INSERTSTRUCT

i assume the type of the struct, not the var :)
Posted on 2004-10-28 15:54:12 by wizzra
I tried those approaches just now, except the predefined structure one.

Both seem to give assembler errors, notably, the namespaces are not recognized.

I have the windows header files included above this, in the program include list (function.inc, the file this is in, is below the other includes on the list).


@System@Control@TreeView@AddNode proc
LOCAL tvTree:TV_INSERTSTRUCT
LOCAL tvItem:TV_ITEM

;Failed
; ASSUME ecx: ptr TV_INSERTSTRUCT
; ASSUME edx: ptr TV_ITEM
; mov edx.imask,0h
; mov edx.lParam,1h
; mov ecx.hParent,TVI_ROOT
; mov ecx.hInsertAfter,TVI_LAST
; mov ecx.item,edx

;Failed
; lea ecx,tvTree
; lea edx,tvItem
; mov .imask,0h
; mov .lParam,1h
; mov .hParent,TVI_ROOT
; mov .hInsertAfter,TVI_LAST
; mov .item,edx

invoke SendMessage,NULL,TVM_INSERTITEM,0h,ecx

ret

@System@Control@TreeView@AddNode endp

error A2006: undefined symbol : imask
error A2006: undefined symbol : lParam
error A2006: undefined symbol : hParent
error A2006: undefined symbol : hInsertAfter
error A2006: undefined symbol : item
Posted on 2004-10-29 06:05:37 by &#1500;&#1495;&am
Failed
; ASSUME ecx: ptr TV_INSERTSTRUCT
; ASSUME edx: ptr TV_ITEM
; mov edx.imask,0h
; mov edx.lParam,1h
; mov ecx.hParent,TVI_ROOT
; mov ecx.hInsertAfter,TVI_LAST
; mov ecx.item,edx



into:

mov edx,tvItem
mov ecx,tvTree
ASSUME ecx: ptr TV_INSERTSTRUCT
ASSUME edx: ptr TV_ITEM
mov .imask,0h
mov .lParam,1h
mov .hParent,TVI_ROOT
mov .hInsertAfter,TVI_LAST
mov .item,edx

btw, are you sure you know how to deal with masm?? or asm ??
it seems you mostly post stuff you don't know about...

goto learn from win32asm.cjb.net tutorials.
thanks.
Posted on 2004-10-29 07:30:46 by wizzra
I can do very basic things. I understand many of the concepts, like registers, pointers, opcodes, how variables are stored and handles, ect.
There aren't always tutorials for specific things I wish to know, like namespaces, or tiny errors that seem to follow what I read in a tutorial, but are a minor slipup.

It is just that assembly is very unforgiving, with often cryptic errors.

By the way, it should be lea instead of mov, it seems. This indirectly helped me with an alpha shader. Thanks to all.
Posted on 2004-10-29 20:10:58 by &#1500;&#1495;&am