Hi,
I'm using a ASM DLL in VB and now wanted to try using an userdefined STRUC as attribute. The VB-Compiler tells me, that I can do that 'ByRef' only. not 'ByVal'. So I have the Pointer to my userdefined STRUC ('Public Type' in VB) only.
How do I gat the values from that pointer?

I tried:


MyProc Attr1:DWORD
LOCAL Var1:MYSTRUC
mov Var1, MYSTRUC PTR [Attr1]


But didn't work...

Thanks
Posted on 2001-09-19 06:37:31 by Butch77
Butch77,

maybe you should give us some more pieces of information. What is your ASM code supposed to do? It looks a bit weird to me. And what does mean "using a ASM DLL in VB"?

japheth
Posted on 2001-09-19 12:21:48 by japheth
Butch77,

When I access record structures in masm I load the record address into a register like

mov esi, myRecordAddress

then I access the fields of the record with dot notation like (i just learned this)

mov eax, MYSTRUC PTR .field1
mov Attr1, eax

this also avoids the mem-to-mem mov... also look into the lea instruction
Posted on 2001-09-19 15:23:05 by rafe
Thanks. :)
But there is no way to copy the hole Struct in one or two steps into my Var?

This is the real Code: (ASM)


DIBPROPERTIES STRUCT
dibWidth DWORD ?
dibHeight DWORD ?
dibBytesPerScanLine DWORD ?
dibpvData DWORD ?
DIBPROPERTIES ENDS

ASM_ResizeDIB proc uses ecx pSource:DWORD, pDestination:DWORD
LOCAL Source:DIBPROPERTIES
LOCAL Destination:DIBPROPERTIES

mov Source, MYSTRUC PTR [pSource]
mov Destination, MYSTRUC PTR [pDestination]


And that is how I use it in VB:


Public Type DIBPROPERTIES
Width As Long
Height As Long
BytesPerScanLine As Long
pvData As Long
End Type

Public Declare Sub ASM_ResizeDIB_s Lib "Resize.dll" Alias "ASM_ResizeDIB" (ByRef Source As DIBPROPERTIES, ByRef Destination As DIBPROPERTIES)


How do I make those 2 last Lines in ASM work??
Posted on 2001-09-20 02:59:48 by Butch77
Yes, there is but if you've gone to the trouble of masm for the routine then you may realize that the the simplest routine may not always be the most appropriate. In your case, however, I'd recomend using push/pop or mov/mov field by field because the structure is so tiny. It will wind up being blindingly fast & efficient.

Let me point you to Svin's recent & very thorough tute on this topic in the Algorithm's forum. Titled: '"Fiction point" logic'. It will answer many (but not all) of your questions about this particularly for more complicated situations.
Posted on 2001-09-20 10:34:44 by rafe