Hello, I'm writing a C# application that has to consume a C++ api provided by my customer. The library works fine when it's referenced by a vb6 application, but when I reference it in my c# application and try to call the same methods, i get a different (wrong) behaviour. The methods I'm calling take a couple of string arguments. Provided that I don't have the library's source code, I can only gess what could be wrong and this leads me to the following tought: Is it possible that the library could have been designed to be called from vb6 only? I mean for example, that it could be expecting the string parameters to be encoded in a certain way different from the one c# uses. If so, is there any workaround for this? So far the best I could do was to create a vb6 wrapper ocx, but it's not any elegant and least of all easy to deploy solution.
Im posting the code which initializes the object:
ApiPrnClass apiprn; // this is the class imported form the com reference
for (int j = 0; j < 10; j++)
{
apiprn = new ApiPrnClass();
apiprn.FMGetModel(_TIPODISPOSITIVO.iDocument);
apiprn.FMPRNFormat(_TIPODISPOSITIVO.iDocument, _TIPOFORMATO.DEL_CONDENSED, "");
apiprn.PRNBeforePrint(_TIPODISPOSITIVO.iDocument, "");
for (int i = 0; i < 10; i++)
{
string linea = "TEST C/ BUFF XXX-----------------------".Replace("XXX", (10 * j + i).ToString().PadLeft(3, '0'));
apiprn.FMPrint(_TIPODISPOSITIVO.iDocument, linea);
}
apiprn.PRNAfterPrint(_TIPODISPOSITIVO.iDocument);
System.Threading.Thread.Sleep(1000);
}
I would appreciate any help, Thanks, Bernabé