home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
myshel.exe
/
MYSHELL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-08
|
4KB
|
120 lines
/*
This program is provided as is and carries no warranty
whatsoever. Novell disclaims and excludes any and all implied
warranties of merchantability, title and fitness for a particular
purpose. Novell does not warrant that the software will satisfy
your requirements or that the software is without defect or error
or that operation of the software will be uninterrupted. You are
using the software at your risk. The software is not a product
of Novell, Inc. or any of subsidiaries.
*/
#define NWWIN 1
#include <windows.h>
#include <stdio.h>
#include <nwcalls.h>
NWCCODE NWAPI (*MyNWCallsInit)(void NWPTR in, void NWPTR out);
NWCCODE NWAPI (*MyNWGetDefaultConnectionID)(NWCONN_HANDLE *);
NWCCODE NWAPI (*MyNWGetFileServerDateAndTime)(NWCONN_HANDLE, BYTE *);
long FAR PASCAL WndProc (HWND hwnd, WORD message, WORD wParam, LONG lParam)
{
static HANDLE hInstance;
NWCCODE ccode;
NWCONN_HANDLE conn;
BYTE dateTimeBuf[7];
char string[256];
switch (message)
{
case WM_CREATE:
ccode = MyNWCallsInit(NULL, NULL);
sprintf(string, "NWCallsInit returned: %x",ccode);
MessageBox(hwnd, (LPSTR)string, (LPSTR)"", MB_ICONINFORMATION);
ccode = MyNWGetDefaultConnectionID(&conn);
sprintf(string, "NWGetDefaultConnectionID returned: %x",ccode);
MessageBox(hwnd, (LPSTR)string, (LPSTR)"", MB_ICONINFORMATION);
ccode = MyNWGetFileServerDateAndTime(conn, dateTimeBuf);
sprintf(string, "NWGetFileServerDateAndTime returned: %x",ccode);
MessageBox(hwnd, (LPSTR)string, (LPSTR)"", MB_ICONINFORMATION);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
static char szAppName[] = "MyShell";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
HINSTANCE hinstNetware, hinstNWCalls;
if (hPrevInstance)
return 1;
hinstNetware = LoadLibrary("Netware.drv");
if (hinstNetware < HINSTANCE_ERROR)
return 0; /* ERRROR Handle */
hinstNWCalls = LoadLibrary("NWCalls.dll");
if (hinstNetware < HINSTANCE_ERROR)
return 0; /* ERRROR Handle */
(FARPROC)MyNWCallsInit = GetProcAddress(hinstNWCalls, "NWCallsInit");
if (MyNWCallsInit == NULL)
return 0; /* ERRROR Handle */
(FARPROC)MyNWGetDefaultConnectionID = GetProcAddress(hinstNWCalls,
"NWGetDefaultConnectionID");
if (MyNWGetDefaultConnectionID == NULL)
return 0; /* ERRROR Handle */
(FARPROC)MyNWGetFileServerDateAndTime = GetProcAddress(hinstNWCalls,
"NWGetFileServerDateAndTime");
if (MyNWGetFileServerDateAndTime == NULL)
return 0; /* ERRROR Handle */
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(GRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
RegisterClass (&wndclass);
hwnd = CreateWindow(szAppName, "Test Dynamic Loading of NetWare DLLs",
WS_OVERLAPPEDWINDOW, 0, 0,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL,
hInstance, NULL);
ShowWindow (hwnd, nCmdShow);
UpdateWindow (hwnd);
while ( GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
FreeLibrary (hinstNetware);
FreeLibrary (hinstNWCalls);
return msg.wParam;
}