Hi all,
I want to call BIOS Interrupt routine from VB
how can I use API to do that ?
I use Windows 2000 and VB 6.
Printable View
Hi all,
I want to call BIOS Interrupt routine from VB
how can I use API to do that ?
I use Windows 2000 and VB 6.
You will have to use ASM code to do that.
The code is:
You can use a CallWindowProc trick to do this in VB.Code:int <interrupt number>
ret
This passes 4 parameters to the function as well, so the 'ret' instruction has to be changed to fix the stack alignment thingie: :rolleyes:
And in VB:Code:int <interrupt number>
ret 0010
This will call interrupt 3h. You can change ASMCode(1) to the interrupt number you need.Code:Option Explicit
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Sub Main()
Dim ASMCode(0 To 4) As Byte
' int <interrupt number> = CD <interrupt number>
ASMCode(0) = &HCD
ASMCode(1) = &H3 ' Testing: Interrupt 3h (debug break)
' ret 0010 = C2 10 00
ASMCode(2) = &HC2
ASMCode(3) = &H8
ASMCode(4) = &H0
Call CallWindowProc(VarPtr(ASMCode(0)), 0, 0, 0, 0)
End Sub
Thank's Yonatan.
Some Interrupt have sub function dan return value
ie. calling int 1AH, function 0 (read clock)
returns cx= high word count
dx= low word count
al=0
what is the code ?
That specific interrupt might work in DOS (16-bit), but definitely not in a Windows program... :rolleyes:
Interrupts are very rarely used in Win32 programs, not to mention VB programs.
In DOS, you can use this code:
Code:xor ax, ax
int 1Ah
push cx
push dx
call SomeFunctionWhichDealsWithCxAndDx