Exemplo n.º 1
0
static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
{
    TRACE("(%p)->(%p %p)\n", This, in, out);

    if(in) {
        if(V_VT(in) == VT_I4) {
            nsICommandParams *nsparam = create_nscommand_params();
            char color_str[10];

            sprintf(color_str, "#%02x%02x%02x",
                    V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff);

            nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str);
            do_ns_command(This, NSCMD_FONTCOLOR, nsparam);

            nsICommandParams_Release(nsparam);
        }else {
Exemplo n.º 2
0
wxWebViewZoom wxWebViewIE::GetIETextZoom() const
{
    VARIANT zoomVariant;
    VariantInit (&zoomVariant);
    V_VT(&zoomVariant) = VT_I4;

#if wxDEBUG_LEVEL
    HRESULT result =
#endif
            m_webBrowser->ExecWB(OLECMDID_ZOOM,
                                 OLECMDEXECOPT_DONTPROMPTUSER,
                                 NULL, &zoomVariant);
    wxASSERT(result == S_OK);

    //We can safely cast here as we know that the range matches our enum
    return static_cast<wxWebViewZoom>(V_I4(&zoomVariant));
}
Exemplo n.º 3
0
static void test_Win32_Service( IWbemServices *services )
{
    static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0};
    static const WCHAR pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0};
    static const WCHAR resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0};
    static const WCHAR startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0};
    static const WCHAR stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0};
    static const WCHAR stateW[] = {'S','t','a','t','e',0};
    static const WCHAR stoppedW[] = {'S','t','o','p','p','e','d',0};
    static const WCHAR serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e','.',
                                     'N','a','m','e','=','"','S','p','o','o','l','e','r','"',0
                                    };
    static const WCHAR emptyW[] = {0};
    BSTR class = SysAllocString( serviceW ), empty = SysAllocString( emptyW ), method;
    IWbemClassObject *service, *out;
    VARIANT state, retval;
    CIMTYPE type;
    HRESULT hr;

    hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL );
    if (hr != S_OK)
    {
        win_skip( "Win32_Service not available\n" );
        goto out;
    }
    type = 0xdeadbeef;
    VariantInit( &state );
    hr = IWbemClassObject_Get( service, stateW, 0, &state, &type, NULL );
    ok( hr == S_OK, "failed to get service state %08x\n", hr );
    ok( V_VT( &state ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &state ) );
    ok( type == CIM_STRING, "unexpected type 0x%x\n", type );

    if (!lstrcmpW( V_BSTR( &state ), stoppedW ))
    {
        out = NULL;
        method = SysAllocString( startserviceW );
        hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL );
        ok( hr == S_OK, "failed to execute method %08x\n", hr );
        SysFreeString( method );

        VariantInit( &retval );
        hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, NULL, NULL );
        ok( hr == S_OK, "failed to get return value %08x\n", hr );
        ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) );
        IWbemClassObject_Release( out );
    }
Exemplo n.º 4
0
void wxWebViewIE::SetIETextZoom(wxWebViewZoom level)
{
    //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
    //is 0 to 4 so the check is unnecessary, these match exactly with the
    //enum values
    VARIANT zoomVariant;
    VariantInit (&zoomVariant);
    V_VT(&zoomVariant) = VT_I4;
    V_I4(&zoomVariant) = level;

#if wxDEBUG_LEVEL
    HRESULT result =
#endif
            m_webBrowser->ExecWB(OLECMDID_ZOOM,
                                 OLECMDEXECOPT_DONTPROMPTUSER,
                                 &zoomVariant, NULL);
    wxASSERT(result == S_OK);
}
Exemplo n.º 5
0
// ----------------------------------------------------------------------------
// AttachImage_ToolBarButton_command
// ----------------------------------------------------------------------------
void AttachImage_ToolBarButton_command (ebHTHREAD hThread, int iNumArgs, ebARGS lpArgs)
{
	BASIC_OP_TRACE(AttachImage_ToolBarButton_command);

// Test for typemismatch
	if (g_fDebugScript && isTypeMismatch (hThread, lpArgs, RTTI_ToolBarButton))
		return;

CComVariant vPicture;

	V_VT(&vPicture) = VT_I4;
	V_I4(&vPicture) = ebGetLong (lpArgs, 2);

CComVariant vIndex (MakeVARIANT (hThread, iNumArgs, lpArgs, 3));
CComVariant vSizeX (MakeVARIANT (hThread, iNumArgs, lpArgs, 4));

	((DControlToolBarButton *)ebGetObject (lpArgs, 1)) -> AttachImage (vPicture, vIndex, vSizeX);
}
Exemplo n.º 6
0
HRESULT CToolBarButton::RetrieveBitmap (VARIANT &vPicture)
{
CComVariant vArg;
HRESULT hr = vArg.ChangeType (VT_DISPATCH, &vPicture);

	if (SUCCEEDED(hr)) {
		hr = V_DISPATCH(&vArg) -> QueryInterface(IID_IPictureDisp, m_PictDisp.ppv());
		if (FAILED(hr)) return hr;

		m_iOffset = 0;
		m_iCnt = 1;
		return S_OK;
	}

	hr = vArg.ChangeType (VT_I4, &vPicture);		// BitmapHandle ?
	if (SUCCEEDED(hr)) {
		hr = CreatePicture ((HBITMAP)V_I4(&vArg), NULL, false, m_PictDisp.ppi());
		if (FAILED(hr)) return hr;

		m_iOffset = 0;
		m_iCnt = 1;
		return S_OK;
	}

	hr = vArg.ChangeType (VT_BSTR, &vPicture);	// DateiName ?
	if (SUCCEEDED(hr)) {
	CBildObjekt bmp;

		USES_CONVERSION;
	
	HBITMAP hBmp = bmp.ReadFile (OLE2A(V_BSTR(&vArg)));

		if (NULL != hBmp) {
			hr = CreatePicture (bmp.Detach(), bmp.DetachHPal(), true, m_PictDisp.ppi());
			if (FAILED(hr)) return hr;

			m_iOffset = 0;
			m_iCnt = 1;
			return S_OK;
		}
	}

	return E_INVALIDARG;
}
Exemplo n.º 7
0
static void set_downloading_proc(task_t *_task)
{
    download_proc_task_t *task = (download_proc_task_t*)_task;
    HTMLDocumentObj *doc = task->doc;
    IOleCommandTarget *olecmd;
    HRESULT hres;

    TRACE("(%p)\n", doc);

    set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
    CoTaskMemFree(task->url);

    if(!doc->client)
        return;

    if(task->set_download) {
        hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
        if(SUCCEEDED(hres)) {
            VARIANT var;

            V_VT(&var) = VT_I4;
            V_I4(&var) = 1;

            IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
                    OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
            IOleCommandTarget_Release(olecmd);
        }

        doc->download_state = 1;
    }

    if(doc->view_sink)
        IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);

    if(doc->hostui) {
        IDropTarget *drop_target = NULL;

        hres = IDocHostUIHandler_GetDropTarget(doc->hostui, NULL /* FIXME */, &drop_target);
        if(drop_target) {
            FIXME("Use IDropTarget\n");
            IDropTarget_Release(drop_target);
        }
    }
}
Exemplo n.º 8
0
static HRESULT add_keyitem_pair(dictionary *dict, VARIANT *key, VARIANT *item)
{
    struct keyitem_pair *pair;
    struct list *head;
    VARIANT hash;
    HRESULT hr;

    hr = IDictionary_get_HashVal(&dict->IDictionary_iface, key, &hash);
    if (FAILED(hr))
        return hr;

    pair = heap_alloc(sizeof(*pair));
    if (!pair)
        return E_OUTOFMEMORY;

    pair->hash = V_I4(&hash);
    VariantInit(&pair->key);
    VariantInit(&pair->item);

    hr = VariantCopyInd(&pair->key, key);
    if (FAILED(hr))
        goto failed;

    hr = VariantCopyInd(&pair->item, item);
    if (FAILED(hr))
        goto failed;

    head = get_bucket_head(dict, pair->hash);
    if (!head->next)
        /* this only happens once per bucket */
        list_init(head);

    /* link to bucket list and to full list */
    list_add_tail(head, &pair->bucket);
    list_add_tail(&dict->pairs, &pair->entry);
    dict->count++;
    return S_OK;

failed:
    VariantClear(&pair->key);
    VariantClear(&pair->item);
    heap_free(pair);
    return hr;
}
Exemplo n.º 9
0
void handle_navigation_error(DocHost* doc_host, HRESULT hres, BSTR url, IHTMLWindow2 *win2)
{
    VARIANT var_status_code, var_frame_name, var_url;
    DISPPARAMS dispparams;
    VARIANTARG params[5];
    VARIANT_BOOL cancel = VARIANT_FALSE;

    dispparams.cArgs = 5;
    dispparams.cNamedArgs = 0;
    dispparams.rgdispidNamedArgs = NULL;
    dispparams.rgvarg = params;

    V_VT(params) = VT_BOOL|VT_BYREF;
    V_BOOLREF(params) = &cancel;

    V_VT(params+1) = VT_VARIANT|VT_BYREF;
    V_VARIANTREF(params+1) = &var_status_code;
    V_VT(&var_status_code) = VT_I4;
    V_I4(&var_status_code) = hres;

    V_VT(params+2) = VT_VARIANT|VT_BYREF;
    V_VARIANTREF(params+2) = &var_frame_name;
    V_VT(&var_frame_name) = VT_BSTR;
    if(win2) {
        hres = IHTMLWindow2_get_name(win2, &V_BSTR(&var_frame_name));
        if(FAILED(hres))
            V_BSTR(&var_frame_name) = NULL;
    } else
        V_BSTR(&var_frame_name) = NULL;

    V_VT(params+3) = VT_VARIANT|VT_BYREF;
    V_VARIANTREF(params+3) = &var_url;
    V_VT(&var_url) = VT_BSTR;
    V_BSTR(&var_url) = url;

    V_VT(params+4) = VT_DISPATCH;
    V_DISPATCH(params+4) = (IDispatch*)doc_host->wb;

    call_sink(doc_host->cps.wbe2, DISPID_NAVIGATEERROR, &dispparams);
    SysFreeString(V_BSTR(&var_frame_name));

    if(!cancel)
        FIXME("Navigate to error page\n");
}
Exemplo n.º 10
0
static void notify_travellog_update(HTMLDocumentObj *doc)
{
    IOleCommandTarget *cmdtrg;
    HRESULT hres;

    if(!doc->webbrowser)
        return;

    hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
    if(SUCCEEDED(hres)) {
        VARIANT vin;

        V_VT(&vin) = VT_I4;
        V_I4(&vin) = 0;

        IOleCommandTarget_Exec(cmdtrg, &CGID_Explorer, CMDID_EXPLORER_UPDATEHISTORY, 0, &vin, NULL);
        IOleCommandTarget_Release(cmdtrg);
    }
}
Exemplo n.º 11
0
static HRESULT Function_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
        VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
    FunctionInstance *This = (FunctionInstance*)dispex;

    TRACE("%p %d\n", This, This->length);

    switch(flags) {
    case DISPATCH_PROPERTYGET:
        V_VT(retv) = VT_I4;
        V_I4(retv) = This->length;
        break;
    default:
        FIXME("unimplemented flags %x\n", flags);
        return E_NOTIMPL;
    }

    return S_OK;
}
Exemplo n.º 12
0
static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
        VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
    FunctionInstance *This = function_from_vdisp(jsthis);

    TRACE("%p %d\n", This, This->length);

    switch(flags) {
    case DISPATCH_PROPERTYGET:
        V_VT(retv) = VT_I4;
        V_I4(retv) = This->length;
        break;
    default:
        FIXME("unimplemented flags %x\n", flags);
        return E_NOTIMPL;
    }

    return S_OK;
}
Exemplo n.º 13
0
Arquivo: main.c Projeto: RazZziel/wine
const char *debugstr_variant(const VARIANT *v)
{
    if(!v)
        return "(null)";

    switch(V_VT(v)) {
    case VT_EMPTY:
        return "{VT_EMPTY}";
    case VT_NULL:
        return "{VT_NULL}";
    case VT_I1:
        return wine_dbg_sprintf("{VT_I1: %d}", V_I1(v));
    case VT_I2:
        return wine_dbg_sprintf("{VT_I2: %d}", V_I2(v));
    case VT_I4:
        return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v));
    case VT_INT:
        return wine_dbg_sprintf("{VT_INT: %d}", V_INT(v));
    case VT_R8:
        return wine_dbg_sprintf("{VT_R8: %lf}", V_R8(v));
    case VT_BSTR:
        return wine_dbg_sprintf("{VT_BSTR: %s}", debugstr_w(V_BSTR(v)));
    case VT_DISPATCH:
        return wine_dbg_sprintf("{VT_DISPATCH: %p}", V_DISPATCH(v));
    case VT_BOOL:
        return wine_dbg_sprintf("{VT_BOOL: %x}", V_BOOL(v));
    case VT_UNKNOWN:
        return wine_dbg_sprintf("{VT_UNKNOWN: %p}", V_UNKNOWN(v));
    case VT_UINT:
        return wine_dbg_sprintf("{VT_UINT: %u}", V_UINT(v));
    case VT_BSTR|VT_BYREF:
        return wine_dbg_sprintf("{VT_BSTR|VT_BYREF: ptr %p, data %s}",
            V_BSTRREF(v), debugstr_w(V_BSTRREF(v) ? *V_BSTRREF(v) : NULL));
    case VT_ERROR:
        return wine_dbg_sprintf("{VT_ERROR: 0x%08x}", V_ERROR(v));
    case VT_VARIANT|VT_BYREF:
        return wine_dbg_sprintf("{VT_VARIANT|VT_BYREF: %s}", debugstr_variant(V_VARIANTREF(v)));
    case VT_UI1|VT_ARRAY:
        return "{VT_UI1|VT_ARRAY}";
    default:
        return wine_dbg_sprintf("{vt %d}", V_VT(v));
    }
}
Exemplo n.º 14
0
HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
{
    VARIANT defkey, subkey, names, retval;
    IWbemClassObject *sig;
    HRESULT hr;

    TRACE("%p, %p\n", in, out);

    hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
    if (hr != S_OK) return hr;
    hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
    if (hr != S_OK) return hr;

    hr = create_signature( class_stdregprovW, method_enumkeyW, PARAM_OUT, &sig );
    if (hr != S_OK)
    {
        VariantClear( &subkey );
        return hr;
    }
    hr = IWbemClassObject_SpawnInstance( sig, 0, out );
    if (hr != S_OK)
    {
        VariantClear( &subkey );
        IWbemClassObject_Release( sig );
        return hr;
    }
    VariantInit( &names );
    hr = enum_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &retval );
    if (hr != S_OK) goto done;
    if (!V_UI4( &retval ))
    {
        hr = IWbemClassObject_Put( *out, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
        if (hr != S_OK) goto done;
    }
    hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );

done:
    VariantClear( &names );
    VariantClear( &subkey );
    IWbemClassObject_Release( sig );
    if (hr != S_OK) IWbemClassObject_Release( *out );
    return hr;
}
Exemplo n.º 15
0
void CHtmlView::BeforeNavigate2(LPDISPATCH /* pDisp */, VARIANT* URL,
		VARIANT* Flags, VARIANT* TargetFrameName,
		VARIANT* PostData, VARIANT* Headers, BOOL* Cancel)
{
	ASSERT(V_VT(URL) == VT_BSTR);
	ASSERT(V_VT(TargetFrameName) == VT_BSTR);
	ASSERT(V_VT(PostData) == (VT_VARIANT | VT_BYREF));
	ASSERT(V_VT(Headers) == VT_BSTR);
	ASSERT(Cancel != NULL);

	USES_CONVERSION;

	VARIANT* vtPostedData = V_VARIANTREF(PostData);
	CByteArray array;
	if (V_VT(vtPostedData) & VT_ARRAY)
	{
		// must be a vector of bytes
		ASSERT(vtPostedData->parray->cDims == 1 && vtPostedData->parray->cbElements == 1);

		vtPostedData->vt |= VT_UI1;
		COleSafeArray safe(vtPostedData);

		DWORD dwSize = safe.GetOneDimSize();
		LPVOID pVoid;
		safe.AccessData(&pVoid);

		array.SetSize(dwSize);
		LPBYTE lpByte = array.GetData();

		memcpy(lpByte, pVoid, dwSize);
		safe.UnaccessData();
	}
	// make real parameters out of the notification

	CString strTargetFrameName(V_BSTR(TargetFrameName));
	CString strURL = V_BSTR(URL);
	CString strHeaders = V_BSTR(Headers);
	DWORD nFlags = V_I4(Flags);

	// notify the user's class
	OnBeforeNavigate2(strURL, nFlags, strTargetFrameName,
		array, strHeaders, Cancel);
}
Exemplo n.º 16
0
void on_commandstate_change(DocHost *doc_host, LONG command, VARIANT_BOOL enable)
{
    DISPPARAMS dispparams;
    VARIANTARG params[2];

    TRACE("command=%d enable=%d\n", command, enable);

    dispparams.cArgs = 2;
    dispparams.cNamedArgs = 0;
    dispparams.rgdispidNamedArgs = NULL;
    dispparams.rgvarg = params;

    V_VT(params) = VT_BOOL;
    V_BOOL(params) = enable;

    V_VT(params+1) = VT_I4;
    V_I4(params+1) = command;

    call_sink(doc_host->cps.wbe2, DISPID_COMMANDSTATECHANGE, &dispparams);
}
Exemplo n.º 17
0
ListOfCS::iterator	CTRiASCSSet::FindItem( const VARIANT& Item ) 
{
ListOfCS::iterator i = m_listOfCS.end();

	if( V_ISUNKNOWN(&Item) ) {
		i = find( m_listOfCS.begin(), m_listOfCS.end(), WTRiASCS( V_UNKNOWN(&Item) ) );
	} else if( V_ISDISPATCH(&Item) ) {
		i = find( m_listOfCS.begin(), m_listOfCS.end(), WTRiASCS( V_DISPATCH(&Item) ) );
	} else if( V_ISINTEGER(&Item) ) {
		CComVariant	v(Item);
		v.ChangeType(VT_UI4);
		if( V_UI4(&v) >= m_listOfCS.size() )
			return i;
		i = m_listOfCS.begin();
		advance( i, V_I4(&v) );
	} else if( V_ISBSTR(&Item) ) {
		i = find_if( m_listOfCS.begin(), m_listOfCS.end(), matchDescription( V_BSTR(&Item) ) );
	}
	return i;
}
Exemplo n.º 18
0
//+----------------------------------------------------------------------------
//
//  Function    :   ReadyStateInvoke
//
//  Synopsis    :   This helper function is called by the various invokes for 
//      those classes that support the ready state property. this centralizes the
//      logic and code for handling this case.
//
//  RETURNS :   S_OK,           readyState-get and no errors
//              E_INVALIDARG    readystate-get and errors
//              S_FALSE         not readystate-get
//
//-----------------------------------------------------------------------------
HRESULT ReadyStateInvoke(DISPID dispid, WORD wFlags, long lReadyState, VARIANT* pvarResult)
{
    HRESULT hr = S_FALSE;

    if(dispid == DISPID_READYSTATE)
    {
        if(pvarResult && (wFlags&DISPATCH_PROPERTYGET))
        {
            V_VT(pvarResult) = VT_I4;
            V_I4(pvarResult) = lReadyState;
            hr = S_OK;
        }
        else
        {
            hr = E_INVALIDARG;
        }
    }

    RRETURN1(hr, S_FALSE);
}
Exemplo n.º 19
0
BOOL CTextService::_SetCompositionDisplayAttributes(TfEditCookie ec, ITfContext *pContext, ITfRange *pRange, TfGuidAtom gaDisplayAttribute)
{
	HRESULT hr = E_FAIL;

	ITfProperty *pProperty = nullptr;
	if(SUCCEEDED(pContext->GetProperty(GUID_PROP_ATTRIBUTE, &pProperty)) && (pProperty != nullptr))
	{
		VARIANT var;
		VariantInit(&var);
		V_VT(&var) = VT_I4;
		V_I4(&var) = gaDisplayAttribute;

		hr = pProperty->SetValue(ec, pRange, &var);

		VariantClear(&var);
		SafeRelease(&pProperty);
	}

	return SUCCEEDED(hr);
}
Exemplo n.º 20
0
static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
        VARIANT *retv, jsexcept_t *ei)
{
    ArrayInstance *This = array_from_vdisp(jsthis);

    TRACE("%p %d\n", This, This->length);

    switch(flags) {
    case DISPATCH_PROPERTYGET:
        V_VT(retv) = VT_I4;
        V_I4(retv) = This->length;
        break;
    case DISPATCH_PROPERTYPUT: {
        DOUBLE len = -1;
        DWORD i;
        HRESULT hres;

        hres = to_number(ctx, get_arg(dp, 0), ei, &len);
        if(FAILED(hres))
            return hres;

        len = floor(len);
        if(len!=(DWORD)len)
            return throw_range_error(ctx, ei, JS_E_INVALID_LENGTH, NULL);

        for(i=len; i<This->length; i++) {
            hres = jsdisp_delete_idx(&This->dispex, i);
            if(FAILED(hres))
                return hres;
        }

        This->length = len;
        break;
    }
    default:
        FIXME("unimplemented flags %x\n", flags);
        return E_NOTIMPL;
    }

    return S_OK;
}
Exemplo n.º 21
0
bool AppMenu::IsMenuExist( IAcadPopupMenu*& pMnu, long& index, LPCTSTR mnuname, IAcadPopupMenus* mnus )
{
    ASSERT( mnus != NULL );

    long cnt = 0l;
    HRESULT hr = mnus->get_Count( &cnt );
    bool found = false;
    int curMenuIndex = -1;
    BSTR tempName;

#ifdef _DEBUG
    acutPrintf( _T( "IsMenuExist cnt=%ld " ), cnt );
#endif

    //
    IAcadPopupMenu* toolsMenu = NULL;
    for ( long i = 0; i < cnt; i++ )
    {
        VARIANT vtName;
        VariantInit( &vtName );
        V_VT( &vtName ) = VT_I4;
        V_I4( &vtName ) = i;
        hr = mnus->Item( vtName, &toolsMenu );
        if ( FAILED( hr ) )
            return false;
        hr = toolsMenu->get_NameNoMnemonic( &tempName );
        CString mnuName( tempName );

#ifdef _DEBUG
        acutPrintf( _T( " %d,%s" ), i, mnuName );
#endif
        if( mnuName.Compare( mnuname ) == 0 )
        {
            index = i;
            pMnu = toolsMenu;
            return true;
        }
    }
    pMnu = NULL;
    return false;
}
Exemplo n.º 22
0
void set_download_state(HTMLDocumentObj *doc, int state)
{
    if(doc->client) {
        IOleCommandTarget *olecmd;
        HRESULT hres;

        hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
        if(SUCCEEDED(hres)) {
            VARIANT var;

            V_VT(&var) = VT_I4;
            V_I4(&var) = state;

            IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
                    OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
            IOleCommandTarget_Release(olecmd);
        }
    }

    doc->download_state = state;
}
Exemplo n.º 23
0
const char *debugstr_variant(const VARIANT *v)
{
    switch(V_VT(v)) {
    case VT_EMPTY:
        return wine_dbg_sprintf("{VT_EMPTY}");
    case VT_NULL:
        return wine_dbg_sprintf("{VT_NULL}");
    case VT_I4:
        return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v));
    case VT_R8:
        return wine_dbg_sprintf("{VT_R8: %lf}", V_R8(v));
    case VT_BSTR:
        return wine_dbg_sprintf("{VT_BSTR: %s}", debugstr_w(V_BSTR(v)));
    case VT_DISPATCH:
        return wine_dbg_sprintf("{VT_DISPATCH: %p}", V_DISPATCH(v));
    case VT_BOOL:
        return wine_dbg_sprintf("{VT_BOOL: %x}", V_BOOL(v));
    default:
        return wine_dbg_sprintf("{vt %d}", V_VT(v));
    }
}
Exemplo n.º 24
0
static void handle_docobj_load(HTMLDocumentObj *doc)
{
    IOleCommandTarget *olecmd = NULL;
    HRESULT hres;

    if(doc->nscontainer->editor_controller) {
        nsIController_Release(doc->nscontainer->editor_controller);
        doc->nscontainer->editor_controller = NULL;
    }

    if(doc->usermode == EDITMODE)
        handle_edit_load(&doc->basedoc);

    if(doc->client) {
        hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
        if(FAILED(hres))
            olecmd = NULL;
    }

    if(doc->download_state) {
        if(olecmd) {
            VARIANT progress;

            V_VT(&progress) = VT_I4;
            V_I4(&progress) = 0;
            IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS,
                    OLECMDEXECOPT_DONTPROMPTUSER, &progress, NULL);
        }

        set_download_state(doc, 0);
    }

    if(olecmd) {
        IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL);
        IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
        IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);

        IOleCommandTarget_Release(olecmd);
    }
}
Exemplo n.º 25
0
wxWebViewZoom wxWebViewIE::GetIEOpticalZoom() const
{
    VARIANT zoomVariant;
    VariantInit (&zoomVariant);
    V_VT(&zoomVariant) = VT_I4;

#if wxDEBUG_LEVEL
    HRESULT result =
#endif
            m_webBrowser->ExecWB((OLECMDID)63 /*OLECMDID_OPTICAL_ZOOM*/,
                                 OLECMDEXECOPT_DODEFAULT, NULL,
                                 &zoomVariant);
    wxASSERT(result == S_OK);

    const int zoom = V_I4(&zoomVariant);

    //We make a somewhat arbitray map here, taken from values used by webkit
    if (zoom <= 65)
    {
        return wxWEB_VIEW_ZOOM_TINY;
    }
    else if (zoom > 65 && zoom <= 90)
    {
        return wxWEB_VIEW_ZOOM_SMALL;
    }
    else if (zoom > 90 && zoom <= 115)
    {
        return wxWEB_VIEW_ZOOM_MEDIUM;
    }
    else if (zoom > 115 && zoom <= 145)
    {
        return wxWEB_VIEW_ZOOM_LARGE;
    }
    else /*if (zoom > 145) */ //Using else removes a compiler warning
    {
        return wxWEB_VIEW_ZOOM_LARGEST;
    }
}
Exemplo n.º 26
0
static LONG var_to_size(const VARIANT *v)
{
    switch(V_VT(v)) {
    case VT_EMPTY:
        return 0;
    case VT_I4:
        return V_I4(v);
    case VT_BSTR: {
        LONG ret;
        HRESULT hres;

        hres = VarI4FromStr(V_BSTR(v), 0, 0, &ret);
        if(FAILED(hres)) {
            FIXME("VarI4FromStr failed: %08x\n", hres);
            return 0;
        }
        return ret;
    }
    default:
        FIXME("unsupported size %s\n", debugstr_variant(v));
    }
    return 0;
}
Exemplo n.º 27
0
static BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
{
    switch(V_VT(v)) {
    case VT_BSTR:
        nsAString_Init(nsstr, V_BSTR(v));
        return TRUE;

    case VT_I4: {
        PRUnichar buf[10];
        static const WCHAR formatW[] = {'#','%','x',0};

        wsprintfW(buf, formatW, V_I4(v));
        nsAString_Init(nsstr, buf);
        return TRUE;
    }

    default:
        FIXME("invalid color %s\n", debugstr_variant(v));
    }

    return FALSE;

}
Exemplo n.º 28
0
static HRESULT Global_Hex(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
    WCHAR buf[17], *ptr;
    DWORD n;

    TRACE("%s\n", debugstr_variant(arg));

    switch(V_VT(arg)) {
    case VT_I2:
        n = (WORD)V_I2(arg);
        break;
    case VT_I4:
        n = V_I4(arg);
        break;
    case VT_EMPTY:
        n = 0;
        break;
    case VT_NULL:
        if(res)
            V_VT(res) = VT_NULL;
        return S_OK;
    default:
        FIXME("unsupported type %s\n", debugstr_variant(arg));
        return E_NOTIMPL;
    }

    buf[16] = 0;
    ptr = buf+15;

    if(n) {
        do {
            *ptr-- = hex_char(n & 0xf);
            n >>= 4;
        }while(n);
        ptr++;
    }else {
Exemplo n.º 29
0
/////////////////////////////////////////////////////////////////
// myAddProperty
//
//	This function initializes the property structure pProp
//
/////////////////////////////////////////////////////////////////
void myAddProperty
	(
	DBPROP *				pProp, 
	DBPROPID				dwPropertyID, 
	VARTYPE					vtType, 
	LONG_PTR				lValue, 
	DBPROPOPTIONS			dwOptions
	)
{
	// Set up the property structure
	pProp->dwPropertyID		= dwPropertyID;
	pProp->dwOptions		= dwOptions;
	pProp->dwStatus			= DBPROPSTATUS_OK;
	pProp->colid			= DB_NULLID;
	V_VT(&pProp->vValue)	= vtType;

	// Since VARIANT data is a union, we can place the value in any
	// member (except for VT_DECIMAL, which is a union with the whole
	// VARIANT structure -- but we know we're not passing VT_DECIMAL)
	if (vtType != VT_I8)
		V_I4(&pProp->vValue)	= (LONG)lValue;
	else 
		V_I8(&pProp->vValue)	= lValue;
}
Exemplo n.º 30
0
STDMETHODIMP CCUBRIDDataSource::CreateSession(IUnknown *pUnkOuter, REFIID riid, IUnknown **ppDBSession)
{
	if(ppDBSession==NULL) return E_INVALIDARG;
	*ppDBSession = NULL;

	// DBPROP_ACTIVESESSIONS 개수 이상의 session을 열 수 없다.
	{
		CComVariant var;
		HRESULT hr = GetPropValue(&DBPROPSET_DATASOURCEINFO, DBPROP_ACTIVESESSIONS, &var);
		if(FAILED(hr)) return hr;

		ATLASSERT(var.vt==VT_I4);
		int cActSessions = V_I4(&var);

		if(cActSessions!=0 && this->m_cSessionsOpen>=cActSessions)
			return DB_E_OBJECTCREATIONLIMITREACHED;
	}

	// DBPROP_MULTIPLECONNECTIONS==FALSE면
	// 여러 개의 connection handle을 여는 것을 허용하지 않음
	/*
	{
		CComVariant var;
		HRESULT hr = GetPropValue(&DBPROPSET_DATASOURCE, DBPROP_MULTIPLECONNECTIONS, &var);
		if(FAILED(hr)) return hr;

		ATLASSERT(var.vt==VT_BOOL);
		bool bMulSessions = V_BOOL(&var);

		if(!bMulSessions && this->m_cSessionsOpen!=0)
			return DB_E_OBJECTOPEN;
	}
	*/

	return IDBCreateSessionImpl<CCUBRIDDataSource, CCUBRIDSession>::CreateSession(pUnkOuter, riid, ppDBSession);
}