473,586 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upgrading VB6 API to VB.NET API calls

I have a VB6 UDT used in an API call as follows:

Type RASCONN
hRasConn As Long
sEntryName As String
sDeviceType As String
sDeviceName As String
sPhonebook As String
lngSubEntry As Long
guidEntry(15) As Byte
End Type

So converting to VB.NET structure:

Structure RASCONN
Public hRasConn As Integer
Public sEntryName As String
Public sDeviceType As String
Public sDeviceName As String
Public sPhonebook As String
Public lngSubEntry As Integer
Public guidEntry(15) As Byte **
End Stucture

** The last field, guidEntry(15) cannot be used in a VB.NET structure
because structure members cannot be declared with an intitial size.
What is the best way to work around this in VB.NET?
Any links to guidelines on making API calls from VB.NET would be greatly
appreciated.
I have looked for references on the web, but all of them were at a basic
level.

--
Thanks for any help,
Shayne H
Nov 20 '05 #1
1 2984
Shayne,
guidEntry(15) As Byte Is guidEntry as GUID?

If it is, I would use System.Guid instead of an array of bytes.
What is the best way to work around this in VB.NET? Alternatively there is a way to use MarshalAs attribute to indicate that
guidEntry is to be marshaled as a 16 byte array. See
System.Runtime. InteropServices .MarshalAsAttri bute, I don't have a sample
immediately available.
Any links to guidelines on making API calls from VB.NET would be greatly
appreciated.
I've been using Adam Nathan's book ".NET and COM - The Complete
Interoperabilit y Guide" from SAMS press. Very complete (too complete?) :-)

Also you can ask 'down the hall' in the
microsoft.publi c.dotnet.framew ork.interop newsgroups for help on API calls.

Hope this helps
Jay

"Shayne H" <shaynehATlycos SPAMGOTOHELLcoD OTuk> wrote in message
news:up******** ******@TK2MSFTN GP10.phx.gbl... I have a VB6 UDT used in an API call as follows:

Type RASCONN
hRasConn As Long
sEntryName As String
sDeviceType As String
sDeviceName As String
sPhonebook As String
lngSubEntry As Long
guidEntry(15) As Byte
End Type

So converting to VB.NET structure:

Structure RASCONN
Public hRasConn As Integer
Public sEntryName As String
Public sDeviceType As String
Public sDeviceName As String
Public sPhonebook As String
Public lngSubEntry As Integer
Public guidEntry(15) As Byte **
End Stucture

** The last field, guidEntry(15) cannot be used in a VB.NET structure
because structure members cannot be declared with an intitial size.
What is the best way to work around this in VB.NET?
Any links to guidelines on making API calls from VB.NET would be greatly
appreciated.
I have looked for references on the web, but all of them were at a basic
level.

--
Thanks for any help,
Shayne H

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2467
by: S. Crespel | last post by:
Hi, Where can I find informations about consequences of upgrading from PHP 4.2.3 to 4.3 regarding existing PHP applications ? I have lots of existing PHP (4.2.3) scripts, will everything still work if I upgrade PHP to 4.3 ? What changes have to be done ? (Solaris 8, Apache 1.3.28, Oracle 8.1.9.3)
2
1625
by: wellington fan | last post by:
Dear newsies, My ISP has offered to upgrade my servers from 3.23 to 4.1. I'm excited by the potential gains in performance, and the ability to write subqueries, but am wary of any forward incompatibilities. I have a mass of PHP code with MySQL throughout. I don't relish peeking into every file and making a determination of 'it should...
5
512
by: Mike Owen | last post by:
Hi, I have just used the import Wizard to import a VS 2003 app to VS 2005. I have a lot of work to do to enable it to compile successfully with all the errors and warnings it gave me, but as a starting point the compiler can no longer find the function as at the bottom of this posting, that was in the Global.asax.vb file. All the...
11
1912
by: Aidan Tobin | last post by:
Hi, I have to upgrade a number of databases from Access 2.0, Access 97 and Access 2000 to work in Office 2003. These databases contain a number of Forms coded with VBA as well as a number of Queries/Macros. The Microsoft web site says that Office 2003 will open databases created in these versions. However i have in the past upgraded...
17
2054
by: Owen Jenkins | last post by:
I have an Access application that is being used by 150+ clients. I develop in 97, convert to 2000 and distribute as a 97 or 2000 mde, or 97 runtime. This limits me to 97 functions. My clients may use any one of Access 97, 2000, 2002, 2003 or 97 runtime. So that I'm not lingering too far behind, I'm thinking of developing in 2003, using 2000...
3
3791
by: test | last post by:
Hey everyone. I'm just trying out some of our code to see if it is even possible to think about moving to VC8. Apart from a few minor problems in our stuff (to do with wrong for loop scoping and deprecated function calls) most of our projects build fine. However one small but incredibly important dll won't build.
1
1543
by: progTiger | last post by:
The upgrade wizard just hangs on step 5 of 5 when it reaches "Upgrading DataEnvironment..." I have let it sit for 3 hours and it does nothing. .Net Studio is not frozen, but the process does nothing. How do I get past this?? Tiger
8
2047
by: Smartin | last post by:
My Company is planning to upgrade MSOffice from 97 to 2003 this year. We make fairly extensive use of Access 97 databases to support departmental needs, having on the order of 50 MDB's in regular use. I heard on the grapevine that the Company is planning to hire a consultant to assist in the migration to upgrade all the MDB files. Before my...
6
1598
by: JimLad | last post by:
Hi, We have a major ASP app that we are in the process of upgrading to ASP.NET 1.1 and probably on to ASP.NET 2.0 in the middle of next year. (We will also be upgrading to SQL2K5 at the same time). The current architecture is heavily based on the client side, both for validation and data access. The asp page is returned and then data is...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.