Exemplo n.º 1
0
static WResID *WREGetClipDataName( WREClipData *clip_data )
{
    WResID      *name;

    name = NULL;
    if( clip_data != NULL ) {
        name = WRMem2WResID( &clip_data->name[0], clip_data->is32bit );
    }
    return( name );
}
Exemplo n.º 2
0
bool WdeStartDDEEditSession( void )
{
    WdeResInfo          *rinfo;
    WdeResDlgItem       *ditem;
    char                *filename;
    HDDEDATA            hData;
    void                *data;
    DWORD               ret;
    uint_32             size;
    OBJPTR              object;
    bool                ok;

    object = NULL;
    ditem = WdeAllocResDlgItem();
    ok = (ditem != NULL);

    if( ok ) {
        hData = DdeClientTransaction( NULL, 0, WdeClientConv,
                                      hFileItem, WdeDataClipbdFormat,
                                      XTYP_REQUEST, TIME_OUT, &ret );
        ok = (hData != (HDDEDATA)NULL);
    }

    if( ok ) {
        filename = (char *)WdeHData2Mem( hData );
        DdeFreeDataHandle( hData );
        ok = (filename != NULL);
    }

    if( ok ) {
        hData = DdeClientTransaction( NULL, 0, WdeClientConv,
                                      hIs32BitItem, WdeDataClipbdFormat,
                                      XTYP_REQUEST, TIME_OUT, &ret );
        if( hData != (HDDEDATA)NULL ) {
            ditem->is32bit = TRUE;
            DdeFreeDataHandle( hData );
        }
    }

    if( ok ) {
        hData = DdeClientTransaction( NULL, 0, WdeClientConv,
                                      hNameItem, WdeDataClipbdFormat,
                                      XTYP_REQUEST, TIME_OUT, &ret );
        ok = (hData != (HDDEDATA)NULL);
    }

    if( ok ) {
        data = WdeHData2Mem( hData );
        DdeFreeDataHandle( hData );
        ok = (data != NULL);
    }

    if( ok ) {
        ditem->dialog_name = WRMem2WResID( data, ditem->is32bit );
        ok = (ditem->dialog_name != NULL);
        WRMemFree( data );
    }

    if( ok ) {
        hData = DdeClientTransaction( NULL, 0, WdeClientConv,
                                      hDataItem, WdeDataClipbdFormat,
                                      XTYP_REQUEST, TIME_OUT, &ret );
        if( hData != (HDDEDATA)NULL ) {
            data = WdeHData2Mem( hData );
            size = (int)DdeGetData( hData, NULL, 0, 0 );
            DdeFreeDataHandle( hData );
            if( data != NULL ) {
                ditem->dialog_info = WdeMem2DBI( (uint_8 *)data, size,
                                                 ditem->is32bit );
                ok = (ditem->dialog_info != NULL);
                WRMemFree( data );
            } else {
                ok = false;
            }
        }
    }

    if( ok ) {
        rinfo = WdeCreateNewResource( filename );
        ok = (rinfo != NULL);
    }

    if( ok ) {
        if( ditem->dialog_info != NULL ) {
            ok = WdeOpenDialogFromResInfo( rinfo, ditem );
            if( ok ) {
                WdeAddResDlgItemToResInfo( rinfo, ditem );
                object = ditem->object;
            }
        } else {
            object = WdeCreateNewDialog( ditem->dialog_name, ditem->is32bit );
            if( ditem != NULL ) {
                WdeFreeResDlgItem( &ditem, TRUE );
            }
            ditem = NULL;
        }
        ok = ok && (object != NULL);
    }

    if( ok ) {
        MakeObjectCurrent( object );
    }

    if( !ok ) {
        if( ditem != NULL ) {
            WdeFreeResDlgItem( &ditem, TRUE );
        }
        if( rinfo != NULL ) {
            WdeFreeResInfo( rinfo );
        }
    }

    if( filename != NULL ) {
        WRMemFree( filename );
    }

    return( ok );
}