I’m working on a project that shows a menu in a game. But to open up the menu you have to press the Insert key. I found 2 ways to do that but they both give me errors. Here’s the code:
Dim insert As Boolean = GetAsyncKeyState(Keys.Insert)
or
GetAsyncKeyState(118)
The error I’m getting is PInvoke restriction: cannot return variants
I’m not very familiar with this stuff so please help, How do I make it so I can press the insert key?
If this is WinForms, set the form’s KeyPreview to true and override the OnKeyDown method: