.net 3.5 - Creating a com object with another com object in C# -


this follow previous question. i'm trying convert vb.net code c#. com object created (atldirectorobject.atldirector) , used create com object (atl3270tool) parameter. atl3270tool not getting created in c# version. going wrong route trying reference atl3270tool through object array?

'working vb code dim atl3270tool dim errmsg string dim atldirectorobject = createobject("atldirectorobject.atldirector") atldirectorobject.createtool("3270", 1, true, true, 0, atl3270tool, errmsg) 'atl3270tool working com object @ point = success  //non-working c# code object atl3270tool = null; string errmsg = null; object atldirectorobject = activator.createinstance(type.gettypefromprogid("atldirectorobject.atldirector")); //atldirectorobject com object //attempt reference atl3270tool inside object array object[] p = { "3270", 1, true, true, 0, atl3270tool, errmsg }; microsoft.visualbasic.compilerservices.newlatebinding.latecall(atldirectorobject, null, "createtool", p, null, null, null, false); //>>>>>>>>atl3270tool still null @ point<<<<<<<<< 

hans correct. best in vb.net. determined do in c#, here's solution

    object atl3270tool = null, errmsg = null;     object atldirectorobject = activator.createinstance(type.gettypefromprogid("atldirectorobject.atldirector"));     object[] p = { "3270", 1, true, true, 0, atl3270tool, errmsg };     object[] p2 = { "xxxx", "", "xxxxxxxxxx", errmsg };     boolean[] cb = new boolean[7];     cb[5] = true; //set array index of atl3270tool true     microsoft.visualbasic.compilerservices.newlatebinding.latecall(atldirectorobject, atldirectorobject.gettype(), "createtool", p, null, null, cb, false);     atl3270tool = p[5];     microsoft.visualbasic.compilerservices.newlatebinding.latecall(atl3270tool, atl3270tool.gettype(), "showscreen", p2, null, null, null, false); // add code release com objects 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -