programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
Go Back  Xtreme Visual Basic Talk > > > programming virtual keyboard for some keyboard's keys


Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2015, 12:34 PM
haider haider is offline
Newcomer
 
Join Date: Apr 2014
Posts: 24
Default programming virtual keyboard for some keyboard's keys


hi every one

im trying to programming program using vb.net 2013 to input instruction to PC via virtual keyboard like this one

Code:
Public Class Form1
    <System.Runtime.InteropServices.DllImport("user32.dll")> _
    Private Shared Function GetAsyncKeyState(ByVal vkey As System.Windows.Forms.Keys) As Short
        'Nothing
    End Function
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Timer1.Interval = 1
        Dim key As Boolean
        key = GetAsyncKeyState(Keys.F2)

        If key = True Then
            MsgBox("You've pressed F2")
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        My.Computer.Keyboard.SendKeys(Keys.F2, True)
    End Sub
End Class

if i press F2 from real keyboard the message box will show up

but if i press the button nothing happen

i try to change the button code to

Code:
 SendKeys.Send
but also nothing happen
Reply With Quote
  #2  
Old 02-25-2015, 02:56 PM
passel's Avatar
passelprogramming virtual keyboard for some keyboard's keys passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,026
Default

Rather than use SendKeys, try an API.
I've used keybd_event a number of years ago with VB6, but I guess currently, the suggested API is "SendInput".

Try SendInput, to see if it makes a difference.
There is a VB.Net example in the comments at https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx
although I haven't tried it myself.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #3  
Old 02-25-2015, 03:05 PM
haider haider is offline
Newcomer
 
Join Date: Apr 2014
Posts: 24
Default

i search in this forum about keyboard also in google but didn't find anything

i find fake keyboard programmed if button in GUI pressed it will add string value

what i want is command like real keyboard in low level

also i found in this forum some people say this will be like spam to make real keyboard like the physical keyboard

i will explain to you why i want this

i want to make project in arduino if u push button in arduino the last will send string like "1" or "2" via serial port to pc and there is program received it to do specific task

i want to play power point show and if i push the button connected to arduino the the slide in power point show will move
Reply With Quote
  #4  
Old 02-25-2015, 03:07 PM
haider haider is offline
Newcomer
 
Join Date: Apr 2014
Posts: 24
Default

sorry passel i thing while im writing my second post you posed in the thread

i saw the url it's for c++
Reply With Quote
  #5  
Old 02-25-2015, 03:21 PM
haider haider is offline
Newcomer
 
Join Date: Apr 2014
Posts: 24
Default

i think " SendInput - VB.Net Example " is the comment

but it's too much complex
i just want the left button and right button from keyboard for the power point show slide movie
Reply With Quote
  #6  
Old 02-26-2015, 09:34 AM
passel's Avatar
passelprogramming virtual keyboard for some keyboard's keys passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,026
Default

Quote:
Originally Posted by haider View Post
i think " SendInput - VB.Net Example " is the comment

but it's too much complex
i just want the left button and right button from keyboard for the power point show slide movie
Well, if you think that is too complex, then you could still use keybd_event, which is simpler because you don't need the structures and array.
Just send a keybd_event with the appropriate virtual key code and scancode in two bytes, one for keydown, and another for key up.

Read up on it at http://www.pinvoke.net/default.aspx/user32.keybd_event .
Some VB examples given. You don't need the 100ms delay between keydown and keyup that they show in their first VB.Net example sending an Enter Key out and they don't have it in their second example toggling the ScrollLock key.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #7  
Old 02-26-2015, 11:18 AM
haider haider is offline
Newcomer
 
Join Date: Apr 2014
Posts: 24
Default

thanks passel for help

my regards
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
 
programming virtual keyboard for some keyboard's keys
programming virtual keyboard for some keyboard's keys
 
-->