1

这就是问题所在:
我编写了一个程序来接收来自 StockClient 的数据。
当我使用时DDESpy,我可以看到诸如

Time:xxxx hwndTo=0xe00b0 Message(Posted)=Data:<br>
 hwndFrom=0x1f06dc, status=2000(fRelease ) fmt=0x1("CF_TEXT")<br>
 Data=          "value"<br>
 Item=          "xxxxx"<br>

但是我的 ddecallback 函数不起作用(有时它可以起作用),为什么?

DdeInitialize( &_dde_inst, dde_callback, APPCMD_CLIENTONLY/*|CBF_FAIL_ALLSVRXACTIONS*/, 0 ); HSZ _server = DdeCreateStringHandle ( _dde_inst, "DDEServer", CP_WINANSI ); if( !_server ) return -1;

HSZ _topic = DdeCreateStringHandle( _dde_inst, "TOPIC1", CP_WINANSI );
HCONV _conv = DdeConnect( _dde_inst, _server, _topic, NULL );
if( !_conv )
    return -1;

for( int i = 0; i < ITEM_NUM; ++i )
{
    HSZ _item = DdeCreateStringHandle( _dde_inst, _list[i], CP_WINANSI );
    if( _item )
    {
        DWORD _result;
        HDDEDATA _data = DdeClientTransaction( NULL, NULL, _conv, _item, CF_TEXT, XTYP_ADVSTART, TIMEOUT_ASYNC, &_result );
        UINT _error = DdeGetLastError(_dde_inst );
        DdeFreeStringHandle( _dde_inst, _item );
        int _reserve = DMLERR_NO_ERROR;
        if( _error != 0 )
        {
            fprintf( stdout, "dde error = %d\n", _error );
            continue;
        }
    }
}
4

0 回答 0