|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Trouble with VB.NET and converted data structures |
« View previous topic :: View next topic » |
Author |
Message
|
mmrose |
Posted: Fri Apr 05, 2002 7:42 am Post subject: |
|
|
Newbie
Joined: 04 Apr 2002 Posts: 2
|
I am in the process of upgrading a vb 6.0 app to vb.net. The vb upgrade wizard converts all the "Type - End Type" structures to "Structure - End Structures" and totally changes all the fixed length string variables as they are declared in the current cmqb.bas module. When I try to open a queue using the converted code I get a comp code of 2 with a reason code of 2044 - Object descriptor structure not valid. I believe this has to do with the way the structures were converted and the way vb.net handles the fixed length fields. Has anyone run across this. Is there a published VB.Net version of cmqb.bas (cmqb.vb) - ???
Thanks
mmrose |
|
Back to top |
|
 |
MillsPerry |
Posted: Fri Apr 05, 2002 2:08 pm Post subject: |
|
|
 Acolyte
Joined: 08 Oct 2001 Posts: 59 Location: ZyQuest, inc.
|
VB.Net has eliminated fixed length strings, plus the structure does not store fields in contiguous memory. This makes all Win32 API calls that require structures very hard to do.
Is there any reason you aren't using the ActiveX interface (mqax200.dll)? I see this as your only solution.
Mills Perry |
|
Back to top |
|
 |
mmrose |
Posted: Mon Apr 08, 2002 6:36 am Post subject: |
|
|
Newbie
Joined: 04 Apr 2002 Posts: 2
|
Thanks,
I will research ActiveX solution. |
|
Back to top |
|
 |
MillsPerry |
Posted: Thu Apr 25, 2002 11:20 am Post subject: |
|
|
 Acolyte
Joined: 08 Oct 2001 Posts: 59 Location: ZyQuest, inc.
|
I did a little digging, and here is how you can make a VB .NET structure act like the old UDT.
- Import System.Runtime.InteropServices by adding this line right after "Option Explicit"
Imports System.Runtime.InteropServices
- Prefix your structure declaration with this tag:
<StructLayout (LayoutKind.Sequential, Pack:=1)> _
Public Structure MQMD
- Prefix every fixed length string field with a marshalling tag:
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public E as String
- Use the initialization subroutine to set the default field values.
[ This Message was edited by: MillsPerry on 2002-04-25 12:22 ]
[ This Message was edited by: MillsPerry on 2002-04-25 12:26 ]
[ This Message was edited by: MillsPerry on 2002-04-25 12:27 ] |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|