Results 1 to 5 of 5

Thread: How can i make it so when i start up the computer to make me auto-connect?

  1. #1

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

    Question

    Hello, i have a question about what kinda API call i should use or any other statement to make it so when i turn my computer on my ISP auto connects so i don't have to click on the connecting icon...if u know, please send me some infomration

    Thanks for listening

  2. #2
    Guest
    Try this:

    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 "{enter}", True
    DoEvents
    Unload Me
    End
    End Sub
    Hope that helps.

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Have you tried putting a short-cut of Internet Explorer (or whatever web browser you use) in the Startup folder of the start menu?

  4. #4
    Guest
    He wants to auto-connect which the code I gave does. If you put it in the start-up folder, it will auto-connect, you'd have to click it manually...unless you put a click button code in a Timer.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You'd have to click what manually?
    Whatever is in the startup directory starts, so Internet explorer would start and make then connection, you just set the connect automatically box.
    I am not cappin' on your code that is the bomb if you want to do it that why.

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