home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 June
/
PCWorld_1998-06_cd.bin
/
software
/
sharware
/
grafika
/
EROICA16
/
CALLBACK.C_
/
CALLBACK.C
Wrap
C/C++ Source or Header
|
1998-01-15
|
3KB
|
118 lines
/*-------------------------- Parallax Standard C_File ----------------------------
C_File: callback.c
Purpose: This file contains the source code for the handling
of DDE callbacks for the Eroica unit test program.
--------------------------------------------------------------------------------
Copyright (c)1996 Parallax Software , All rights reserved.
------------------------------------------------------------------------------*/
#include <memory.h>
#include "dde_test.h"
#include "utdde.h"
#include <errno.h>
#include <malloc.h>
int done = 0;
HDDEDATA hDataXact = NULL;
DWORD dwXactID;
#define MAX_DATA 1024
#ifndef _WIN32
HDDEDATA EXPENTRY _export DdeCallBack(WORD wType, WORD wFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2)
#else
_declspec(dllexport) HDDEDATA EXPENTRY DdeCallBack(WORD wType, WORD wFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2)
#endif
{
char lpStr[MAX_DATA + 1];
if (dwData2) ;
if (hConv) ;
if (wFmt) ;
switch (wType)
{
case XTYP_ADVDATA:
{
if (DdeGetData(hData, lpStr, MAX_DATA, 0) > 0)
{
__FMTMSG("Advised of <%s>", (LPSTR)lpStr);
} else /* if (DdeGetData(hData, lpStr, MAX_DATA, 0) > 0) */
{
__MSG("NO DATA!!!!!!");
} /* if (DdeGetData(hData, lpStr, MAX_DATA, 0) > 0) */
break;
} /* case XTYP_ADVDATA */
case XTYP_REGISTER:
{
DdeKeepStringHandle(idInst, hsz1);
DdeKeepStringHandle(idInst, hsz2);
hszServerBase = hsz1;
hszServerInst = hsz2;
return (HDDEDATA)NULL;
} /* case XTYP_REGISTER */
case XTYP_XACT_COMPLETE:
{
DWORD buf_size;
LPSTR img_buf;
PSTR pimg_buf;
if (dwXactID == dwData1)
{
hDataXact = hData;
if (hDataXact)
{
buf_size = DdeGetData(hDataXact, (void FAR *)NULL, 0, 0L);
buf_size++;
pimg_buf = (PSTR)malloc((WORD)buf_size);
img_buf = (LPSTR)pimg_buf;
if (img_buf)
{
if (DdeGetData(hDataXact, (LPSTR)img_buf, buf_size, 0L))
{
hViewWnd = (HWND) img_ATOI(img_buf);
}
free(pimg_buf);
} /* if (img_buf) */
} /* if (hDataXact) */
done = 1;
} /* if (dwXactID == dwData1) */
break;
} /* case XTYP_XACT_COMPLETE */
case XTYP_UNREGISTER:
{
return (HDDEDATA)NULL;
} /* case XTYP_UNREGISTER */
case XTYP_DISCONNECT:
{
return (HDDEDATA)NULL;
} /* case XTYP_DISCONNECT */
default:
{
return (HDDEDATA)NULL;
} /* case default */
} /* switch (wType) */
return (HDDEDATA)NULL;
}
/* CALLBACK.C */
/* end of file */