Public Function ClsFunc() As Long
'''The "_ClsFunc" variables are added by VB....
'#ASM_START
' push ebp ;Save EBP
' mov ebp, esp ; Move ESP into EBP so we can refer
' ; to arguments on the stack
' push ebx
' push esi ;save registers
' push edi
'
' ;Start Add code Here
'
' mov DWORD PTR _ClsFunc2$[ebp], 12345678 ;return this number
'
' ;End Add code Here
'
' mov eax, DWORD PTR _ClsFunc1$[ebp]
' mov ecx, DWORD PTR _ClsFunc2$[ebp]
' mov DWORD PTR [eax], ecx
'
' pop edi ;restore registers
' pop esi
' pop ebx
' mov esp, ebp ;MOV/POP is much faster
' pop ebp ;on 486 and Pentium than Leave
' ret 8 ; Return with 8 byte(long)
'#ASM_END
发现另外一个VB插件,可以在VB内嵌C和ASM代码:
ThunderVB is an add-in for VB6. ThunderVB let's you embed Asm and C instructions directly in you VB source programs. Furthermore ThunVB let's you create a true StdCall Dlls. Moreover ThunVB can extend VB IDE to a basic Asm/C code editor. That means it can do syntax-highlighting of Asm/C keywords and supports intelli-sense for InlineAsm code as well. See the screenshots bellow. --- ThunderVB Development Team [ drkIIRaziel & Libor ] ---