ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Trouble with VB.NET and converted data structures

Post new topic  Reply to topic
 Trouble with VB.NET and converted data structures « View previous topic :: View next topic » 
Author Message
mmrose
PostPosted: Fri Apr 05, 2002 7:42 am    Post subject: Reply with quote

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
View user's profile Send private message
MillsPerry
PostPosted: Fri Apr 05, 2002 2:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
mmrose
PostPosted: Mon Apr 08, 2002 6:36 am    Post subject: Reply with quote

Newbie

Joined: 04 Apr 2002
Posts: 2

Thanks,

I will research ActiveX solution.
Back to top
View user's profile Send private message
MillsPerry
PostPosted: Thu Apr 25, 2002 11:20 am    Post subject: Reply with quote

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.

  1. Import System.Runtime.InteropServices by adding this line right after "Option Explicit"
    Imports System.Runtime.InteropServices
  2. Prefix your structure declaration with this tag:
    <StructLayout (LayoutKind.Sequential, Pack:=1)> _
    Public Structure MQMD
  3. Prefix every fixed length string field with a marshalling tag:
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public E as String
  4. 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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Trouble with VB.NET and converted data structures
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.