Results 1 to 2 of 2

Thread: Can't get Focus! How can i do it?

  1. #1

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Question

    Hello, i have a problem,
    Well I can't get this program to get focus.
    I Put it in the StartUP so when i start the computer up it will start the program, and the program is to Make it so i don't have to manullay connect to,
    Dial up network, it will just do it, and i send the Keys,
    Using SendKey and that works but the rpoblem is, i have to make it so when i send the key "ENTER"{enter} it will press connect.

    heres the code:
    Code:
    Private Sub Form_Load()
    Dim X
    '"ConnectionName" is the name under the icon in Dial-up Networking
    X = Shell("rundll32.exe rnaui.dll,RnaDial " & "Keystone Internet Access", 1)
    DoEvents
    'You can type in your password before the { below.
    SendKeys "CorySs {enter}", True
    DoEvents
    Unload Me
    End
    End Sub

    IF anyone has the solution please post it!
    thanks for listening

    PS: with this code it just pops up the Dial Up connection and it makes this noise because its not on Focus, and it never hits enter, but it pops it up. i hope i didn't confuse anyone!

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    You need to activate the app (give focus) before you can send keys. Try this:

    Code:
    Private Sub Form_Load()
    Dim X
    '"ConnectionName" is the name under the icon in Dial-up Networking
    X = Shell("rundll32.exe rnaui.dll,RnaDial " & "Keystone Internet Access", 1)
    AppActivate X 'Give the app focus
    DoEvents
    'You can type in your password before the { below.
    SendKeys "CorySs {enter}", True
    DoEvents
    Unload Me
    End
    End Sub
    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

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