home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
snapx2.exe
/
SPMENU.EXE
/
SNAPMENU.C
next >
Wrap
C/C++ Source or Header
|
1995-02-03
|
8KB
|
173 lines
/*-------------------------------------------------------------------------*/
/* snapmenu.c */
/* */
/* (c) Copyright 1992-1995 Novell, Inc. All rights reserved. */
/* */
/* The following source code is provided to aid in the development of */
/* NetWare (TM) compatible products and is provided "AS IS" AND WITHOUT */
/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION ANY */
/* IMPLIED WARRANTIES OF MERCHANTABILITY, TITLE AND FITNESS FOR A */
/* PARTICULAR PURPOSE. Some states do not allow limitations on how long */
/* an implied warranty lasts, so the above limitation may not apply to */
/* You. This warranty gives you specific legal rights which vary from */
/* state to state. Some states do not allow the exclusion or limitation */
/* of incidental or consequential damages, so the above limitation or */
/* exclusion may not apply to You. */
/* */
/*-------------------------------------------------------------------------*/
#include <windows.h>
#include <toolhelp.h>
#include <string.h>
#include <stdio.h>
#include <nwsnapin.h>
/*------------------------------------------------------------------------*/
/* Function Prototypes */
/*------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
N_EXTERN_LIBRARY (void)
PlainMenuAction (void);
N_EXTERN_LIBRARY (void)
PlainMenuValid (pnuint16 pFlags);
N_EXTERN_LIBRARY (void)
ChildMenuAction (void);
N_EXTERN_LIBRARY (void)
ChildMenuValid (pnuint16 pFlags);
#ifdef __cplusplus
}
#endif
HINSTANCE hDLL;
/*-------------------------------------------------------------------------*/
/* DLL Entry Point */
/*-------------------------------------------------------------------------*/
int FAR PASCAL LibMain (HINSTANCE hInstance, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpCmdLine)
{
hDLL = hInstance;
if (cbHeapSize != 0)
UnlockData (0);
return 1;
};
/*-------------------------------------------------------------------------*/
/* Function : InitSnapin (void) */
/* Description : */
/* Every Snapin DLL must provide this function. In this function, */
/* snapin menu items (under Tools) are registered. Also, object procs */
/* are registered. */
/* */
/*-------------------------------------------------------------------------*/
int _export FAR PASCAL InitSnapin ()
{
nuint16 menuIDPlain = 0;
nuint16 menuIDHierarchical = 0;
nuint16 menuIDChild = 0;
/*----------------------------------------------------------*/
/* Registering Menu Item */
/*----------------------------------------------------------*/
NWARegisterMenu (NWA_VIEW_CONSOLE, /* # */
0, /* # # */
NULL, /* # # */
MF_STRING, /* ##### */
&menuIDPlain, /* # # */
"P&lain Menu",
"This is a plain menu",
PlainMenuAction, PlainMenuValid,
NWA_SNAPIN_VERSION);
NWARegisterMenu (NWA_VIEW_CONSOLE,
0,
NULL,
MF_STRING | MF_POPUP,
&menuIDHierarchical,
"&Hierarchical Menu",
"This is a hierarchical menu",
NULL, NULL,
NWA_SNAPIN_VERSION);
NWARegisterMenu (NWA_VIEW_CONSOLE,
menuIDHierarchical,
"List Objects",
MF_STRING,
&menuIDChild,
"Child Menu",
"This is a child of the hierarchical menu",
ChildMenuAction, ChildMenuValid,
NWA_SNAPIN_VERSION);
return NWA_RET_SUCCESS;
}
/*-------------------------------------------------------------------------*/
/* Function : ShutDown (void) */
/* Description : */
/*-------------------------------------------------------------------------*/
void FAR PASCAL ShutDown (void)
{
}
/*-------------------------------------------------------------------------*/
/* Function : PlainMenuAction (void) */
/* Description : */
/* Menu Action Callback Proc for PlainMenu Menu */
/*-------------------------------------------------------------------------*/
N_GLOBAL_LIBRARY (void) _export
PlainMenuAction (void)
{
// MessageBox (NULL, "Plain Menu selected.", "Menu Action", MB_OK);
// WinExec("COMMAND /C \"NLISTBAT SERVER PM402A\"", SW_SHOW);
// WinExec("NLISTBAT.BAT SERVER PM402As", SW_SHOW);
WinExec("SOL.EXE", SW_SHOW);
}
/*-------------------------------------------------------------------------*/
/* Function : PlainMenuValid (void) */
/* Description : */
/* Menu Valid Callback Proc for PlainMenu Menu */
/*-------------------------------------------------------------------------*/
N_GLOBAL_LIBRARY (void) _export
PlainMenuValid (pnuint16 pFlags)
{
*pFlags = MF_ENABLED;
}
/*-------------------------------------------------------------------------*/
/* Function : ChildMenuValid (void) */
/* Description : */
/* Menu Valid Callback Proc for Child Menu */
/*-------------------------------------------------------------------------*/
N_GLOBAL_LIBRARY (void) _export /* #### */
ChildMenuValid (pnuint16 pFlags) /* # # */
{ /* #### */
*pFlags = MF_ENABLED; /* # # */
} /* #### */
/*-------------------------------------------------------------------------*/
/* Function : ChildMenuAction (void) */
/* Description : */
/* Menu Action Callback Proc for Child Menu */
/*-------------------------------------------------------------------------*/
N_GLOBAL_LIBRARY (void) _export /* #### */
ChildMenuAction /* # */
( /* # */
void /* # */
) /* #### */
{
MessageBox (NULL, "Child of Hierarchical Menu selected.", "Menu Action",
MB_OK);
}