Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Can VB Detect Keyboard SCAN Codes??

Can VB figure out the scan codes for a key on the keyboard??

NOT the ASCII/ANSI values or the Keycodes like vbKeyA....but the actual low-level scan codes.

For instance:

Captial Letter A


VB Keycode = vbKeyA

Low-level Scan Code = 30

VB does not seem to be able to figure this out and I don't want to have to type a Select Case with EVERY key on the board.

Any suggestions??



View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Get AT Keyboard Scan Code
How do I get the raw scan codes send by AT keyboard in VB? Is there any API for doing this?

Keyboard ASCII Codes......
Im currently playing with SendKeys, and I was wondering if anyone knew the codes for the keyboard keys? Such as the Function keys, enter,tab, ctrl, alt ect ect...?

Thanks a bunch!

Each Key On Keyboard Has 3 Ascii Codes!
You all know that each key, how can I see
all the ascii codes for, say the key: "q" ??
(I want to press 'q' and get the 3 ascii codes in a message box)
Must be a way right?


Global Events For Keyboard SCAN CODE & ASCII CODE Event Trapping?
OK, don't be mad at me, if this is a stupid question, but I'm quite new to VB, so here's my Q:
Is there any global event (not KeyUp/KeyDown/KeyPress) to trap keyboard keypresses with SCAN codes? It is very important to have the exact scan code. I want to use an API function to simulate the pressed keys on an other machine, and I need to have the scan code. By the way, API function calls won't do it for me, I need an EVENT! (I don't want to call functions over and over again e.g. in a timer event. This is too -slow-)
So if anyone out there can help me, please do!
You won't regret it!

Thanks to all....

Detect Keyboard Disabled
Is it possible to keep detecting if keyboard is disabled ?

How To Detect 2 Keys Being Pressed On The Keyboard???
Can u tell me how i can detect 2 keys or a combination of keys being pressed together on the keyboard??

thank you!

DLL To Detect Mouse And Keyboard Events
My requirement is to detect Mouse and Keyboard events on a command button in VB6. But there should not be any code written in the form/control. It should be written as a dll which will detect the event and fire the required action. The form which contains the control should remain free of code. If anyone has any input for this ,kindly reply . A sample code will be appreciated.

Detect Console Message - Disable Keyboard
I wrote a stupid little LAN messenger program which basically just shells NET SEND. It's been quite a success at my work. They actually loved it because before I wrote it i was the only one that could send console messages (that's all I learned through getting my MCSE basically). Anyway. It's kinda cheezy because if someone is typing when the console message comes, a spacebar or enter is the equivalent of pressing the OK button (the button has the focus). My question is...

Is there any way to

1) Catch an incomming message and lock the spacebar and enter key for a period of say... 5 seconds

2) Immediatly direct the focus from the message to something else so that these 2 keys won't kill the message.

I know it's cheezy, but I don't want to write a full fledged messenger utility. This works good enough and they were amazed that it I whipped it up on my lunch break.

Detect Language Of User's Keyboard Input
how can i detect if user's keyboard input lang is diff than english.?

Detect Multiple Simultaneous Keys Pressed On Keyboard
How can I detect multiple simultaneous keys pressed on keyboard in visual basic and then replace this keys with one character on a text box?

I mean, ..


I am working now in a project where I used 6 keys: f,d,s,j,k,l to represent the 6 keys of the Braille keyboard (for blinds).. I used KeyDown event of a textbox to detect which of these keys are pressed simultaneously by summing thier KeyCode, that's done.. Then I pass this sum to a function to convert this sum by a function that return the 'Braille' character; for example: pressing 'f' and 'j' gives both of the 2 top dots of the braille and this mean character 'c'...

After that I pass this charater to the KeyPress event so the 'c' character appears

BUT, when I continue the 'select case' section in that function to convert other letters, I faced a problem... Since when I pressed 'f' an 'j' -for example- I get 'c' and also the character represented by 'f' alone or 'j' alone, i.e as I pressed the group or part of it twice...

How can I solve this problem?

Please help.

Sample of my code...

VB Code:
Function Braille2Ascii(ByVal bcode As Integer)    'We need to build a complete list    'For example "f+j" or dots "1+4"     'represent "c" in english    'dots "1+4" gives bcode=1+8=9        Select Case bcode        Case 0: 'No dots.            Braille2Ascii = 32        Case 1: 'f            Braille2Ascii = vbKeyA                    Case 2: 'd            Braille2Ascii = Asc(",") 'The code of ',' comma.        Case 3: 'f+d            Braille2Ascii = vbKeyB        Case 4: 's            '....etc         Case 9: 'f+j            Braille2Ascii = vbKeyC            '......etc      End Select  Private Sub txtNormal_KeyDown(KeyCode As Integer, Shift As Integer)    Dim increament As Integer    increament = 0    Select Case KeyCode        Case 70: 'f            increament = 1 'The weight of 'f' or 'dot1'        Case 68: 'd            increament = 2 'The weight of 'd' or 'dot2'        Case 83: 's            increament = 4 'The weight of 's' or 'dot3'        Case 74: 'j            increament = 8 'The weight of 'j' or 'dot4'        Case 75: 'k            increament = 16 'The weight of 'k' or 'dot5'        Case 76: 'l            increament = 32 'The weight of 'l' or 'dot6'            End Select        bcode = bcode + increament End Sub  Private Sub txtNormal_KeyPress(KeyAscii As Integer)    'If the user pressed 'Enter' or 'BackSpace' or 'Space'    'Deal with them as is, else, some conversion should be    'done...    If Not (KeyAscii = vbKeyReturn Or KeyAscii = vbKeySpace Or KeyAscii = vbKeyBack) Then        'This is important so as net to show any 'normal' character        KeyAscii = 0        'Note that the code of the pressed keys is stored in        'bcode var, in our special format so we use a customized        'function to show the letter corresponding to the Braille        'code entered!        KeyAscii = Braille2Ascii(bcode)    End If End Sub  Private Sub txtNormal_KeyUp(KeyCode As Integer, Shift As Integer)    'Reset the 'bcode' so to enable us to enter other characters properly.    bcode = 0 End Sub

Notice that Braille cell includes 6 dots, 3 in both of the 2 column...
f --> . . <-- j
d --> . . <-- k
s --> . . <-- l

Here Is Code To Convert Hex Color Codes To Vb Hex Codes
Sorry had an omission in previous file. All sorted now
Click on the link below to download the .frm file. Just double click it and run it. Make an exe if its easier from it.

How To Make Coding Press Keyboard 'down Arrow' Without Pressing Keyboard??
How to make coding press keyboard 'down arrow' without pressing keyboard??

my imagination..... is it possible...

Private sub ArrowFuction()
end sub

How To Convert HTML Color Codes Into VB Color Codes And Vice Versa?
Does anybody know how to convert HTML color codes into VB color codes and vice versa?

For example convert #DDDDDD html color code into
a visual basic color code and a visual basic color code into
a html color code?

Emulating A Keyboard Button(VB Help Relating To Keyboard Events)
Hi There,

Does anybody know of a way to make the computer think as though a button has been pressed on the keyboard?
e.g. the user press's the delete command button on my form and it sends a message to the computer thinking that the delete key has been pressed.

Any help would be greatly appreciated!


Virutal Keyboard Emulating Real Keyboard Keypresses
I created a virtual keyboard (ie: keyboard Form2) which can be displayed by the user in which they can click on certain keys with the mouse and I can tell which character they have clicked on. Is there a way to have my other Form1 process these keypresses as if they came "from a real keyboard".

I realize I can simply pass the KeyCode/Shift values into the KeyDown event of Form1(which has KeyPreview=true) for it to process the characters entered, however, certain characters like Tab/Arrow keys (which the OS uses to move around the controls on Form1) will not get processed the same way since they were not generated from input from a real keyboard. I really do not want to emulate what the TAB key does via code, I would rather like to somehow make the code believe the keyDown event came directly from a keyboard input.

Did this make sense .... kind of hard to explain......?

In a nutshell, how do you make a virtual keyboard act exactly like a real keyboard (ie: so all keys which are clicked on the virtual keyboard would be treated the same way as if they were entered via a real keyboard)?

Edited by - uncletr on 8/17/2004 6:20:45 AM

Virtual Keyboard - Assigning Keyboard Functions

I need to create a "virtual keyboard" in VB which has many of the controls of a real keyboard (it will be mage from VB buttons). The keyboard is purely for controlling the actions on a text box. Adding the letters (i.e. a string) is not a problem, however some of the functions I can't seem to fathom. I especially need to know how to assign a button to move the cursor left and right within the text box, and other functions such as backspace, delete and shift. Is the right way to use the ASCII codes for such keys?

I'm lost.

Thanks in advance.


Enable Keyboard Disable Keyboard??
Hi I was curious how to make a enable button for the keyboard and a disable button on a menu I need 2 buttons 1 to turn it on and another to turn it off does anyone know the code for this?

Private Sub mnuOff_Click(Index As Integer)

End Sub

Private Sub mnuOn_Click(Index As Integer)

End Sub

I have no idea what to fill in for the code thanks


Changing Asni Color Codes To Rtf Color Codes
how do i go about converting asni color codes to rtf color codes..

Detect SMTP Server And Detect E-mailaddresses From My MSN Messenger Contactlist.
does anybody know how I can make a program that automaticaly sends an e-mail to my full msn list ...

I allready know how to send E-mails ...

But I don't know yet how to get a list of all the e-mailadresses of your msn messenger contactlist.

And I also have a problem with automatically detecting the SMTP-server. (If I want to E-mail something using Visual Basic ... I always need to set my SMTP-server and I don't like that anymore. There should be a way to automatically detecting it)

How To Convert Ascii Codes To Letters, And How To Uncode Letters To Ascii Codes?
how to convert ascii codes to letters, and how to uncode letters to ascii codes?
eg 65=a

Ask About Scan Ip
cilent will send data to servers but don't know ip

want exam method "Brutforce" scan ip

please i will send Project computer in class

Vb6 Scan
i want to make a anti-virus program that scan your computer and gets rid of the vires/ect like ad-aware is that possible?

PDF Scan
I want to writ an application using Adobe Acrobat. I would like to know how can I used my application to scan a document using Adobe? Thanks for any help

Scan With Vb

First great site you have here lot's of info
now could someone help me with this please
here is what i would like to know if it can be
done with Vb i would like to have 2 forums

forum 1 will have a list box with 2 command buttons
Start Search & Cleanup now once forum one is done
scaning i click on Cleanup & it sends that info
to forum 2 which also has a list box i would also

like to know if you can make a batchfile hide
when it is doing it's work i hope i said this right

I thank you all

Scan Me...
i want to scan picture from a scanner using VB.... can any one help....

thanks In Advance...

Scan For .tmp
I am trying to scan my hard drive for temp files so that I can delete them, but I can't figure out how to do a recursive search across the whole hard drive. I tried using the exampe at that uses the API, but when I passed *.tmp instead of *.*, it just added the drive letter to the directory instead of the files on the hard drive. I tried it with numerous extensions, but the only thing that works is *.*. Anybody done somthing similar to this?


Scan Pc
Is there a way to scan a pc and get a list of all the software that are installed on it using Visual Basic?

Possible To Scan Registry?
I have in mind an idea for a program, but I want to know if its feasible first. Is it possible to use VB to scan the entire registry and store the values into a log file? I've never done any registry editing with VB, so that's my excuse for ignorance. Thanks for any help.

Computer Name Scan
I have made a program where i can type in either an I.P address or the computer name of another pc on the network.
i was wondering if anyone could give me some code where it will display all the computer names that are currently on the network


How To Scan Documents In Vb6
Can Any one tell me how to scan documents in Vb6 and save that file as ".jpg" the extension i want and set its resolution ?

Scan OLE To File
How can I parse the ole object I scan using Kodak Image control til at file.

using these two I get the scanner interface up allrigt..
but using the
ScanDev.ScanTo =
I can only figure out the Displayonly parameter, and that just sends the picture out to no-where..
I have created at module that opens up a "save as" box where I should be able to save it..but How can I parse the object from the scanner to the save as module...

Save as module:
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias _
"GetSaveFileNameA" (pSavefilename As SAVEFILENAME) As Long

lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Function savefileas(strform As Form) As String
Dim lReturn As Long
Dim sFilter As String
SaveFile.lStructSize = Len(SaveFile)
SaveFile.hwndOwner = strform.Hwnd
sFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0) & _
"JPEG Files (*.JPG)" & Chr(0) & "*.JPG" & Chr(0)
SaveFile.lpstrFilter = sFilter
SaveFile.nFilterIndex = 1
SaveFile.lpstrFile = String(257, 0)
SaveFile.nMaxFile = Len(SaveFile.lpstrFile) - 1
SaveFile.lpstrFileTitle = SaveFile.lpstrFile
SaveFile.nMaxFileTitle = SaveFile.nMaxFile
SaveFile.lpstrInitialDir = "C:"
SaveFile.lpstrTitle = "Select a file using the Common Dialog DLL"
SaveFile.flags = 0
lReturn = GetSaveFileName(SaveFile)
If lReturn = 0 Then
MsgBox "A file was not selected!", vbInformation, _
"Please type in a filename"
savefileas = Trim(Left(SaveFile.lpstrFile, InStr(1, SaveFile.lpstrFile, vbNullChar) - 1))
End If
End Function

to sum up..
I want to be able to save the picture I have scanned as I file that I name opun save-time in a directory I choose.... the name and dir part seems to work but I cannot save the object

Scan From VB Program
Hi there..,

I'm planning to desing a Document Control program and to start with I would like to know whether it is possible to control a scanner from VB.

Can anyone help>>??

Rajesh Joy

Scan A Picture In Vb
Does anyone know how to scan a picture in vb using a scanner?

Scan Through A Directory?
Using Excel VBA, is there any way to scan through a specified directory, open a PPT presentation, close it, then open the next PPT?

Scan For Folders
Hi there!

I looked through the filesearch object, but couldn't find a way to search for folders... I need to scan a folder and get all names of the subfolders in it, can this be done simply? (though complex solutions are welcome too )


WIA Scan Resolution
Hi There,

Anybody have any experience with WIA? I figured out how to acquire an image from a scanner and save it, but I can't find how to "force" a particular resolution. All pictures are scanned at 150 dpi. How can I change that?

The code I have is:

If WIADevice.Type = ScannerDeviceType Then
Counter = 10
For Each WIAItem In WIADevice.Items
Set WIAImage = WIAItem.Transfer
WIAImage.SaveFile "E: est" & Counter & ".bmp"
If MsgBox("Another page?", vbYesNo, "More...") = vbYes Then
Counter = Counter + 1
GoTo LPAgain
End If
MsgBox "No Scanner Found!", vbCritical,
End If

Recursive Scan
Does anybody know how I could list all files from a directory and its subdirectories in a ListBox, and all the directories and subdirectories to another (one listbox contains all files and their paths, the other one only the folders)?


Scan Folder
Is there a way for me to check a folder, then have a message box of all the files that end with ".sav".?
There should be the same number of messageboxes for every file and the msgbox should show (Username ": IP " IpNumber).

Directory Scan With Not Using FSO
Hi All,

Im now using the FSO for scan a directory for xml messages.
But i prefer not to use the FSO. I have include my code..does anyone know how to do this without FSO.
Thankz in advance

If Not pApplication.Busy = True Then
pApplication.Busy = True
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(str_TO_RTPA)
Set fc = f.Files
For Each f1 In fc
strFileName = f1.Name
If Right$(strFileName, 4) = ".xml" Then 'If the extension is XML then open it
Open f.Path & "" & strFileName For Input As #1
lenght = LOF(1)
If lenght > 0 Then
strFile = Input$(LOF(1), 1)
Close #1
CopyToHandled (strFileName)
ParseXML (strFile)
' killen die hap
Close #1
Kill str_TO_RTPA & "" & strFileName
End If
End If

Set fs = Nothing
Set f = Nothing
Set fc = Nothing
pApplication.Busy = False
End If

Scan A File In VB?
Trying to create a program in VB to scan a .doc file for acronyms and outputs a master list of all acronyms found to the end of the .doc or seperate .doc. How would I go about selecting a document and place it in a directory to be scanned or when I hit scan it scans that directory and filename. Alot of unanswered questions at this point. I am at the very begining point w/ just a gui in mind. If anyone would have controls I would need to use or ideas to make it possible, all welcome and appreciated.

Scan Pictures

Anyone knows how can I scan and save a picture?
Do I need any component?

Thank you

Scan And Save

I am trying to scan and save an image.
The code for scan is fine.
After the scan the program ask where I want to save the image, open the window ImgAdmin.

The point is if I choose my desktop the image is not there. I dont know how to save.

He is my code

Dim Arquivo As String

Arquivo = "C:ClientesDr. RaulPICTURES este1.jpg"

'ImgAdmin1.CompressionType = CompTypeJPEG 'this gives an error
ImgAdmin1.SaveAsName = Image2003 '
ImgAdmin1.ShowFileDialog SaveDlg ' Here is where I should choose the folder, but it is not saving


Help Me Code Scan Ip
i want code scan ip

Scan A Webpage
Hello everyone

I have Visual Basic 6 and I would like to make a program that displays the temperature and the weather condition. I need it to scan a web page which has this information ( aka and then put that data into the Visual Basic program automatically.

Any ideas how to do this?


Data Scan
I have been successful in getting it to work and send an email when a limit is reached. It will work with live data, data that is changing every millisecond. But we have some values that only scan or check for changes every 10, 15, or 30 minutes. Is there a way to code in a check value every 1 second command? I guess what i am looking for is a way to constantly look for changes and once it has changed shoot and email out. by the way new at this...

Private Sub Mact5_DataUpdate()
Static senttime As Date

Dim retstatus As Variant
Dim vTime As Variant

If DateDiff("n", senttime, Now) > 1 Then 'Interval in minutes
senttime = Now ' reset sent time

If Mact5.GetValue(vTime, retstatus) < 1 Then ' value

Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
' Dim Flds As Variant

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("") = 2
.Item("") =
.Item("") = 25
End With

strbody = " 15 min Mact >25 !!!!!" & vbNewLine & vbNewLine & _
"Contact Control Room" '& vbNewLine & _
'"If Pump is still down in 15 minutes, an automatic email will be generated" _
'"This is line 3" & vbNewLine & _
'"This is line 4"

With iMsg
Set .Configuration = iConf
.To = ""
.CC = ""
.BCC = ""
.From = "" ' needs to be your email
.Subject = "Critical A Pump Alert"
.TextBody = strbody
End With
End If

End If
End Sub

Scan In A Document
im asking for advice, knowledge or info on how i can create a small program to simply locate the scanner, scan a document, display it on the page and then save it.

any help is appreciated

Folder Scan
Hey All,
Just wondering if anyone could either guide me in the right direction or show me a link to an example of a module that will allow a complete subfolder scan. (with an infinite folder depth).

I began trying to write this code along these lines using the FSO

For Each fldFoundFolders In fldFolder.SubFolders
ReDim Preserve strFoldersFound(1 To x)
strFoldersFound(x) = fldFoundFolders.path
x = x + 1

However I have been stumped at how to continue with the repetition infinitely.

Scan Webpage
Hi guys, two things, i want to make a text box where i can type in web address and when i click go the program scans the text on that webpage for a name say Joe Bloggs. How would i do these two things, i have done the load webpage thing before but cant remember how but the second thing is my real problem

Thanks guys

Scan Documents From VB6
I want to scan some documents of the employee from Vb6
Plse send details

Copyright 2005-08, All rights reserved