I need codes for vb.net Getkeystate Function() without using any DLL.I’m beginner for API Conversion from vb to vb.net.In vb6 they using user32 DLL.In Vb.Net i need to call Getkeystate Function without that “User32.dll” function. can any one post me the codes without using dll?
Is there any way to get key state without using that dll Getkeystate function in vb.net..? if equivalent is any one know means show me that codes.that codes should be work with in .net framework.
vb:
Private Declare Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
Dim keystate As Long
keystate = GetKeyState(27)
MsgBox keystate
vb.net
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
On Error Resume Next
Dim KeyState As Long
KeyState = GetAsyncKeyState(17)
MsgBox(KeyState
You either need to call the windows API or not – and I’m not sure from your question you understand what using the DLL/invoking the windows API means. User32.dll is part windows and calling a function within it is actually asking windows to perform function for you. Do you want to replace the function or merely convert the call to vb.net?
If all you need to just convert the call to vb.net you can use a PInvoke call to the windows API.
here’s a sample from that page: