Search All Forums
Dart Home | PowerSNMP for ActiveX | Custom Development Reply | PowerSNMP for ActiveX Topics | Forums   
AuthorForum: PowerSNMP for ActiveX
Topic: need help with VB6 -> C++ conversion

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 = ""
  Dim strAlarmID As String
  Dim KeepAliveInterval as Int
  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

objAgent.TrapManagers.Add SnmpServerIP
<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 = "";
String desc = "Crossing Alarm Server";
String alarmID = "sigOStHb-CAS001";
int kaVal = 150;


// 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;


// 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->Add(""); // no good

<snip C++>

any help would be much appreciated!


K M Drake

From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted October 29, 2010 10:31 AM

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("", 0);
The second parameter, while optional in VB6, may not be optional in BCB.

Hope it helps,
Reply | PowerSNMP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX