/*
#include <string>
#include <iostream>
//#include <thread>
#include <Windows.h>
#include <iomanip>
#include <Mgmtapi.h>
#include <SDKDDKVer.h>
#include <stdio.h>
#include <tchar.h>
#include <sstream>
#include <fstream>
#include <Winbase.h>
#include <WinSnmp.h>
//#include <Snmp.h>
*/
#include <SDKDDKVer.h>
#include <Mgmtapi.h>
#include <Windows.h>
#include <Winbase.h>
#include <iostream>
#include <WinSnmp.h>
#include <stdio.h>
#pragma comment(lib, "Snmpapi.lib")
#pragma comment(lib, "Mgmtapi.lib")
//using namespace System;
//using namespace System::ComponentModel;
//using namespace System::Collections;
//using namespace System::Windows::Forms;
//using namespace System::Data;
//using namespace System::Drawing;
//using namespace msclr::interop;
//using namespace System::Runtime::InteropServices;
//using namespace std;
using namespace std;
int main()
{
cout << "YAHOO!!! \n";
HSNMP_ENTITY entity;
SNMPAPI_STATUS status;
SNMPAPI_CALLBACK callBack;
UINT msgNum=1;
UINT port = 80;
HWND window;
const int MY_BUFSIZE=1024;
char oldWindowTitle[MY_BUFSIZE];
smiUINT32 majorVers;
smiUINT32 minorVers;
smiUINT32 nLevel;
smiUINT32 translateMode;
smiUINT32 retranslateMode;
SnmpStartup ( &majorVers, &minorVers, &nLevel, &translateMode, &retranslateMode );
printf( "Major Version: %i \n"
"Minor Version: %i \n"
"nLevel: %i \n"
"Translate Mode: %i \n"
"Retranslate Mode: %i \n\n",
(majorVers, minorVers, nLevel, translateMode, retranslateMode));
GetConsoleTitle((LPWSTR)oldWindowTitle, MY_BUFSIZE);
window = FindWindow(NULL, (LPCWSTR)oldWindowTitle);
SnmpCreateSession(window,msgNum,callBack,NULL);
printf("Create session returns: %i \n\n", SnmpCreateSession(window,msgNum,callBack,NULL));
printf( "Window: %i\n"
"msg num: %i\n"
"Call Back num: %i\n\n",
(window,msgNum,callBack));
SnmpOpen(window, msgNum);
printf("Open session returns: %i\n\n", SnmpOpen(window, msgNum));
SnmpSetPort(entity,port);
printf( "Entity: %i\n"
"Port: %i\n\n",
(entity,port));
SnmpListen(entity,status);
printf( "Entity: %i\n"
"Status: %i\n\n",
(entity,status));
//SnmpCleanup();
cout <<")o<o( \n";
return 0;
}
|