NetView plug-ins


General principles of the creation of plug-ins and their interaction with NetView


Any processes in system can interact with NetView of the versions 2.80 and higher by using of function exported by nvapi.dll which is copied in system folder SYSTEM or SYSTEM32 during installation of NetView. Descriptions of these functions can be found here.

Dynamically linked libraries .dll loaded by NetView and startup and exporting three functions. Obligatory of them only two:

NVPluginGetInfo - is caused when start NetView. Has a single parameter - a pointer on structure NVPLUGININFO. When calling the functions NetView itself allocates memory for this structure, in the same way installs the field nvver equal its version. Plug-in can return from function 0 and he will not be able for using (for example if installed version of NetView does not support some necessary functions), or - 1 then plugin will be available for using. Plug-in in the same way must specify in field retver its version and copy in plname and retstr strings with max length in 63 and 127 symbols maximum, plname is the plug-in's name, retstr - a short dexription. The Rest fields when call of this functions are not initialized and must be not used. The approximite code to this functions:

DWORD WINAPI NVPluginGetInfo(LPNVPLUGININFO nvpi)
{
nvpi->retver.hi=1;nvpi->retver.lo=0;//Версия нашего плагина - 1.0
strcpy(nvpi->plname,"Cool plugin");//Название плагина. 63 символа максимум
strcpy(nvpi->retstr,"Sample NetView plug-in by Killer{R}");
return ((nvpi->nvver.hi>2)||(nvpi->nvver.lo>71));
}

NVPluginGo - this is the main plug-in function, plugin execution starts by calling this function and ends when this function returns (or and exception occured in it). NetView executes this function in different thread. The Parameter of functions - a pointer on structure NVPLUGINGOINFO, detailed description of which you can find in nvplugn.h file. In this structure field nvmainwnd - HANDLE to the main NetView's window. Can be used as parent window for plag-in's windows. nvwnd - HWND of the NetView's window-handler of the plug-ins messages. Plug-in sends messages to it to make any actions. NetView sends messages to the plug-ins thread using PostThreadMessage, plug-in can send the messages to a window nvwnd. For termination of the execution of plug-in NetView sends its WM_QUIT after reception of which plug-in must make all procedures of its deinitialization and terminate self execution by exiting from NVPluginGo. The approximite code of NVPluginGo:

DWORD WINAPI NVPluginGo(LPNVPLUGINGOINFO plgi)
{
init();//some initialization stuff
MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );
workmessage(msg.message,msg.wParam,msg.lParam);//some message-processing stuff
DispatchMessage( &msg );
}
deinit();//some deinitialization stuff
return 0;
}

На верх


© 2001-2004 Killer{R}   © 2003 VoVaN