#pragma once

#ifndef		NZLD_API
#	define	NZLD_API __declspec(dllexport)
#endif

#ifdef __cplusplus
extern "C" {  
#endif

#ifdef _UNICODE

#define NZLD_CMD_OPEN						NZLD_CMD_OPENW
#define NZLD_CMD_ENABLE						NZLD_CMD_ENABLEW
#define NZLD_CMD_CONNECTING					NZLD_CMD_CONNECTINGW
#define NZLD_CMD_OPEN_VIDEO					NZLD_CMD_OPEN_VIDEOW
#define NZLD_CMD_CLOSE_VIDEO				NZLD_CMD_CLOSE_VIDEOW
#define NZLD_CMD_SET_LOGO_IMAGE				NZLD_CMD_SET_LOGO_IMAGEW
#define NZLD_CMD_SET_OSD_TEXT				NZLD_CMD_SET_OSD_TEXTW
#define NZLD_CMD_SET_OSD_SETTING			NZLD_CMD_SET_OSD_SETTINGW
#define NZLD_CMD_SET_WINDOWPOS				NZLD_CMD_SET_WINDOWPOSW
#define NZLD_CMD_ENABLE_SCREEN_PTZ			NZLD_CMD_ENABLE_SCREEN_PTZW
#define NZLD_CMD_SET_CUSTOM_DRAW_HANDLER	NZLD_CMD_SET_CUSTOM_DRAW_HANDLERW

#define NZLD_CMD							NZLD_CMDW

#else

#define NZLD_CMD_OPEN						NZLD_CMD_OPENA
#define NZLD_CMD_ENABLE						NZLD_CMD_ENABLEA
#define NZLD_CMD_CONNECTING					NZLD_CMD_CONNECTINGA
#define NZLD_CMD_OPEN_VIDEO					NZLD_CMD_OPEN_VIDEOA
#define NZLD_CMD_CLOSE_VIDEO				NZLD_CMD_CLOSE_VIDEOA
#define NZLD_CMD_SET_LOGO_IMAGE				NZLD_CMD_SET_LOGO_IMAGEA
#define NZLD_CMD_SET_OSD_TEXT				NZLD_CMD_SET_OSD_TEXTA
#define NZLD_CMD_SET_OSD_SETTING			NZLD_CMD_SET_OSD_SETTINGA
#define NZLD_CMD_SET_WINDOWPOS				NZLD_CMD_SET_WINDOWPOSA
#define NZLD_CMD_ENABLE_SCREEN_PTZ			NZLD_CMD_ENABLE_SCREEN_PTZA
#define NZLD_CMD_SET_CUSTOM_DRAW_HANDLER	NZLD_CMD_SET_CUSTOM_DRAW_HANDLERA

#define NZLD_CMD							NZLD_CMDA
#endif

	typedef struct _NZDC_DEV_INFO
	{
		char addr[128];
		int port;
		char url[128];
		char id[64];
		char pw[64];
		char key[512];

		int reserved1;	// must be 0
		int reserved2;	// must be 0
		int reserved3;	// must be 0
	} NZLD_DEV_INFO;

	typedef enum
	{
		NZLD_CMD_OPENW						= 0x00000001,	// arg1: HWND parent
		NZLD_CMD_ENABLEW					= 0x00000002,	// arg1: TRUE or FALSE
		NZLD_CMD_CONNECTINGW				= 0x00000003,
		NZLD_CMD_OPEN_VIDEOW				= 0x00000004,	// arg1: NZLD_DEV_INFO*
		NZLD_CMD_CLOSE_VIDEOW				= 0x00000005,
		NZLD_CMD_SET_LOGO_IMAGEW			= 0x00000006,	// arg1: CString logo_image_path
		NZLD_CMD_SET_OSD_TEXTW				= 0x00000007,	// arg1: CString osd_text, arg2: int position(0=left/top, 1=right/top, 2=left/bottom, 3=right/bottom)
		NZLD_CMD_SET_OSD_SETTINGW			= 0x00000008,	// arg1: CString fontName, arg2:[int] fontsize, arg3: [COLORREF] fgcolor, arg4: [COLORREF] bgcolor
		NZLD_CMD_SET_WINDOWPOSW				= 0x00000009,	// argument empty.
		NZLD_CMD_ENABLE_SCREEN_PTZW			= 0x0000000a,	// arg1: TRE or FALSE
		NZLD_CMD_SET_CUSTOM_DRAW_HANDLERW	= 0x0000000b,	// arg1 : LPDRAWVIDEO, arg2 : LONG_PTR pUserParam
	}NZLD_CMDW;

	typedef enum
	{
		NZLD_CMD_OPENA						= 0x10000001,	// arg1: HWND parent
		NZLD_CMD_ENABLEA					= 0x10000002,	// arg1: TRUE or FALSE
		NZLD_CMD_CONNECTINGA				= 0x10000003,
		NZLD_CMD_OPEN_VIDEOA				= 0x10000004,	// arg1: NZLD_DEV_INFO*
		NZLD_CMD_CLOSE_VIDEOA				= 0x10000005,
		NZLD_CMD_SET_LOGO_IMAGEA			= 0x10000006,	// arg1: CString logo_image_path
		NZLD_CMD_SET_OSD_TEXTA				= 0x10000007,	// arg1: CString osd_text, arg2: int position(0=left/top, 1=right/top, 2=left/bottom, 3=right/bottom)
		NZLD_CMD_SET_OSD_SETTINGA			= 0x10000008,	// arg1: CString fontName, arg2:[int] fontsize, arg3: [COLORREF] fgcolor, arg4: [COLORREF] bgcolor
		NZLD_CMD_SET_WINDOWPOSA				= 0x10000009,	// argument empty.
		NZLD_CMD_ENABLE_SCREEN_PTZA			= 0x1000000a,	// arg1: TRE or FALSE
		NZLD_CMD_SET_CUSTOM_DRAW_HANDLERA	= 0x1000000b,	// arg1 : LPDRAWVIDEO, arg2 : LONG_PTR pUserParam
	}NZLD_CMDA;

	NZLD_API HANDLE __stdcall NZLD_Create	( );
	NZLD_API BOOL   __stdcall NZLD_Delete	( HANDLE handle );
	NZLD_API BOOL   __stdcall NZLD_Command	( HANDLE handle, NZLD_CMD cmd, DWORD_PTR arg1, DWORD_PTR arg2, DWORD_PTR arg3, DWORD_PTR arg4 );

	// [ReturnValue]
	//	TRUE : Update
	//	FALSE : Not Update
	typedef BOOL (__stdcall *LPDRAWVIDEO)(int nChannel, LPBITMAP pBitmap, LPRECT lpSrcRect, LONG_PTR pUserParam);

#ifdef __cplusplus
}
#endif
