problem on rasapi32.dll/wince/dotnet

N

Nathan Never

hi,

i have a problem with the using of rasapi32.dll on wince.
I have used this code

<DllImport("rasapi32.dll",
CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
Public Shared Function RasGetErrorString(ByVal uErrorValue As
Integer, ByVal lpszErrorString As String, ByVal cBufSize As Integer)
As Integer
End Function

'<DllImport("coredll.lib", SetLastError:=True)> _
'Public Shared Function RasGetErrorString(ByVal uErrorValue As
Integer, ByVal lpszErrorString As String, ByVal cBufSize As Integer)
As Integer
'End Function



but when i use this on desktop computer there are no problem, on wince
else show the message "can't find pinvoke dll rasapi32.dll"

what's happen?
help pls...
 
P

Paul G. Tobey [eMVP]

They're both referencing DLLs that don't exist in Windows CE. DLL names
almost *never* match between the desktop and Windows CE and there's
certainly no such thing as "coredll.lib", which is what you're trying to
reference in the second call.

Looking at the native code SDK help, I don't see any reference to
RasGetErrorString() at all, so I'd assume that this call doesn't exist at
all.

Paul T.
 
N

Nathan Never

They're both referencing DLLs that don't exist in Windows CE. DLL names
almost *never* match between the desktop and Windows CE and there's
certainly no such thing as "coredll.lib", which is what you're trying to
reference in the second call.

Looking at the native code SDK help, I don't see any reference to
RasGetErrorString() at all, so I'd assume that this call doesn't exist at
all.

Paul T.

ok, and now: how can i use the RAS on WinCE? What function? What Dll?
thanks

Paolo
 
P

Paul G. Tobey [eMVP]

It should be obvious that there's no answer to "what function". Who'd want
to use RAS that had a single function to control it?! Here, just call this
function with 326 parameters. You'd have to tell us what you're trying to
do, if you really want to know what functions to call (and I wouldn't be the
one to ask). If you look in the native (C), SDK for your target device and
read the help for RAS functions, that should tell you where the function is,
in terms of which DLL. You have to know how C works, however (that's
*always* the case with Windows CE programming in managed code; not
understanding how native code works forces you to program almost in the
dark). For example, looking up

RasEnumConnections

in the CE 4.2 help, I scroll down to the bottom and find the following:

OS Versions: Windows CE 1.0 and later.
Header: Ras.h.
Link Library: Coredll.lib.



This tells me that, to see what parameter types are passed, so I can build
my P/Invoke declarations, I need to go to Ras.h. It also tells me that a C
program that uses this call must link with coredll.lib. Coredll.lib is an
import library and most of the items resolved through linking with it will
be found in coredll.dll; you just have to know that. It's not 100% true
that all entries in coredll.lib are pointing to coredll.dll, either, but
it's a good bet.



Paul T.
 

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