--- mstools/samples/ddeml/client/dde.c 2018/08/09 18:20:38 1.1 +++ mstools/samples/ddeml/client/dde.c 2018/08/09 18:23:22 1.1.1.3 @@ -1,3 +1,14 @@ + +/******************************************************************************\ +* This is a part of the Microsoft Source Code Samples. +* Copyright (C) 1993 Microsoft Corporation. +* All rights reserved. +* This source code is only intended as a supplement to +* Microsoft Development Tools and/or WinHelp documentation. +* See these sources for detailed information regarding the +* Microsoft samples programs. +\******************************************************************************/ + /*************************************************************************** * * * MODULE : dde.c * @@ -10,6 +21,7 @@ #include #include #include "infoctrl.h" +#include "huge.h" CHAR szT[100]; @@ -212,15 +224,21 @@ XACT *pxact) * Show resulting data */ psz = GetTextData((HDDEDATA)pxact->ret); - SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_CENTER, - (DWORD)(LPSTR)psz); + if (!DdeCmpStringHandles(pxact->hszItem, hszHuge) && + !CheckHugeData((HDDEDATA)pxact->ret)) { + SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_CENTER, + (DWORD)(LPSTR)"Invalid Huge Data"); + } else { + SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_CENTER, + (DWORD)(LPSTR)psz); + } MyFree(psz); /* * free returned data since it is displayed. */ DdeFreeDataHandle(pxact->ret); pxact->ret = 0L; - SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_UR, NULL); + SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_UR, 0); } } else { /* @@ -534,7 +552,7 @@ HDDEDATA hData) #define CBBUF 1024 - if (hData == NULL) { + if (hData == 0) { return(NULL); } @@ -579,7 +597,7 @@ INT cbMax) if (fmt < 0xc000) { // predefined or integer format - just get the atom string // wierdly enough, GetClipboardFormatName() doesn't support this. - return(GlobalGetAtomName((ATOM)fmt, lpstr, cbMax)); + return(GlobalGetAtomName((ATOM)fmt, lpstr, cbMax)); } else { return(GetClipboardFormatName(fmt, lpstr, cbMax)); } @@ -644,4 +662,3 @@ HCONV hConv) InvalidateRect(hwnd, NULL, TRUE); return(DdeDisconnect(hConv)); } -