ifndef __LIBC_INC
 include libc.inc
endif
ifndef _INC_DDEMLH
define _INC_DDEMLH

HCONVLIST		typedef HANDLE
HCONV			typedef HANDLE
HSZ			typedef HANDLE
HDDEDATA		typedef HANDLE
EXPENTRY		equ <CALLBACK>

HSZPAIR			STRUC
hszSvc			HSZ ?
hszTopic		HSZ ?
HSZPAIR			ENDS
PHSZPAIR		typedef ptr HSZPAIR

CONVCONTEXT		STRUC
cb			UINT ?
wFlags			UINT ?
wCountryID		UINT ?
iCodePage		SINT ?
dwLangID		dd ?
dwSecurity		dd ?
qos			SECURITY_QUALITY_OF_SERVICE <>
CONVCONTEXT		ENDS
PCONVCONTEXT		typedef ptr CONVCONTEXT

CONVINFO		STRUC
cb			dd ?
hUser			dd ?
hConvPartner		HCONV ?
hszSvcPartner		HSZ ?
hszServiceReq		HSZ ?
hszTopic		HSZ ?
hszItem			HSZ ?
wFmt			UINT ?
wType			UINT ?
wStatus			UINT ?
wConvst			UINT ?
wLastError		UINT ?
hConvList		HCONVLIST ?
ConvCtxt		CONVCONTEXT <>
hwnd			HWND ?
hwndPartner		HWND ?
CONVINFO		ENDS
PCONVINFO		typedef ptr CONVINFO

XST_NULL		equ 0
XST_INCOMPLETE		equ 1
XST_CONNECTED		equ 2
XST_INIT1		equ 3
XST_INIT2		equ 4
XST_REQSENT		equ 5
XST_DATARCVD		equ 6
XST_POKESENT		equ 7
XST_POKEACKRCVD		equ 8
XST_EXECSENT		equ 9
XST_EXECACKRCVD		equ 10
XST_ADVSENT		equ 11
XST_UNADVSENT		equ 12
XST_ADVACKRCVD		equ 13
XST_UNADVACKRCVD	equ 14
XST_ADVDATASENT		equ 15
XST_ADVDATAACKRCVD	equ 16

CADV_LATEACK		equ 0xFFFF

ST_CONNECTED		equ 0x0001
ST_ADVISE		equ 0x0002
ST_ISLOCAL		equ 0x0004
ST_BLOCKED		equ 0x0008
ST_CLIENT		equ 0x0010
ST_TERMINATED		equ 0x0020
ST_INLIST		equ 0x0040
ST_BLOCKNEXT		equ 0x0080
ST_ISSELF		equ 0x0100

DDE_FACK		equ 0x8000
DDE_FBUSY		equ 0x4000
DDE_FDEFERUPD		equ 0x4000
DDE_FACKREQ		equ 0x8000
DDE_FRELEASE		equ 0x2000
DDE_FREQUESTED		equ 0x1000
DDE_FAPPSTATUS		equ 0x00ff
DDE_FNOTPROCESSED	equ 0x0000

DDE_FACKRESERVED	equ ( NOT (DDE_FACK OR DDE_FBUSY OR DDE_FAPPSTATUS))
DDE_FADVRESERVED	equ ( NOT (DDE_FACKREQ OR DDE_FDEFERUPD))
DDE_FDATRESERVED	equ ( NOT (DDE_FACKREQ OR DDE_FREEASE OR DDE_FREQUESTED))
DDE_FPOKRESERVED	equ ( NOT (DDE_FREEASE))

MSGF_DDEMGR		equ 0x8001

CP_WINANSI		equ 1004
CP_WINUNICODE		equ 1200
ifdef _UNICODE
CP_WINNEUTRAL		equ CP_WINUNICODE
else
CP_WINNEUTRAL		equ CP_WINANSI
endif

XTYPF_NOBLOCK		equ 0x0002
XTYPF_NODATA		equ 0x0004
XTYPF_ACKREQ		equ 0x0008

XCLASS_MASK		equ 0xFC00
XCLASS_BOOL		equ 0x1000
XCLASS_DATA		equ 0x2000
XCLASS_FLAGS		equ 0x4000
XCLASS_NOTIFICATION	equ 0x8000

XTYP_ERROR		equ (0x0000 OR XCLASS_NOTIFICATION OR XTYPF_NOBOCK )
XTYP_ADVDATA		equ (0x0010 OR XCLASS_FAGS	   )
XTYP_ADVREQ		equ (0x0020 OR XCLASS_DATA OR XTYPF_NOBOCK )
XTYP_ADVSTART		equ (0x0030 OR XCLASS_BOOL	    )
XTYP_ADVSTOP		equ (0x0040 OR XCASS_NOTIFICATION)
XTYP_EXECUTE		equ (0x0050 OR XCLASS_FAGS	   )
XTYP_CONNECT		equ (0x0060 OR XCLASS_BOOL OR XTYPF_NOBOCK)
XTYP_CONNECT_CONFIRM	equ (0x0070 OR XCLASS_NOTIFICATION OR XTYPF_NOBOCK)
XTYP_XACT_COMPLETE	equ (0x0080 OR XCASS_NOTIFICATION  )
XTYP_POKE		equ (0x0090 OR XCLASS_FAGS	   )
XTYP_REGISTER		equ (0x00A0 OR XCLASS_NOTIFICATION OR XTYPF_NOBOCK)
XTYP_REQUEST		equ (0x00B0 OR XCASS_DATA	   )
XTYP_DISCONNECT		equ (0x00C0 OR XCLASS_NOTIFICATION OR XTYPF_NOBOCK)
XTYP_UNREGISTER		equ (0x00D0 OR XCLASS_NOTIFICATION OR XTYPF_NOBOCK)
XTYP_WILDCONNECT	equ (0x00E0 OR XCLASS_DATA OR XTYPF_NOBOCK)

XTYP_MASK		equ 0x00F0
XTYP_SHIFT		equ 4

TIMEOUT_ASYNC		equ 0xFFFFFFFF

QID_SYNC		equ 0xFFFFFFFF

if 0;_UNICODE
SZDDESYS_TOPIC		equ <L"System">
SZDDESYS_ITEM_TOPICS	equ <L"Topics">
SZDDESYS_ITEM_SYSITEMS	equ <L"SysItems">
SZDDESYS_ITEM_RTNMSG	equ <L"ReturnMessage">
SZDDESYS_ITEM_STATUS	equ <L"Status">
SZDDESYS_ITEM_FORMATS	equ <L"Formats">
SZDDESYS_ITEM_HELP	equ <L"Help">
SZDDE_ITEM_ITEMLIST	equ <L"TopicItemList">
else
SZDDESYS_TOPIC		equ <"System">
SZDDESYS_ITEM_TOPICS	equ <"Topics">
SZDDESYS_ITEM_SYSITEMS	equ <"SysItems">
SZDDESYS_ITEM_RTNMSG	equ <"ReturnMessage">
SZDDESYS_ITEM_STATUS	equ <"Status">
SZDDESYS_ITEM_FORMATS	equ <"Formats">
SZDDESYS_ITEM_HELP	equ <"Help">
SZDDE_ITEM_ITEMLIST	equ <"TopicItemList">
endif

;HDDEDATA
;CALLBACK
CALLBACK(FNCALLBACK, :UINT, :UINT, :HCONV, :HSZ, :HSZ, :HDDEDATA, :DWORD, :DWORD)
CALLBACK(PFNCALLBACK, :UINT, :UINT, :HCONV, :HSZ, :HSZ, :HDDEDATA, :DWORD, :DWORD)

CBR_BLOCK		equ 0xffffffff

DdeInitializeA proto WINAPI :LPDWORD, :PFNCALLBACK, :DWORD, :DWORD
DdeInitializeW proto WINAPI :LPDWORD, :PFNCALLBACK, :DWORD, :DWORD
ifdef _UNICODE
DdeInitialize		equ <DdeInitializeW>
else
DdeInitialize		equ <DdeInitializeA>
endif

CBF_FAIL_SELFCONNECTIONS equ 0x00001000
CBF_FAIL_CONNECTIONS	equ 0x00002000
CBF_FAIL_ADVISES	equ 0x00004000
CBF_FAIL_EXECUTES	equ 0x00008000
CBF_FAIL_POKES		equ 0x00010000
CBF_FAIL_REQUESTS	equ 0x00020000
CBF_FAIL_ALLSVRXACTIONS equ 0x0003f000

CBF_SKIP_CONNECT_CONFIRMS equ 0x00040000
CBF_SKIP_REGISTRATIONS	  equ 0x00080000
CBF_SKIP_UNREGISTRATIONS  equ 0x00100000
CBF_SKIP_DISCONNECTS	  equ 0x00200000
CBF_SKIP_ALLNOTIFICATIONS equ 0x003c0000

APPCMD_CLIENTONLY	equ 0x00000010
APPCMD_FILTERINITS	equ 0x00000020
APPCMD_MASK		equ 0x00000FF0

APPCLASS_STANDARD	equ 0x00000000
APPCLASS_MASK		equ 0x0000000F

DdeUninitialize proto WINAPI :DWORD
DdeConnectList proto WINAPI :DWORD, :HSZ, :HSZ, :HCONVLIST, :PCONVCONTEXT
DdeQueryNextServer proto WINAPI :HCONVLIST, :HCONV
DdeDisconnectList proto WINAPI :HCONVLIST
DdeConnect proto WINAPI :DWORD, :HSZ, :HSZ, :PCONVCONTEXT
DdeDisconnect proto WINAPI :HCONV
DdeReconnect proto WINAPI :HCONV
DdeQueryConvInfo proto WINAPI :HCONV, :DWORD, :PCONVINFO
DdeSetUserHandle proto WINAPI :HCONV, :DWORD, :DWORD
DdeAbandonTransaction proto WINAPI :DWORD, :HCONV, :DWORD
DdePostAdvise proto WINAPI :DWORD, :HSZ, :HSZ
DdeEnableCallback proto WINAPI :DWORD, :HCONV, :UINT
DdeImpersonateClient proto WINAPI :HCONV

EC_ENABLEALL		equ 0
EC_ENABLEONE		equ ST_BOCKNEXT
EC_DISABLE		equ ST_BOCKED
EC_QUERYWAITING		equ 2

DdeNameService proto WINAPI :DWORD, :HSZ, :HSZ, :UINT

DNS_REGISTER		equ 0x0001
DNS_UNREGISTER		equ 0x0002
DNS_FILTERON		equ 0x0004
DNS_FILTEROFF		equ 0x0008

DdeClientTransaction proto WINAPI :LPBYTE, :DWORD, :HCONV, :HSZ, :UINT, :UINT, :DWORD, :LPDWORD
DdeCreateDataHandle proto WINAPI :DWORD, :LPBYTE, :DWORD, :DWORD, :HSZ, :UINT, :UINT
DdeAddData proto WINAPI :HDDEDATA, :LPBYTE, :DWORD, :DWORD
DdeGetData proto WINAPI :HDDEDATA, :LPBYTE, :DWORD, :DWORD
DdeAccessData proto WINAPI :HDDEDATA, :LPDWORD
DdeUnaccessData proto WINAPI :HDDEDATA
DdeFreeDataHandle proto WINAPI :HDDEDATA

HDATA_APPOWNED		equ 0x0001

DdeGetLastError proto WINAPI :DWORD

DMLERR_NO_ERROR		equ 0
DMLERR_FIRST		equ 0x4000
DMLERR_ADVACKTIMEOUT	equ 0x4000
DMLERR_BUSY		equ 0x4001
DMLERR_DATAACKTIMEOUT	equ 0x4002
DMLERR_DLL_NOT_INITIALIZED equ 0x4003
DMLERR_DLL_USAGE	equ 0x4004
DMLERR_EXECACKTIMEOUT	equ 0x4005
DMLERR_INVALIDPARAMETER equ 0x4006
DMLERR_LOW_MEMORY	equ 0x4007
DMLERR_MEMORY_ERROR	equ 0x4008
DMLERR_NOTPROCESSED	equ 0x4009
DMLERR_NO_CONV_ESTABLISHED equ 0x400a
DMLERR_POKEACKTIMEOUT	equ 0x400b
DMLERR_POSTMSG_FAILED	equ 0x400c
DMLERR_REENTRANCY	equ 0x400d
DMLERR_SERVER_DIED	equ 0x400e
DMLERR_SYS_ERROR	equ 0x400f
DMLERR_UNADVACKTIMEOUT	equ 0x4010
DMLERR_UNFOUND_QUEUE_ID equ 0x4011
DMLERR_LAST		equ 0x4011

DdeCreateStringHandleA proto WINAPI :DWORD, :LPCSTR, :SINT
DdeCreateStringHandleW proto WINAPI :DWORD, :LPCWSTR, :SINT
ifdef _UNICODE
DdeCreateStringHandle	equ <DdeCreateStringHandleW>
else
DdeCreateStringHandle	equ <DdeCreateStringHandleA>
endif
DdeQueryStringA proto WINAPI :DWORD, :HSZ, :LPSTR, :DWORD, :SINT
DdeQueryStringW proto WINAPI :DWORD, :HSZ, :LPWSTR, :DWORD, :SINT
ifdef _UNICODE
DdeQueryString		equ <DdeQueryStringW>
else
DdeQueryString		equ <DdeQueryStringA>
endif
DdeFreeStringHandle proto WINAPI :DWORD, :HSZ
DdeKeepStringHandle proto WINAPI :DWORD, :HSZ
DdeCmpStringHandles proto WINAPI :HSZ, :HSZ

ifndef NODDEMLSPY

DDEML_MSG_HOOK_DATA	STRUC
uiLo			UINT ?
uiHi			UINT ?
cbData			dd ?
Data			dd 8 dup(?)
DDEML_MSG_HOOK_DATA	ENDS
PDDEML_MSG_HOOK_DATA	typedef ptr DDEML_MSG_HOOK_DATA

MONMSGSTRUCT		STRUC
cb			UINT ?
hwndTo			HWND ?
dwTime			dd ?
hTask			HANDLE ?
wMsg			UINT ?
wParam			WPARAM ?
lParam			LPARAM ?
dmhd			DDEML_MSG_HOOK_DATA <>
MONMSGSTRUCT		ENDS
PMONMSGSTRUCT		typedef ptr MONMSGSTRUCT

MONCBSTRUCT		STRUC
cb			UINT ?
dwTime			dd ?
hTask			HANDLE ?
dwRet			dd ?
wType			UINT ?
wFmt			UINT ?
hConv			HCONV ?
hsz1			HSZ ?
hsz2			HSZ ?
hData			HDDEDATA ?
dwData1			dd ?
dwData2			dd ?
cc			CONVCONTEXT <>
cbData			dd ?
Data			dd 8 dup(?)
MONCBSTRUCT		ENDS
PMONCBSTRUCT		typedef ptr MONCBSTRUCT

MONHSZSTRUCTA		STRUC
cb			UINT ?
fsAction		BOOL ?
dwTime			dd ?
hsz			HSZ ?
hTask			HANDLE ?
_str			CHAR ?
MONHSZSTRUCTA		ENDS
PMONHSZSTRUCTA		typedef ptr MONHSZSTRUCTA
MONHSZSTRUCTW		STRUC
cb			UINT ?
fsAction		BOOL ?
dwTime			dd ?
hsz			HSZ ?
hTask			HANDLE ?
_str			WCHAR ?
MONHSZSTRUCTW		ENDS
PMONHSZSTRUCTW		typedef ptr MONHSZSTRUCTW
ifdef _UNICODE
MONHSZSTRUCT		typedef MONHSZSTRUCTW
PMONHSZSTRUCT		typedef PMONHSZSTRUCTW
else
MONHSZSTRUCT		typedef MONHSZSTRUCTA
PMONHSZSTRUCT		typedef PMONHSZSTRUCTA
endif

MH_CREATE		equ 1
MH_KEEP			equ 2
MH_DELETE		equ 3
MH_CLEANUP		equ 4

MONERRSTRUCT		STRUC
cb			UINT ?
wLastError		UINT ?
dwTime			dd ?
hTask			HANDLE ?
MONERRSTRUCT		ENDS
PMONERRSTRUCT		typedef ptr MONERRSTRUCT

MONLINKSTRUCT		STRUC
cb			UINT ?
dwTime			dd ?
hTask			HANDLE ?
fEstablished		BOOL ?
fNoData			BOOL ?
hszSvc			HSZ ?
hszTopic		HSZ ?
hszItem			HSZ ?
wFmt			UINT ?
fServer			BOOL ?
hConvServer		HCONV ?
hConvClient		HCONV ?
MONLINKSTRUCT		ENDS
PMONLINKSTRUCT		typedef ptr MONLINKSTRUCT

MONCONVSTRUCT		STRUC
cb			UINT ?
fConnect		BOOL ?
dwTime			dd ?
hTask			HANDLE ?
hszSvc			HSZ ?
hszTopic		HSZ ?
hConvClient		HCONV ?
hConvServer		HCONV ?
MONCONVSTRUCT		ENDS
PMONCONVSTRUCT		typedef ptr MONCONVSTRUCT

MAX_MONITORS		equ 4
APPCLASS_MONITOR	equ 0x00000001
XTYP_MONITOR		equ (0x00F0 OR XCLASS_NOTIFICATION OR XTYPF_NOBOCK)

MF_HSZ_INFO		equ 0x01000000
MF_SENDMSGS		equ 0x02000000
MF_POSTMSGS		equ 0x04000000
MF_CALLBACKS		equ 0x08000000
MF_ERRORS		equ 0x10000000
MF_LINKS		equ 0x20000000
MF_CONV			equ 0x40000000

MF_MASK			equ 0xFF000000

endif

endif
