If anyone is interested in making a connection programmatically under
Windows, here's a basic starting point you can expand upon.

win-inet: context [
    ConnID: 0

    win-lib: load/library %wininet.dll

    internet-dial: make routine! [
        hwndParent  [integer!]
        Connectoid  [string!]
        Flags       [integer!]
        ; either string! or char* work here
        ;RtnConnID   [string!]  ; LPDWORD
        RtnConnID   [char*]     ; LPDWORD
        Reserved    [integer!]
        return:     [integer!]
    ] win-lib "InternetDial"

    internet-hang-up: make routine! [
        ConnID      [integer!]  ; Connect ID from InternetDial
        Reserved    [integer!]  ; Must be 0
        return:     [integer!]
    ] win-lib "InternetHangUp"


    test: func [dial-up-name [string!] /local RtnConnID] [
        RtnConnID: copy "^@^@^@^@"
        print "Dialing..."
        ; Pardon the magic numbers. It's a proof-of-concept thing.
        result: internet-dial 0 dial-up-name to-integer #00008000 RtnConnID
0
        print ["dial result:" result]
        if all [(result = 0) (RtnConnID <> "^@^@^@^@")] [
            print "Hanging Up..."
            ConnID: to-integer to-binary head reverse RtnConnID
            result: internet-hang-up ConnID 0
            print ["hang-up result:" result]
        ]
    ]
]

win-inet/test "Your dial-up entry name here"

I'd love to hear if there's a better way to handle pointer parameters (e.g.
LPDWORD).

--Gregg

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to