Re: Starting a Dial Up connection?
- From: "Dragon" <no@xxxxxxxxxxx>
- Date: Thu, 1 Sep 2005 17:32:13 +0400
Okay, let me explain a little bit...
"Lars Netzel" <uihsdf@xxxxxx> ñîîáùèë/ñîîáùèëà â íîâîñòÿõ ñëåäóþùåå:
news:OmX16uurFHA.2348@xxxxxxxxxxxxxxxxxxxxxxx
> From the Function I had I recieved this error code "30064771159" how
do I
> get to know what that means?
Well, since your declaration is bad you can't rely on this value.
>
> On this page...
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet
/wininet/internetdial.asp
>
> ...the error Codes are text and not numbers... I asume I have gotten
one of
> those errors but I can't figure out how to translate this... I'm
totally
> confused..
Those are not text, but constants, defined in C header files; AFAIK,
MSDN doesn't contain their values. You can get their value either by
searching for "#define ERROR_XXX" in headers (obviously if you have
them), or download utility called ApiViewer
http://www.activevb.de/rubriken/apiviewer/index-apiviewereng.html which
contains declarations for many API functions and constants (in VB .NET
syntax too!).
>
> And with your "new" declaration.. I appriciate your response.. and
when I
> copy that into my code there's no Blue Underlines.. but then it's not
the
> same arguments anymore and I dont' understand how to call it anymore..
Why
> is it not the same argument if it's the same function?
To my opinion, the best way to write a Declare statement is to look in
headers or MSDN for a C-style prototype and convert it manually.
So let's take the InternetDial prototype:
C: DWORD InternetDial(
VB .NET: Declare Auto Function InternetDial Lib "wininet.dll" ( _
here you import a function from wininet.dll. The Auto keyword
indicates that a ANSI version (i.e. InternetDialA) will be used on Win9x
and Unicode (InternetDialW) on WinNT.
C: HWND hwndParent,
VB .NET: ByVal hwndParent As IntPtr, _
HWND datatype is a synonym for "void*" which is simply a "pointer
for
anything". It takes 4 bytes so you can declare it as Integer but all
pointer-like things in .NET (handles etc.) are IntPtr's, so it's better
to declare such params as IntPtr's to avoid endless .ToInt32's.
C: LPTSTR lpszConnectoid,
VB .NET: <MarshalAs(UnmanagedType.LPTStr)> ByVal lpszConnectoid As
String, _
LPSTR is a pointer to null-terminated string, ANSI on Win9x, Unicode
on WinNT. You need to marshal it as above.
C: DWORD dwFlags,
VB .NET: ByVal dwFlags As Integer, _
DWORD is a 4-byte integer. In VB. NET it is Integer.
C: DWORD_PTR lpdwConnection, _
VB .NET: ByRef lpdwConnection As Integer, _
DWORD_PTR is a synonym to DWORD* (pointer to DWORD). In VB .NET, you
can declare it as ByRef.
C: DWORD dwReserved
VB .NET: ByVal dwReserved As Integer, _
the same as dwFlags
C: );
VB .NET: ) As Integer
Remember DWORD at the very beginning of prototype? It's there! 8=]
>
> I also want to add that this is the first time I have had to deal wtih
API
> and Windows.. so all this is very new to me.. I do not recoginze the
> decalarations one bit and what they mean.
Declarations mean that you import function exported in DLL. This
technique is called P/Invoke (Platform Invoke).
>
> /Lars Netzel
>
I hope you can make your way through my English, and good luck!
Roman
.
- References:
- Re: Starting a Dial Up connection?
- From: Marius Groenendijk
- Re: Starting a Dial Up connection?
- From: Lars Netzel
- Re: Starting a Dial Up connection?
- From: Marius Groenendijk
- Re: Starting a Dial Up connection?
- From: Lars Netzel
- Re: Starting a Dial Up connection?
- From: Dragon
- Re: Starting a Dial Up connection?
- From: Lars Netzel
- Re: Starting a Dial Up connection?
- Prev by Date: Anyone know how to "hack"
- Next by Date: Re: ToolStripComboBox Items
- Previous by thread: Re: Starting a Dial Up connection?
- Next by thread: Re: Starting a Dial Up connection?
- Index(es):
Relevant Pages
|