Dart Home | PowerSNMP for ActiveX | Custom Development | Reply | PowerSNMP for ActiveX Topics | Forums |
Author | Forum: PowerSNMP for ActiveX Topic: need help with VB6 -> C++ conversion |
mknoblock From: crossville, TN USA Posts: 1 Member Since: 10/21/10 |
posted October 21, 2010 12:45 PM Currently using a VB6 application to send simple, MIBless traps: <snip VB> Dim strEID As String strEID = "1.3.6.1.4.1.21925.3" Dim strAlarmID As String Dim KeepAliveInterval as Int objAgent.Message.Reset objAgent.Message.Type = snmpTrap1 'Add varbinds AddVariable objAgent.Message.Variables, strEID + ".1", snmpOctetString, strAlarmID AddVariable objAgent.Message.Variables, strEID + ".4", snmpInteger, ((KeepAliveInterval * 60) * 2) + 30 'send objAgent.TrapManagers.Clear objAgent.TrapManagers.Add SnmpServerIP objAgent.Send <snip VB> This code has worked fine for years; now porting this to Borland C++Builder 2010 is giving me problems: <snip C++> TAgent *Agent; String EID = "1.3.6.1.4.1.21925.3"; String desc = "Crossing Alarm Server"; String alarmID = "sigOStHb-CAS001"; int kaVal = 150; Agent1->Message->Reset(); // this line errors because I don't know where the header file is: Agent1->Message->Type = snmpTrap1; // have to use this instead: Agent1->Message->Type = 36; Agent1->Message->GenericTrap=6; Agent1->Message->SpecificTrap=1; Agent1->Message->Enterprise=EID.c_str(); // here's a problem: can't add varbinds: Agent1->Message->Variables->Add( String(EID+".1").c_str(),2,alarmID); // and another: how to specify IP address of host: Agent1->TrapManagers->Clear(); Agent1->TrapManagers->Add("12.12.12.45"); // no good <snip C++> any help would be much appreciated! Mike |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 29, 2010 10:31 AM Hi, Unfortunately, we do not have experience with C++ Builder, but perhaps the following will help: 1. You need to add a Variable object to Agent1->Message->Variables. I think you may be confusing the AddVariable function in the VB6 code with the direct Variables.Add call. If you look at the original VB6 code, you should see that in this function, a new Variable is created and added to the Variables collection passed in. 2. For TrapManagers->Add, try adding a second parameter with a value of 0: Agent1->TrapManagers->Add("12.12.12.45", 0); The second parameter, while optional in VB6, may not be optional in BCB. Hope it helps, -ken |
Reply | PowerSNMP for ActiveX Topics | Forums |
This site is powered by
![]() |