Re: Starting a Dial Up connection?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: RosAsm injects extra bytes into your data
    ... the ugly part is that he aligns bytename on a dword ... when clearly everyone knows that I have just a year of asm programming. ... problem occurs when you decide that for readability purposes, you want to split apart your declaration sections and declare your variables close to the points in the program where they are used. ... You dont know what it is, and you dont know that it is trivial to have in RosAsm. ...
    (alt.lang.asm)
  • VB 2005 and Windows API calls
    ... I need some basic help with VB. ... Public Class Class1 ... Public Declare Auto Function RemoveControlByName Lib "OCCACHE.DLL" Alias ... ByVal lpszCLSID As DWORD, _ ...
    (microsoft.public.dotnet.languages.vb)
  • Help with VB and Windows API
    ... I need some basic help with VB. ... Public Class Class1 ... Public Declare Auto Function RemoveControlByName Lib "OCCACHE.DLL" Alias ... ByVal lpszCLSID As DWORD, _ ...
    (microsoft.public.vb.winapi)
  • Re: Issue with LINEAGENTGROUPENTRY -> Name
    ... > Andreas - Oops, I was using DWORD instead of LONG for Status. ... In TAPI.H error code ... I have authored a tool to dump all TAPI error codes / messages: ...
    (microsoft.public.win32.programmer.tapi)
  • Re: AzMan Access Check
    ... I have got your Win32 version sample project. ... DWORD dwsid, dwdomain; ... printf("ConvertSidToStringSid failed with error code %d", ... Are you sure we need Domain Admin rights to run the code? ...
    (microsoft.public.platformsdk.security)