473,435 Members | 1,540 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,435 software developers and data experts.

Need Help It is urgent


Hy,
I have a problem at which I can not find the solution:
I have this:
Declare Sub VRB_IO_StdInstel Lib "TWVRB408.DLL" Alias
"_VRB_IO_StdInstel@12" (ByVal Mode As Integer, ByVal szIniFile As
String, ByRef pStdInstel As STR_STANDAARD_INSTELLINGEN)
Structure STR_STANDAARD_INSTELLINGEN
Dim VerbType As Integer ' Verbindingstype: 1..6
Dim DoorgaandProfiel As Integer ' Doorgaand profiel: 1=kol,
2=lig
Dim Fyd As Integer ' Rekenwaarde vloeispanning
Dim KlassKonstr As Integer ' Klassifikatie konstruktie:
1=ongeschoord, 2=geschoord
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> _
Dim padding_1() As Byte ' Boutkwaliteit
Dim BoutKwaliteit As Integer ' Boutkwaliteit
Dim MilieuKorrosief As Integer ' Milieu korrosief: 0=nee, 1=ja

<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> _
Dim padding_2() As Byte ' Ankerkwaliteit
Dim AnkerKwaliteit As Integer ' Ankerkwaliteit
Dim BetonKwaliteit As Integer ' Betonkwaliteit
Dim VoegKwaliteit As Integer ' Voegkwaliteit
Dim EBeton As Integer ' E-modulus beton
Dim EVoeg As Integer ' E-modulus voeg
Dim Norm As Integer ' Default normkeuze: NT_TGB etc.
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> _
Dim ProfLijst() As Byte ' Naam van actueel gekozen profiellijst

<MarshalAs(UnmanagedType.ByValArray, SizeConst:=240)> _
Dim Profiel(,) As Byte ' Laatst gebruikte profielnamen in
wizard
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> _
Dim padding_3() As Byte ' Default eindmaat e1 (... * d)
Dim EindmaatE1 As Integer ' Default eindmaat e1 (... * d)
Dim SteekmaatS1 As Integer ' Default steekmaat s1 (... * d)
' !!! Bufferlengte is: 552
Public Sub Initialize()
ReDim padding_1(2)
ReDim padding_2(2)
ReDim ProfLijst(260)
ReDim Profiel(48, 5)
ReDim padding_3(2)
End Sub
End Structure
And when I try to call the function VRB_IO_StdInstel in the procedure:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim f As New STR_STANDAARD_INSTELLINGEN
f.Initialize()
VRB_IO_StdInstel(0, "C:\Windows\TsWin.ini", f)
End Sub
it give an error like this:
"An unhandled exception of type 'System.TypeLoadException' occurred in
WindowsApplication1.exe

Additional information: Can not marshal field Profiel of type
STR_STANDAARD_INSTELLINGEN: This type can not be marshaled as a
structure field."

Could anyone give me a solution for this error?
Please it is urgent to solve this.
Thanks
Avy
--
avy31
------------------------------------------------------------------------
avy31's Profile: http://www.hightechtalks.com/m188
View this thread: http://www.hightechtalks.com/t2276430

Nov 23 '05 #1
3 1496
Hi,

"avy31" <av**********@no-mx.forums.yourdomain.com.au> wrote in message
news:av**********@no-mx.forums.yourdomain.com.au...

Hy,
I have a problem at which I can not find the solution:
I have this:
Declare Sub VRB_IO_StdInstel Lib "TWVRB408.DLL" Alias
"_VRB_IO_StdInstel@12" (ByVal Mode As Integer, ByVal szIniFile As
String, ByRef pStdInstel As STR_STANDAARD_INSTELLINGEN)
Structure STR_STANDAARD_INSTELLINGEN
Dim VerbType As Integer ' Verbindingstype: 1..6
Dim DoorgaandProfiel As Integer ' Doorgaand profiel: 1=kol,
2=lig
Dim Fyd As Integer ' Rekenwaarde vloeispanning
Dim KlassKonstr As Integer ' Klassifikatie konstruktie:
1=ongeschoord, 2=geschoord
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> _
Dim padding_1() As Byte ' Boutkwaliteit
Dim BoutKwaliteit As Integer ' Boutkwaliteit
Dim MilieuKorrosief As Integer ' Milieu korrosief: 0=nee, 1=ja

<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> _
Dim padding_2() As Byte ' Ankerkwaliteit
Dim AnkerKwaliteit As Integer ' Ankerkwaliteit
Dim BetonKwaliteit As Integer ' Betonkwaliteit
Dim VoegKwaliteit As Integer ' Voegkwaliteit
Dim EBeton As Integer ' E-modulus beton
Dim EVoeg As Integer ' E-modulus voeg
Dim Norm As Integer ' Default normkeuze: NT_TGB etc.
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> _
Dim ProfLijst() As Byte ' Naam van actueel gekozen profiellijst

<MarshalAs(UnmanagedType.ByValArray, SizeConst:=240)> _
Dim Profiel(,) As Byte ' Laatst gebruikte profielnamen in
wizard
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> _
Dim padding_3() As Byte ' Default eindmaat e1 (... * d)
Dim EindmaatE1 As Integer ' Default eindmaat e1 (... * d)
Dim SteekmaatS1 As Integer ' Default steekmaat s1 (... * d)
' !!! Bufferlengte is: 552
Public Sub Initialize()
ReDim padding_1(2)
ReDim padding_2(2)
ReDim ProfLijst(260)
ReDim Profiel(48, 5)
ReDim padding_3(2)
End Sub
End Structure
And when I try to call the function VRB_IO_StdInstel in the procedure:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim f As New STR_STANDAARD_INSTELLINGEN
f.Initialize()
VRB_IO_StdInstel(0, "C:\Windows\TsWin.ini", f)
End Sub
it give an error like this:
"An unhandled exception of type 'System.TypeLoadException' occurred in
WindowsApplication1.exe

Additional information: Can not marshal field Profiel of type
STR_STANDAARD_INSTELLINGEN: This type can not be marshaled as a
structure field."

Could anyone give me a solution for this error?
Dim Profiel(,) As Byte ' Laatst gebruikte profielnamen in wizard

Pinvoke doesn't support multi-dimension arrays inside structures, you can
declare a single-dimension array whose length is the multiplication of the
two dimensions.

HTH
Greetings
Please it is urgent to solve this.
Thanks
Avy
--
avy31
------------------------------------------------------------------------
avy31's Profile: http://www.hightechtalks.com/m188
View this thread: http://www.hightechtalks.com/t2276430

Nov 23 '05 #2

Hy
Thanks for your help.Seems to be the only solution.
But it is hard to apply because the 2 dimension array is used in other
parts of the application as 2 dimension array.
Do you have another solution?How can I call the parameter as structure
in DLL function to solve this problem without change the 2 dimension
array?

Greetings
Avy
--
avy31
------------------------------------------------------------------------
avy31's Profile: http://www.hightechtalks.com/m188
View this thread: http://www.hightechtalks.com/t2276430

Nov 23 '05 #3
Hi,

"avy31" <av**********@no-mx.forums.yourdomain.com.au> wrote in message
news:av**********@no-mx.forums.yourdomain.com.au...

Hy
Thanks for your help.Seems to be the only solution.
But it is hard to apply because the 2 dimension array is used in other
parts of the application as 2 dimension array.
Instead of accessing it like data[i,j], you can access it like data[(i*jd) +
j] (where jd is the second dimension).

You could also use Buffer.BlockCopy to copy the single dimension array to a
mutli dimension array (and back).

HTH,
Greetings
Do you have another solution?How can I call the parameter as structure
in DLL function to solve this problem without change the 2 dimension
array?

Greetings
Avy
--
avy31
------------------------------------------------------------------------
avy31's Profile: http://www.hightechtalks.com/m188
View this thread: http://www.hightechtalks.com/t2276430

Nov 23 '05 #4

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

Similar topics

1
by: Rahul S. | last post by:
Hey all: I need urgent information how to set the environment in Visual.NET wiritng in C. I am working with a licensed version of the Analyze 6.0 software from mayo clinic. I need to write...
3
by: Rahul S. | last post by:
Hey all: I need urgent information how to set the environment in Visual.NET wiritng in C. I am working with a licensed version of the Analyze 6.0 software from mayo clinic. I need to write...
28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
16
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
2
by: Max Power | last post by:
Hi All I am coding a small app in that swaps specific files between a client and server. All files and locations are set at both sides. I want my app to show a file list, based on the file...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
3
by: Noremac | last post by:
My google skills must be dwindling. I am trying to determine how in ASP.NET 2.0 I can get the ReturnUrl querystring variable in Forms Authentication to contain the absolute url. Just like others...
9
needhelp123
by: needhelp123 | last post by:
Can any one send me a quick sort simple logic pogram... its very urgent urgent
1
by: psantosh12 | last post by:
Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.