Announcement

Collapse
No announcement yet.

How to create shortcut from RAS entry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Egbert Zijlema
    replied
    Yep!

    This is exactly what I've done:
    1. created all the RAS entries my installation package might use (I, for instance, need 5 different entries, partly because of a different name, partly due to area code and phone number).
    2. made shortcuts of all of 'm
    3. copied the shortcuts to the install package

    Take care that the entries that 'our' installer will create on the customer's PC do have the same entry name as the pre-fabricated, handmade shortcuts.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Scott Turchin
    replied
    I noted when I hex edited my shortcut it didn't have any pathing or anything, just the name of the DUN entry...
    Very cool, so you just create a LNK file manually and put it in the installation package? That'd swift...

    Scott

    ------------------
    Scott
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Egbert Zijlema
    replied
    Problem solved, folks!

    Copied shortcuts from Dial-Up Networking do work on alien machines.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Egbert Zijlema
    replied
    Semen,

    I'm making a packet of install software that has to copy several programs to users' computers.
    In order to let them connect with the company, the packet includes a RAS entry for Dial-Up Networking.
    Okay, the RAS entry can be made now (see thread "Creating a DUN file" in this forum), but I want a
    shortcut to that entry on the desktop, as well. Simply because many users do not know how to create that
    shortcut by hand (using the right mouse button).

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Semen Matusovski
    replied
    Hi, Egbert --
    Sorry, but I think that you selected wrong way.
    As I understand, format of DUN file is NOT DOCUMENTED and Microsoft is able to change it w/o any declarations.

    Probably, I lost something, but you want to bypass ISP setup procedure.
    Nothing more, nothing less.
    If so, for what purpose to create DUN file, if possible to connect without it ?


    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Egbert Zijlema
    replied
    Hi Semen and Vladi,
    Hold your horses! This thread is not about RAS.INC We have discussed RAS32.INC thouroughly in "Creating a DUN file" (elsewhere in this forum).
    Scott Turchin and I (and maybe others) want to know how to create a shortcut from a RAS entry, programmatically.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Leave a comment:


  • Vladimir Shulakov
    replied
    Yes, different INC.

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    I think that we talk about different INC. I am about dd. 13.04.99
    But now I see, what could be wrong --
    Don included buffer As String * 3 (for alignment ?)
    "SizeOf" / "Len" should be without this field.

    Code:
    '
    '  RAS Functions
    '
    '  Partial translation of the C header files for the RAS connection
    '
    '  by Don Dickinson
    '  Hereby Public Domain
    '  Use or Misuse of this code implies that you hold the author (Don Dickinson)
    '  harmless for any effects or side-effects generated by this code.
    '
    '  Depends upon your copy of win32api.inc that came with PB/DLL
    '
    '=================================================================================================
    %RASBASE = 600
    
    %ERROR_INVALID_PORT_HANDLE             = %RASBASE + 1
    %ERROR_BUFFER_TOO_SMALL                = %RASBASE + 3
    %ERROR_BUFFER_INVALID                  = %RASBASE + 10
    %ERROR_CANNOT_FIND_PHONEBOOK_ENTRY     = %RASBASE + 23
    %ERROR_INVALID_SIZE                    = %RASBASE + 32
    
    %RAS_MAXENTRYNAMEBUFFER = 257
    %RAS_MAXDEVICETYPE      = 16
    %RAS_MAXENTRYNAME       = 256
    %RAS_MAXDEVICENAME      = 128
    %RAS_MAXPHONENUMBER     = 128
    %RAS_MAXCALLBACKNUMBER  = %RAS_MAXPHONENUMBER
    %ULEN                   = 256
    %PWLEN                  = 256
    %DNLEN                  = 15
    
    '- Connection Status Constants
    %RASCS_PAUSED                 = &h1000
    %RASCS_DONE                   = &h2000
    %RASCS_Connected              = %RASCS_DONE
    
    '- The members are not dword aligned, but the whole
    '  structure has to fit into a 4-byte bounded memory space,
    '  thus the extra 3-byte buffer at the end of the structure.
    '  So far, all of the ras structures I've found work this
    '  way. NOTE: This is not the same as using the Dword specifier
    '  in the type declaration (that would dword align each
    '  member of the structure).
    '
    Type RASENTRYNAME
       dwSize As Dword
       szEntryName As Asciiz * %RAS_MAXENTRYNAMEBUFFER
       buffer As Asciiz * 3
    End Type
    
    Type RASDIALPARAMS
       dwSize As Dword                                             '4
       szEntryName As Asciiz * %RAS_MAXENTRYNAME + 1               '257
       szPhoneNumber As Asciiz * %RAS_MAXPHONENUMBER + 1           '129
       szCallBackNumber As Asciiz * %RAS_MAXCALLBACKNUMBER + 1     '129
       szUserName As Asciiz * %ULEN + 1                            '257
       szPassword As Asciiz * %PWLEN + 1                           '257
       szDomain As Asciiz * %DNLEN + 1                             '16
       buffer As String * 3                                        '3
    End Type
    
    Type RASDIALEXTENSIONS
       dwSize As Dword
       dwfOptions As Dword
       hwndParent As Long
       reserved As Long
    End Type
    
    Type RASCONN
       dwSize As Dword                                       '4
       hRasConn As Long                                      '4          8
       szEntryName As Asciiz * %RAS_MAXENTRYNAME + 1         '257        265
       szDeviceType As Asciiz * %RAS_MAXDEVICETYPE + 1       '17         282
       szDeviceName As Asciiz * %RAS_MAXDEVICENAME + 1       '129        411
       buffer As String * 1                                  '1          412
    End Type
    
    Type RASCONNSTATUS
        dwSize As Dword                                      '4
        rasconnstate As Long                                 '4    8
        dwError As Dword                                     '4    12
        szDeviceType As Asciiz * %RAS_MAXDEVICETYPE + 1      '17   29
        szDeviceName As Asciiz * %RAS_MAXDEVICENAME + 1      '129  158
        buffer As String * 2                                 '1    160
    End Type
    
    '- Finally, the functions
    Declare Function RasGetConnectStatus Lib "rasapi32.dll" Alias "RasGetConnectStatusA" _
          (  ByVal hRasConn As Long, lpRasConnStatus As RASCONNSTATUS ) As Long
    
    Declare Function RasEnumEntries Lib "rasapi32.dll" Alias "RasEnumEntriesA" _
          (  zReserved As Asciiz, zPhoneBook As Asciiz, lpRasEntry As RASENTRYNAME, _
             lpCb As Long, lpcEntries As Long ) As Long
    
    Declare Function RasGetEntryDialParams Lib "rasapi32.dll" Alias "RasGetEntryDialParamsA" _
          (  zPhoneBook As Asciiz, rDialParams As RASDIALPARAMS, iPassword As Long ) As Long
    
    Declare Function RasDial Lib "rasapi32.dll" Alias "RasDialA" _
          (  lpRasDialExtensions As RASDIALEXTENSIONS, lpszPhoneBook As Asciiz, _
             lpRasDialParams As RASDIALPARAMS, ByVal dwNotiferType As Dword, _
             ByVal lpvNotifier As Long, lphRasConn As Long   ) As Dword
    
    Declare Function RasHangUp Lib "rasapi32.dll" Alias "RasHangUpA" _
          (  ByVal hRasConn As Long ) As Long
    
    Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" _
          (  lpRasConn As RASCONN, lpcb As Long, lpcConnections As Long ) As Dword

    [This message has been edited by Semen Matusovski (edited January 18, 2001).]

    Leave a comment:


  • Vladimir Shulakov
    replied

    Hi Semen.

    I use digit lines with tone set.
    And you example work very good, but only with
    rdParams.dwSize = LEN(rdParams)

    If rdParams.dwSize = SizeOf(rdParams) then you example
    don't work...

    V.Shulakov



    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    Vladimir --
    It's the same at least for INC, which I have.
    In general I avoid Len in similar situations.
    For example, Dim a As Asciiz * 10: a = "abc"
    Len returns 3. SizeOf returns required 10.

    About fragment. When I run it on my PC under Win2000 (no DUN at all), it rings, but is used "tone" mode.
    It's Ok for West Europe / USA, but incorrect for xUSSR lines.
    Don't know about Ukraine, but in Russia goverment lines remain impulse.
    Only independent telephone providers use modern digit lines with tone set.

    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Vladimir Shulakov
    replied
    Hi
    Semen, maybe:
    -------------------------------
    rdParams.dwSize = LEN(rdParams)

    ----------
    V.Shulakov

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    Egbert --
    Can't test (I have no dial-up now), but I hope that following works without any DUN.
    Code:
        #Compile Exe
        #Dim All
        #Register None
        #Include "Ras32.inc" ' Don Dickinson
    
        Function PbMain
    
        Dim rdParams As RASDIALPARAMS
        rdParams.dwSize = SizeOf(rdParams)
        rdParams.szPhoneNumber = "7423434" ' <--------------
        rdParams.szUserName = "demo" ' <--------
        rdParams.szPassword = "test" ' <------
    
        Dim hRasConn As Long
        hRasConn = 0
    
        If RasDial(ByVal 0&, "", rdParams, 0&, 0&, hRasConn) = 0 Then
           MsgBox "ok"
        Else
           MsgBox "Not Ok"
           RasHangUp hRasConn
        End If
    
        End Function
    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Egbert Zijlema
    started a topic How to create shortcut from RAS entry

    How to create shortcut from RAS entry

    Okay,
    Now we know how to create a RAS entry (see the thread "Creating a DUN file" in this forum).
    But how about creating a shortcut as well? In my opinion there is one huge problem: the Dial-Up Networking folder is not a normal Windows directory. So, one cannot retrieve its path programmatically, in order to copy the freshly created RAS entry to the Desktop. Nor can the DUN folder be accessed using the SHGetSpecialFolderLocation API.

    I'm thinking of the following trick. In advance, create shortcuts for all the possible RAS entries your software may install on user's computers. Copy these shortcuts to your install disk and let your install software copy the appropriate one to the desktop of the user's PC.

    The important question is: will such a copied shortcut work on a computer that not really created it?

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/
Working...
X