NETWATCH.H

/* 
* netwatch.h
*
* Purpose:
* main header file
*
* Owner:
* MikeSart
*/

// max size of strings in STRINGTABLE for LoadString
#define cchSzMax64
#define cchTVSzMax512
#define cchMsgMax512
#define cchErrMax1024

#define TIMERID1

#define SCONSTstatic const

// Treeview types
#define TYPE_ERROR((DWORD)-1)
#define TYPE_COMPUTER0x0
#define TYPE_SHARE0x1
#define TYPE_USER0x2
#define TYPE_FILE0x3
#define TYPE_MAX0x4

// Bitmap Indexes
#define BMP_SHARE0
#define BMP_COMPUTER1
#define BMP_FILE2
#define BMP_WRITE3
#define BMP_READ4
#define BMP_DENIED5
#define BMP_BOB6
#define BMP_USER7
#define BMP_IPC8
#define BMP_COMPUTERLIMITED9

#define BMWIDTH16
#define BMHEIGHT16
#define RGBREPLACE0x00FF0000 // solid blue

#define GlobalFreeNullPtr(_ptr) \
if(_ptr) GlobalFreePtr(_ptr)

/*
* globules
*/
extern HINSTANCEghInst;
extern HMENUghMenu;
extern TCHARszAppName[];
extern DWORDdwTimerInterval;
extern TCHARszNil[];
extern UINTunMenuFlags[];

/*
* function prototypes
*/

// netwatch.c
LRESULT CALLBACKNewTVProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACKWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACKSelectDlgProc(HWND, UINT, WPARAM, LPARAM);
VOID _cdeclPropertyDlg(HWND hwnd, UINT rgIDSStart, DWORD dwrgBmp, ...);

// utils.c
HWNDInitNetWatchWnd(HWND hwnd);
VOIDDeInitNetWatchWnd(VOID);
VOIDBlitIcon(HDC hdc, LONG x, LONG y, int nBitmap);
HTREEITEMhAddComputer(HWND hwnd, HWND hwndTV, LPTSTR szComputerName,
HTREEITEM hItemLocation);
BOOLFTreeView_GetString(HWND hwndTV, HTREEITEM hItem,
TCHAR *szText, UINT cchTextMax);
VOIDShowTitle(HWND hwnd, int nCmdShow);
VOIDPunchTimer(HWND hwndMain, BOOL fNewState);
VOIDRestoreWindowPosition(HWND hwnd, HWND hwndTV);
VOIDSaveWindowPosition(HWND hwnd, HWND hwndTV);
TCHAR*szFromIDS1(UINT unID);
TCHAR*GetSystemErrMessage(DWORD dwError);

// net.c
VOIDTreeView_FreeItemData(TV_ITEM *ptvItem);
UINTRefreshDisplay(HWND hwnd, HWND hwndTV);
BOOLHandleWM_VKEY(HWND hwnd, HWND hwndTV, WORD wAction);
VOIDAddErrorStringToTV(HWND hwndTV, HTREEITEM hParent, UINT ids,
NET_API_STATUS nas);
VOIDHandleMenu(HWND hwnd, HWND hwndTV, HMENU hMenu);

/*
*DEBUG stuff
*/

#ifdef DEBUG

VOID _cdecl DbgPrint(LPCSTR lpFmt, ...);
UINT AssertSzFn(LPSTR szMsg, LPSTR szFile, INT nLine);
#define OutputDbgStrDbgPrint
#define OutputDbgStrError(_szFunction, _sc) \
if(_sc) \
DbgPrint("%s returns sc=0x%08lx", _szFunction, _sc)
#define ASSERTDATAstatic CHAR _szFile[] = __FILE__;
#define AssertSz(a,b)((VOID)((a) || (AssertSzFn(b, _szFile, __LINE__))))
#define Assert(a)((VOID)((a) || (AssertSzFn(NULL, _szFile, __LINE__))))
#define SideAssert(a)((VOID)((a) || (AssertSzFn(NULL, _szFile, __LINE__))))

#else

VOID _cdecl IDbgPrint(LPCSTR lpFmt, ...);
#define OutputDbgStr1 ? (VOID)0 : IDbgPrint
#define OutputDbgStrError1 ? (VOID)0 : IDbgPrint
#define ASSERTDATA
#define AssertSz(a,b)
#define Assert(a)
#define SideAssert(a)(a)

#endif