473,378 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 2980
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.MarshalAsAttribute, 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
Interoperability Guide" from SAMS press. Very complete (too complete?) :-)

Also you can ask 'down the hall' in the
microsoft.public.dotnet.framework.interop newsgroups for help on API calls.

Hope this helps
Jay

"Shayne H" <shaynehATlycosSPAMGOTOHELLcoDOTuk> wrote in message
news:up**************@TK2MSFTNGP10.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
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...
2
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...
5
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...
11
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...
17
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...
3
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...
1
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...
8
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...
6
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.