QUOTE(chuiu @ Jan 20 2007, 11:35 AM)
Do you know if you can make inline assembly code or link to assembly function in VB? If you can then its got that going for it at least, but I haven't heard of it being capable of doing that.
[right][snapback]615888[/snapback][/right]
No, it isn't possible to use inline assembly code in a VB program. However, there are two ways you can use code that was in assembly language in a VB program.
1) Include it in a DLL file in an exported function. (easiest way)
or
2) Make a function that takes the same parameters as a window procedure, but you can use the parameters for whatever you want. Use an assembler (or compiler, if the code isn't ASM) to get the actual binary code for it. Code the binary data into a byte array or include it in a resource; which is done doesn't matter, as long as the program can get it into a byte array somehow. Use VirtualAlloc to allocate memory with execute permissions, enough memory to store the code (be sure to call VirtualFree to free the memory when the program is closing). Use RtlMoveMemory to copy the byte array with the code to the allocated memory. Use the Windows API function for calling a window procedure to call the function (might have been CallWindowProc?). Besides the parameter for the function address, the rest of the parameters can be used for whatever you need to pass to your function.
Either of those ways you can only access variables that you pass to the function. Obviously, #2 is significantly harder to set up; but it does give the benefit of not needing to include it in a separate DLL; however, it may also be slightly slower. I've only tested these in VB4, but either method should work in any VB version from at least version 4. Some parts of the second one should be a little easier if on a version higher than 4, since 5+ include the AddressOf operator.