Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [V8i C#/MDL] Filter Table Names

$
0
0

[quote user="Mark Stefanchuk"] There seems to be some issues with the mdlFilter_getName function[/quote]

Here's the VBA declaration from the MDL help documentation...

Declare Function mdlFilter_getName Lib "stdmdlbltin.dll" ( _
    ByVal pFilterNameOut As Long , _
    ByVal stringSizeIn As Long , _
    ByVal pModelRefIn As Long , _
    ByVal pFilterTableNameIn As Long , _
    ByVal iFilterIdIn As Long ) As Long

pFilterName is, in MDL, a pointer to a Unicode string buffer.  That's called a Long in VBA because VBA doesn't do pointers.

[quote user="Mark Stefanchuk"][DllImport("stdmdlbltin.dll")] public static extern IntPtr mdlFilterIterator_create(int pModelRefIn, IntPtr pFilterTableNameIn);[/quote]

You're being too literal: pFilterTableNameIn is not an IntPtr.  It looks like that in the VBA declaration only because VBA doesn't do pointers.  However, .NET can marshal data between .NET and non-NET libraries.  You should search the web for solutions, but you may find that something like this works...

[DllImport("stdmdlbltin.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr mdlFilter_getName ( 
out String filterName,
Int32 bufferSize,
IntPtr modelRef,
String filterTableName,
Int32 filterId);

I don't claim to be an expert on this interoperability stuff, so you'll need to search for more info and do some testing.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>