?
Solved

Using INKEY$ in Visual Basic?

Posted on 2004-03-20
6
Medium Priority
?
1,065 Views
Last Modified: 2013-11-25
Is there any way to emulate INKEY$ in Visual Basic? I'm pretty sure there is some API in Windows that will let me. I can't use the form keypress events, because I'm emulating the DOS console as well (with the console API).
0
Comment
Question by:zadijan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:fozylet
ID: 10642916
Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer

http://msdn.microsoft.com/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/GetAsyncKeyState.asp
0
 

Author Comment

by:zadijan
ID: 10643211
Yes... but doesn't that only react to a specific key?
0
 

Author Comment

by:zadijan
ID: 10643220
Because what I'm looking for is a way to simulate a C-style getch() or getche().
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Accepted Solution

by:
fozylet earned 195 total points
ID: 10643317
oh... i thought you're looking to capture the key pressed. sorry!

with asynckeystate you can loop thru all the keys to see if any of those is pressed (that is what keyloggers do, and is pretty fast)
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 180 total points
ID: 10643901
You could use the GetKeyboardState() API  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/GetKeyboardState.asp in combination with fozylet's
 GetAsyncKeyState() API to determine if a key has been pressed.  You would have to poll however.

Also, take a look at this article http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q177/9/92.asp&NoWebContent=1
as it may be of help to you as well.  But be sure to read those notes at the very bottom though.

Idle_Mind
0
 

Author Comment

by:zadijan
ID: 10644783
Ah... thank you very much for your help.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question