array of strings as parameter to COM
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
array of strings as parameter to COM
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization

Author Message
tacho_fortin
Guest





Posted: Tue Jan 04, 2005 7:07 pm    Post subject: array of strings as parameter to COM Reply with quote

Hi ppl,

Im trying to pass a list of strings as a parameter to a COM dll made in c#.

The problem i have is that although i can pass a single string, couldnt guess how to do it with an array.

Here is the code.

defun test ( / arr )
(vl-load-com)
(setq arr (vlax-make-safearray vlax-vbString '(0 . 1) ))
(vlax-safearray-fill arr '("test1" "test2"))
(vlax-invoke-method (vlax-invoke (vlax-get-acad-object) "getinterfaceobject" "ns.cls")"test" arr)
(princ)
)


using System.Runtime.InteropServices ;
namespace ns{
public class cls{
public void test(object a ){
string[] arrayOfStrings = (string[])a;
System.Diagnostics.Debug.Assert( false ) ;
}
}
}

With this code, i receive an int in the parameter "a" of the "test" function in c#.
I guess that may be a pointer, but kept me scratching my head for a lot of time how to marshal that to a usable array.

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
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

Access Forum - Microsoft Office Forum - Electronics

Contact Us Powered by phpBB