Results 1 to 4 of 4

Thread: AutoConnecting to ISP when computer boots up! having problems SENDING KEYS, help!

  1. #1

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

    Unhappy help

    hello!
    I'm having troubles with this Program i am working on. Some guy gave me the code to see if its possiable with API,
    and this is what he gave me but it wont' send the right Password.
    I checked and it only sent 5 chars and my password has 6; and it only works somtimes.
    Like the other times it doesn't have focus and when it usses the SENDKEY and it presses ENTER, nothing is highlighted so nothing happens, it just brings up the ISP connection screen, so here is the code:
    Code:
    Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    Private Const HKEY_LOCAL_MACHINE = &H80000002
    Private Const ERROR_SUCCESS = 0&
    Private Const REG_SZ = 1
    Private Const KEY_SET_VALUE = &H2
    
    Private Sub Main()
        Call SetProgramStartup("MyProg", "C:\MyProg.exe")
    End Sub
    
    Public Function SetProgramStartup(pProgramName As String, pProgramPath As String) As Boolean
        Dim lKeyHandle As Long
        Dim lRet As Long
        Dim strBuffer As String
        Dim strKey As String
        
        strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
        lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKey, 0, KEY_SET_VALUE, lKeyHandle)
        If lRet = ERROR_SUCCESS Then
          lRet = RegSetValueEx(lKeyHandle, pProgramName, 0, REG_SZ, ByVal pProgramPath, Len(pProgramPath))
          RegCloseKey lKeyHandle
        End If
    End Function
    Private Sub Form_Load()
    Dim X
    '"ConnectionName" is the name under the icon in Dial-up Networking
    X = Shell("rundll32.exe rnaui.dll,RnaDial " & "ConnectionName", 1)
    DoEvents
    'You can type in your password before the { below.
    SendKeys " asdfks  {enter}", True
    DoEvents
    Unload Me
    End
    End Sub

    Thanks for listening, if you know how to fix my problem please post it! and thanks to the other guy(i forgot yoru screen name)but thanks for the code!


    PS: I put in a fake Password of course and i usually put in the COnnectionName but, say if that was my real password it only sends 5 out of the 6 keys, whats going on ? oh and the one who gave me the code was Mike Gates or somthing?hes a guru, so thanks

    [Edited by struntz on 09-23-2000 at 01:20 PM]

  2. #2
    Guest
    This thread, you are referring to.

    Code:
    Private Sub Form_Load()
    Dim X
    X = Shell("rundll32.exe rnaui.dll,RnaDial " & "ConnectionName", 1)
    DoEvents
    SendKeys "asdfks {enter}", True 
    'SendKeys " asdfks  {enter}", True 'here, you have extra spaces
    DoEvents
    Unload Me
    End
    End Sub
    Not sure if that'll work or if you just made a mistake of spacing, but try it.

  3. #3

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

    Question So no spaces?

    OH so there should be no spaces?
    So it should be like 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)
    DoEvents
    'You can type in your password before the { below.
    SendKeys "asdfwe{enter}", True   'no spaces 
    DoEvents
    Unload Me
    End
    End Sub

  4. #4
    Guest
    One space. Like this:

    Code:
    Private Sub Form_Load()
    Dim X
    X = Shell("rundll32.exe rnaui.dll,RnaDial " & "Keystone Internet Access", 1)
    DoEvents
    SendKeys "asdfwe {enter}", True
    DoEvents
    Unload Me
    End
    End Sub

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