RAS Connection + FileTransfer

G

Guest

Hi
i 've some newbie probs.
At the moment, I (hope to) realize a project on a pocket PC 2003 (MDA II) phone Edt.
The programm code is in vb.net

My problems are, I want do a Filetransfer via Ras from my pocketPC to a pc. I 've test is manually per Options/Connections/BusinessNetwork.Subsequently, I need the FileExplorer, search the Orders and copy/paste the file. Thats already fine. But their are many parts to go. I need it to do per code in my application. But I do not wanna know, how i can do it.

I 've seen their are a API calls RAPI, but how i can need the functions init ?
Please can anybody help me

e.g. an example(code in vb.net) to use a function from an api.

with friendly regards and a lot of thank

André
 
G

Guest

Hi folks,
i minimize my problem. I use the following code to realize a connection to a pc via remote access services.
If I use the function RasDial(), I take an very hard Error:

NotSupportedException

Application::Run+Oxf
frmPrima::MAin+Oxd

Maybe, anybody can help me.

regards André


-- THE CLASS --

Imports System.Runtime.InteropServices
Imports interopserv = System.Runtime.InteropServices

Public Class RAPI

Private Const RAS_MaxEntryName As Integer = 256
Private Const RAS_MaxPhoneNumber As Integer = 128
Private Const UNLEN As Integer = 256
Private Const PWLEN As Integer = 256
Private Const DNLEN As Integer = 15
Private Const MAX_PATH As Integer = 260
Private Const RAS_MaxDeviceType As Integer = 16
Private Const RAS_MaxDeviceName As Integer = 128
Private Const RAS_MaxCallbackNumber As Integer = RAS_MaxPhoneNumber

Delegate Sub Callback(ByVal unMsg As Integer, ByVal rasconnstate As Integer, ByVal dwError As Integer)

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Auto)> _
Public Structure RASDIALPARAMS
Public dwSize As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=RAS_MaxEntryName + 1)> _
Public szEntryName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=RAS_MaxPhoneNumber + 1)> _
Public szPhoneNumber As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=RAS_MaxCallbackNumber + 1)> _
Public szCallbackNumber As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=UNLEN + 1)> _
Public szUserName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=PWLEN + 1)> _
Public szPassword As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DNLEN + 1)> _
Public szDomain As String
Public dwSubEntry As Integer
Public dwCallbackId As Integer

End Structure

<DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function RasDial(ByVal lpRasDialExtensions As Integer, ByVal lpszPhonebook As String, ByRef lprasdialparams As RASDIALPARAMS, ByVal ByValdwNotifierType As Integer, ByVal lpvNotifier As Callback, ByRef lphRasConn As Integer) As Integer
End Function

Public Shared Sub RasDialFunc(ByVal unMsg As Integer, ByVal rasconnstate As Integer, ByVal dwError As Integer)
Debug.WriteLine("DF: " & unMsg.ToString & " - " & rasconnstate.ToString & " - " & dwError.ToString)
End Sub

End Class

-- END OF CLASS --

-- FORM ---

Public cRasDialParams As RAPI.RASDIALPARAMS
Public Connection As Integer

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
cRasDialParams.szUserName = "test" ' e.g
cRasDialParams.szPassword = "test" ' e.g
cRasDialParams.szPhoneNumber = "12345678" ' e.g

Connection = Nothing

RAPI.RasDial(Nothing, Nothing, cRasDialParams, 0, AddressOf RAPI.RasDialFunc, Connection)

End Sub

-- END OF FORM --
 
F

Felipe T.

Mayb this could help:
http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=1185

Andre said:
Hi folks,
i minimize my problem. I use the following code to realize a connection to
a pc via remote access services.
If I use the function RasDial(), I take an very hard Error:

NotSupportedException

Application::Run+Oxf
frmPrima::MAin+Oxd

Maybe, anybody can help me.

regards André


-- THE CLASS --

Imports System.Runtime.InteropServices
Imports interopserv = System.Runtime.InteropServices

Public Class RAPI

Private Const RAS_MaxEntryName As Integer = 256
Private Const RAS_MaxPhoneNumber As Integer = 128
Private Const UNLEN As Integer = 256
Private Const PWLEN As Integer = 256
Private Const DNLEN As Integer = 15
Private Const MAX_PATH As Integer = 260
Private Const RAS_MaxDeviceType As Integer = 16
Private Const RAS_MaxDeviceName As Integer = 128
Private Const RAS_MaxCallbackNumber As Integer = RAS_MaxPhoneNumber

Delegate Sub Callback(ByVal unMsg As Integer, ByVal rasconnstate As
Integer, ByVal dwError As Integer)
<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Auto)> _
Public Structure RASDIALPARAMS
Public dwSize As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=RAS_MaxEntryName + 1)> _
Public szEntryName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=RAS_MaxPhoneNumber + 1)> _
Public szPhoneNumber As String
<MarshalAs(UnmanagedType.ByValTStr,
SizeConst:=RAS_MaxCallbackNumber + 1)> _
Public szCallbackNumber As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=UNLEN + 1)> _
Public szUserName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=PWLEN + 1)> _
Public szPassword As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DNLEN + 1)> _
Public szDomain As String
Public dwSubEntry As Integer
Public dwCallbackId As Integer

End Structure

<DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function RasDial(ByVal lpRasDialExtensions As Integer,
ByVal lpszPhonebook As String, ByRef lprasdialparams As RASDIALPARAMS, ByVal
ByValdwNotifierType As Integer, ByVal lpvNotifier As Callback, ByRef
lphRasConn As Integer) As Integer
End Function

Public Shared Sub RasDialFunc(ByVal unMsg As Integer, ByVal
rasconnstate As Integer, ByVal dwError As Integer)
Debug.WriteLine("DF: " & unMsg.ToString & " - " &
rasconnstate.ToString & " - " & dwError.ToString)
End Sub

End Class

-- END OF CLASS --

-- FORM ---

Public cRasDialParams As RAPI.RASDIALPARAMS
Public Connection As Integer

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top