hi

i need this as workaround for vb... i actually can use api's there but there are no
pointers at all. i want to load a dll i wrote in asm with LoadLibrary... in this case
i can not relate on static linking. okay GetProcAddress returns the adr of my function
but how to execute it... i know only one way which is only valid for non-parameter
api's, CreateThread. when i use this, it works well but my dll-function has a couple
of parameters so how can i push them into memory... or are there any better
methods? no pointers, wtf, this only proofes again how stupid this "language" is.
Posted on 2002-12-18 04:39:32 by mob
There are pointers in VB. Use "Varptr" or "Strptr".
Posted on 2002-12-18 04:44:01 by bazik
sure, i know but these are only valid for strings and variables. nothing that
helps me... in asm we're doing it like this:

invoke LoadLibrary, addr user_32_lib
mov lib_handle, eax
invoke GetProcAddress, eax, addr msgbox_api
xor ebx, ebx
push ebx
push ebx
push ebx
push ebx
call [ eax ]
invoke FreeLibrary, lib_handle

and this is what i need, calling a real pointer ... with parameters of course.
in vb you can't simply write call msgb_ptr (0,0,0,0)... this is not possible.

you can't execute an api via "StrPtr" or "VarPtr". as i wrote above it actually
*is* possible to run an api... via CreateThread... but i need parameters.
Posted on 2002-12-18 04:52:13 by mob
What you need to use in visual basic is the 'CallWindowProc' api.
The snippet below should get you where you want.
Posted on 2002-12-18 10:48:58 by natas
natas,

your idea is a good one but it ir restricted to a function call that has its parameters in a message format, handle, message, wParam and lParam.

I wonder if what mob needs is another DLL function to handle direct calls that can take variations of parameters.

retval = Run_API_Function(any number of parameters)

And write a DLL that can handle this operation. I think from memory that VB can pass a variable number of arguments and it can pass parameters "as ANY".

Regards,

hutch@movsd.com
Posted on 2002-12-18 18:09:11 by hutch--
Hutch, Well that api call should work with some tweaking.
I dont know much about Visual Basic. So i decided to look for
an example dealing with calling a function with 'any' params.

The link below will show you have todo such a thing under
visual basic. It even uses some assembly code ( :grin: )
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=12565&lngWId=1


NOTE: When you need to learn something in C/C+,Delphi,PHP,VB,Perl,Java,etc.
I would really recommend the planetsourcecode. There is tons of source codes
for your pleasure. There is only one thing missing, Assembly. :alright:
Posted on 2002-12-18 21:35:01 by natas
thanks for everything... but hey i call myself an assembler programer...
THIS is WAY to messy for me... i just hardcoded what i wanted into my
compiled executable via dissassembler and it works fine now. what a
lame "programming language" this is... vb, it's ridiculous.
Posted on 2002-12-19 04:28:38 by mob