- Joined
- Feb 26, 2018
- Messages
- 99
- Reaction score
- 10
Hi,
I want to test simply 3cx call control api and i got a windows forms application. I have wrote server host port user passwords info and simply call MakeCall method for test but im getting an error like;
"
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at TCX.Configuration.PhoneSystem.RegisterListener(MyPFN_UPDATE_LISTENER f)
"
// CODES
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var name = new AssemblyName(args.Name).Name;
if (name == "3cxpscomcpp2")
// return Assembly.LoadFrom(Path.Combine(instanceBinPath, name + ".dll"));
return Assembly.LoadFrom("C:\\Program Files\\3CX Phone System\\Instance1\\Bin\\3cxpscomcpp2.dll");
else
throw new FileNotFoundException();
}
private void Form1_Load(object sender, EventArgs e)
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
private void btnAra_Click(object sender, EventArgs e)
{
var a = new Random(Environment.TickCount);
PhoneSystem.ApplicationName = "TestApi";
PhoneSystem.ApplicationName = PhoneSystem.ApplicationName + a.Next().ToString();
PhoneSystem.CfgServerHost = "127.0.0.1";
PhoneSystem.CfgServerPort = 5485;
PhoneSystem.CfgServerUser = "cfguser_default";
PhoneSystem.CfgServerPassword = "o78xdakexc17";
PhoneSystem.Root.MakeCall(txtArayan.Text, txtAranan.Text);
}
I want to test simply 3cx call control api and i got a windows forms application. I have wrote server host port user passwords info and simply call MakeCall method for test but im getting an error like;
"
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at TCX.Configuration.PhoneSystem.RegisterListener(MyPFN_UPDATE_LISTENER f)
"
// CODES
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var name = new AssemblyName(args.Name).Name;
if (name == "3cxpscomcpp2")
// return Assembly.LoadFrom(Path.Combine(instanceBinPath, name + ".dll"));
return Assembly.LoadFrom("C:\\Program Files\\3CX Phone System\\Instance1\\Bin\\3cxpscomcpp2.dll");
else
throw new FileNotFoundException();
}
private void Form1_Load(object sender, EventArgs e)
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
private void btnAra_Click(object sender, EventArgs e)
{
var a = new Random(Environment.TickCount);
PhoneSystem.ApplicationName = "TestApi";
PhoneSystem.ApplicationName = PhoneSystem.ApplicationName + a.Next().ToString();
PhoneSystem.CfgServerHost = "127.0.0.1";
PhoneSystem.CfgServerPort = 5485;
PhoneSystem.CfgServerUser = "cfguser_default";
PhoneSystem.CfgServerPassword = "o78xdakexc17";
PhoneSystem.Root.MakeCall(txtArayan.Text, txtAranan.Text);
}