|
-
Mar 15th, 2002, 11:41 PM
#1
Thread Starter
Hyperactive Member
dll/return value(not working) help!
ok i made a a dll, works but when i call it it does not return any values.my code is below
btw im calling it from vb
PHP Code:
.Code
dllmain Proc xcompielr:DWORD, xdamn:DWORD, xwarning:DWORD
ret
dllmain EndP
Testspeed Proc Ftime1:DWORD, Ftime2:DWORD, FtimeDIFF:DWORD
Local Ticks1 :DWORD
Local Ticks2 :DWORD
Invoke GetTickCount
mov Ticks1, eax
mov eax, 00h
loop1:
inc eax
cmp eax, 00FFFFFFh
jne loop1
Invoke GetTickCount
mov Ticks2, eax
mov eax, Ticks1
mov Ftime1, eax
mov eax, Ticks2
mov Ftime2, eax
sub Ticks1, eax
mov eax, Ticks1
mov FtimeDIFF, eax
ret
Testspeed EndP
End dllmain
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Mar 16th, 2002, 04:20 AM
#2
Re: dll/return value(not working) help!
Okay I will do a minor re-write of the code.
The VB Declare:
Code:
Public Declare Sub Testspeed Lib "dllname" (ByRef Ftime1 As Long, ByRef Ftime2 As Long, ByRef FtimeDIFF As Long)
Note they are ByRef so that the ASM function receives a pointer to the data.
Here is the ASM code you should use:
Code:
.Code
dllmain Proc xcompielr:DWORD, xdamn:DWORD, xwarning:DWORD
ret
dllmain EndP
Testspeed Proc Ftime1:DWORD, Ftime2:DWORD, FtimeDIFF:DWORD
Local Ticks1 :DWORD
Local Ticks2 :DWORD
Invoke GetTickCount
mov Ticks1, eax
mov eax, 00h
loop1:
inc eax
cmp eax, 00FFFFFFh
jne loop1
Invoke GetTickCount
mov Ticks2, eax
mov eax, Ticks1
mov DWORD PTR [Ftime1], eax
mov eax, Ticks2
mov DWORD PTR [Ftime2], eax
sub Ticks1, eax
mov eax, Ticks1
mov DWORD PTR [FtimeDIFF], eax
xor eax, eax
ret
Testspeed EndP
End dllmain
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|