Results 1 to 3 of 3

Thread: [RESOLVED] Virtual keyboard

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Resolved [RESOLVED] Virtual keyboard

    Is there a way to have the form/project NOT take away focus from current object (example notepad or an text box) when clicking?

    Here is what I have so foar

    (always stays on top, but when clicking a label in hopes to use "send keys" to notepad or other object, takes focus)
    Attached Files Attached Files

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: Virtual keyboard

    So it is not as easy as I had hoped.

    So I tried it with in 1 form with two frames.
    The send key events are not happening though?
    Attached Files Attached Files

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: Virtual keyboard

    Well I am going to Mark resolved.
    I think I have what will work for me, but will need to port to my main app to test.


    I am HOPING this will work with an Open Dialog window??????

    Code:
    Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2
    Private Const SWP_NOACTIVATE = &H10
    Private Const SWP_SHOWWINDOW = &H40
    
    
    Private Sub SetWindowOnTop(f As Form, bAlwaysOnTop As Boolean)
       Dim iFlag As Long
    
       iFlag = IIf(bAlwaysOnTop, HWND_TOPMOST, HWND_NOTOPMOST)
    
       SetWindowPos f.hWnd, iFlag, f.Left / Screen.TwipsPerPixelX, f.Top / Screen.TwipsPerPixelY, f.Width / Screen.TwipsPerPixelX, f.Height / Screen.TwipsPerPixelY, SWP_NOACTIVATE Or SWP_SHOWWINDOW
    
    
    End Sub
    Public Function FormChangeColor(ByVal ChColor As String)
    'changes all buttons to one color - not the one that the mouse is over.
    Dim c As Control
    For Each c In Form1.Controls
        If TypeOf c Is Label Then
        
        c.BackColor = vbInactiveTitleBarText
        End If
    Next c
    
    
    End Function
    
    Private Sub Form_Load()
    
        SetWindowOnTop Me, True
        FormChangeColor vbInactiveTitleBarText
    End Sub
    
    
    Private Sub cmdexit_Click()
    If Frame2.Visible = False Then
    Frame2.Visible = True
    Else
    Frame2.Visible = False
    End If
    End Sub
    
    Private Sub Label1_Click()
     Label1.Caption
    End Sub
    
    Private Sub lblback_Click()
    SendKeys ("{BACKSPACE}")
    End Sub
    
    Private Sub lblEnter_Click()
    SendKeys ("{ENTER}")
    End Sub
    
    Private Sub lbltab_Click()
    SendKeys ("{TAB}")
    End Sub
    
    Private Sub lblKey_Click(Index As Integer)
    SendKeys lblkey(Index).Caption
    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width