home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
gw
/
oddev.exe
/
ODMASAMP.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-03
|
2KB
|
81 lines
/* odmasamp.cpp - Entry point, initialization, cleanup, etc. for ODMA
sample DMS.
*
* COPYRIGHT (C) 1994
* SoftSolutions Technology Corporation
* Orem, Utah USA
* All Rights Reserved
*/
#include <windows.h>
#include <memory.h>
#include <compobj.h>
#include <initguid.h>
#include "odmacom.h"
#include "odmasamp.h"
#include <coguid.h>
// Globals
HINSTANCE NEAR hInst;
DocumentList NEAR DocList;
#ifdef WIN32
BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpvReserved)
{
hInst = hinstDLL;
return 1;
}
#else
int PASCAL LibMain( HINSTANCE hInstance, WORD wDataSeg, WORD cbHeapSize,
LPSTR lpCmdLine )
{
/* Avoid compiler warnings about unused parameters. */
wDataSeg = wDataSeg;
cbHeapSize = cbHeapSize;
lpCmdLine = lpCmdLine;
hInst = hInstance;
/* Undo the lock on the data segment that was automatically
placed by the call to LocalInit() in the startup code. */
if (cbHeapSize)
UnlockData(0);
return 1;
}
#endif
/* ODMGetODMInterface - This is the main entry point for the ODMA connection
manager. */
HRESULT FAR PASCAL _export ODMGetODMInterface( REFIID riid, LPVOID FAR *ppvObj,
LPUNKNOWN pUnkOuter, LPVOID pReserved, LPSTR lpszAppId, DWORD dwEnvData )
{
Application *pApp;
HRESULT hRes;
*ppvObj = NULL; // Ensure NULL stored here in case of error return.
// Create a new Application object.
pApp = new Application( pUnkOuter, dwEnvData );
if (pApp == NULL) {
MessageBox( (HWND)dwEnvData, "Memory allocation failure", DMSNAME, MB_OK );
return ResultFromScode( E_OUTOFMEMORY );
}
// Get the requested interface on the application object.
hRes = pApp->GetInterface( riid, ppvObj );
if (*ppvObj)
((LPUNKNOWN)(*ppvObj))->Release(); // Balances the ref. count from 'new'.
else
delete pApp;
return hRes;
}