I am trying to figure out how to make a dll...
i have this code:



.386
.MODEL Flat, STDCALL

option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

.DATA
MsgBoxCaption db "What?",0
MsgBoxText db "Im in TESTDLL",0
MsgBoxTextB db "I'm in DllEntryPoint",0
.DATA?
.CONST
.CODE

TESTDLL PROC PUBLIC uses eax,vara:DWORD,varb:DWORD,varc:DWORD

;What this function should do is take vara and replace
;its value with varb...so vara will be the same as varb
mov varc, eax ;saves eax
mov eax, varb
mov vara, eax
invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK ;shows we got into TESTDLL
invoke MessageBox, NULL, addr varb,addr vara,MB_OK ;how can i do this?
mov eax, varc ;puts original eax value back
ret

TESTDLL ENDP

DllEntryPoint proc hinstDll:dword,aReason:dword,aReserved:dword
mov eax,1
invoke MessageBox, NULL, addr MsgBoxTextB, addr MsgBoxCaption, MB_OK
ret
DllEntryPoint endp
end DllEntryPoint







i am calling TESTDLL from Visual Basic with this declaration:
Private Declare Function TESTDLL Lib "C:\asmdll1.dll" ( _
ByRef lngValue1 As Long, _
ByRef lngValue2 As Long, _
ByRef lngValue3 As Long)


this is the thing that calls TESTDLL:

Private Sub Command1_Click()

Dim a As Long
Dim b As Long
Dim c As Long


a = 32768
b = 65535
c = 12345

TESTDLL a, b, c
Debug.Print "a=" & CStr(a) & " b=" & CStr(b) & " c=" & CStr(c) & " d=" & CStr(d)

End Sub


after i run this, a should be the same as b...but they dont change!

also...is there a way to use MessageBox and put a DWORD in it? like this:

invoke MessageBox, NULL, addr varb,addr vara,MB_OK
varb is a DWORD passed from VB



hmmm....can anyone help me with this? :confused:
Thanks in Advance,
rkinasz :grin:
Posted on 2002-07-12 00:58:59 by rkinasz
also...is there a way to use MessageBox and put a DWORD in it?


what i mean is....
is there a way to convert a DWORD into a string?

if i make a DWORD with a value of 493 i want to be able to put that in a MessageBox...
so i could have:
invoke MessageBox, NULL, addr MyDWORD,addr MyCaption,MB_OK


Thanks in Advance
rkinasz :grin:
Posted on 2002-07-12 01:06:03 by rkinasz
Dw2a.asm the invoke wsprintf you find it in the M32.lib if this is what you mean....
Posted on 2002-07-12 01:27:00 by cmax
it looks like what i need is a DW to DB conversion(and DB to DW)...
anyone know of a way to do that?
Posted on 2002-07-12 02:15:09 by rkinasz
MessageBox needs an offset (pointer) of string. All you need is convert your dword to string, how - it is depend on what exactly you need decimal or hex or whatever.

And you don't need to save eax in your proc, uses eax already do that for you in the stack. Actually you don't need to save eax at all here.
Posted on 2002-07-12 04:30:10 by masquer
ummm...how can i convert it to a string??
Posted on 2002-07-12 04:38:27 by rkinasz
see cmax suggestion above
Posted on 2002-07-12 05:41:10 by masquer
"i need is a DW to DB"
I think there is all kind of DWto stuff in M32.lib ... I never tried all of them but a lot is there. Also do a Keyword search here at the Board ... Lots of stuff
Posted on 2002-07-12 14:15:13 by cmax
are you talking about masm32.lib? i dont have a m32.lib...

in that one... i see dw2a, dwtoa, and dw2hex....but that is all
Posted on 2002-07-12 14:53:39 by rkinasz
I don't really know ,much about dll's but this is what i use to veiw a window width or height. I wrote this back when i was trying to see how this thing work. I also have a habit of striping everything possible out of a code source. I don't know if i hurt it but it always work fast and prefect....Just to help give you an better idea of how it works. This is out of the M32.lib i just striped it down a little and it works *if this is my final trial that i was wroking on* . :)


; H H H H H H H H H H H H H c_MOVE_HEIGHT
; H H H H H H H H H H H H H c_MOVE_HEIGHT
; H H H H H H H H H H H H H c_MOVE_HEIGHT
; H H H H H H H H H H H H H c_MOVE_HEIGHT

mov eax, rect.top
mov eax, rect.bottom
sub eax, rect.top

PUSH eax
mov edi, offset c_MOVE_HEIGHT

pos2:
mov ecx,429496730
mov esi, edi

.while (eax > 0)
mov ebx,eax
mul ecx
mov eax,edx
lea edx,
add edx,edx
sub ebx,edx
add bl,'0'
mov ,bl
inc edi
.endw

mov byte ptr , 0 ; terminate the string

.while (esi < edi) ; We now have all the digits, but in reverse order.
dec edi
mov al,
mov ah,
mov , al
mov , ah
inc esi
.endw

pop edi
pop esi
pop ebx

The old package i use say M32.lib maybe they are just the same
Posted on 2002-07-12 21:20:11 by cmax