el código lo pongo publico ya que a mas de a uno le interese a la larga, no soy experto en ASM pero bueno.
Código
Option Explicit Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long Private Declare Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As Long, ByVal lpProcName As String) As Long Private Declare Function CallWindowProc Lib "USER32" Alias "CallWindowProcW" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Sub form_load() Dim bASM(0 To 27) As Byte Dim i As Integer Dim sMsg As String Dim sTitulo As String sMsg = "Hola Mundo" sTitulo = "Titulo de un msgbox" ' Cada Instruccion pesa {1 Bytes} y el numero de "_" son la cantidad de bytes esperados habitualmente si son 4 es que sea normalmente un puntero, pero eso depende del formato de la instruccion. ' Para informacion de los OpCodes: ' // http://ref.x86asm.net/geek.html ' PUSH ____ ' PUSH ____ ' PUSH ____ ' PUSH ____ ' MOV EAX, ____ ' CALL EAX ' RET i = 0 bASM(i) = &H68: i = LongToByte(vbYesNoCancel, bASM(), i + 1) ' PUSH {vbYesNoCancel} 5 bytes ( 1(&H68) + long(vbYesNoCancel) ). bASM(i) = &H68: i = LongToByte(StrPtr(sTitulo), bASM(), i + 1) ' PUSH {StrPtr(sTitulo)} 5 bytes ( 1(&H68) + long(StrPtr(sTitulo)) ).. bASM(i) = &H68: i = LongToByte(StrPtr(sMsg), bASM(), i + 1) ' PUSH {StrPtr(sMsg)} 5 bytes ( 1(&H68) + long(StrPtr(sMsg)) ).. bASM(i) = &H68: i = LongToByte(&H0, bASM(), i + 1) ' PUSH {&H0} 5 bytes ( 1(&H68) + long(&H0) ).. ' MOV {EAX},{LongToByte(GetProcAddress(LoadLibrary("user32.dll"), "MessageBoxW")} bASM(i) = &HB8: i = LongToByte(GetProcAddress(LoadLibrary("user32.dll"), "MessageBoxW"), bASM(), i + 1) ' 5 bytes bASM(i) = &HFF: i = i + 1 ' CALL ___ 1 bytes bASM(i) = &HD0: i = i + 1 ' EAX 1 bytes bASM(i) = &HC3: i = i + 1 ' RET 1 bytes MsgBox CallWindowProc(ByVal VarPtr(bASM(0)), 0&, 0&, 0&, 0&) ' Run ASM End Sub Private Function LongToByte(ByVal lLong As Long, ByRef bReturn() As Byte, Optional i As Integer = 0) As Long bReturn(i) = lLong And &HFF bReturn(i + 1) = (lLong And &HFF00&) \ &H100 bReturn(i + 2) = (lLong And &HFF0000) \ &H10000 bReturn(i + 3) = (lLong And &HFF000000) \ &H1000000 LongToByte = i + 4 End Function
Dulces Lunas!¡.