|
-
Dec 31st, 2002, 03:18 PM
#1
Thread Starter
Hyperactive Member
VB6's Equivelant "As Any" in VB.Net?
What is the equvelant to "As Any" in VB.Net? I'm trying to use the NetMessageBufferSend API and It won't work as followed..
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (yServer As Any, yToName As Byte, FromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
The "As Any" isn't an option. Should I decalre them objects?
-
Dec 31st, 2002, 03:49 PM
#2
Sleep mode
There are two solutions : Overloading(Love it) , the other ,Marsheling (which I couldn't undertand).
-
Dec 31st, 2002, 03:59 PM
#3
Sleep mode
I mean :
declare the api with different data-types but the same Name.
e.g :
VB Code:
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (yServer As Object, yToName As Byte, FromName As Object, yMsg As Byte, ByVal lSize As Long) As Long
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (yServer As String, yToName As Byte, FromName As String, yMsg As Byte, ByVal lSize As Long) As Long
try to guess what kind of data-types those objects( yServer ,FromName) need.
-
Jan 2nd, 2003, 09:01 AM
#4
New Member
When using such API calls in VB.NET, it is best to review the real API function's parameters... IN this case, it looks like:
NET_API_STATUS NetMessageBufferSend(
LPCWSTR servername,
LPCWSTR msgname,
LPCWSTR fromname,
LPBYTE buf,
DWORD buflen
);
(See: http://msdn.microsoft.com/library/de...buffersend.asp for details.)
Which translates in VB.NET to 3 strings, a byte , and a long, although the byte value is really a pointer to a string buffer. In essence, VB.NET has become a C++ like language in many ways, including the capability to handle APIs like C++. Thus, the data types for API calls in VB.NET will now much more closely resemble their C++ data type counterparts.
The "Any" data type is no longer needed in VB.NET, and it is required that VB.NET API declarations must now use stronger typing in thier declarations.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|