本文整理汇总了C++中V_I4函数的典型用法代码示例。如果您正苦于以下问题:C++ V_I4函数的具体用法?C++ V_I4怎么用?C++ V_I4使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了V_I4函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec_forecolor
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 {
示例2: VariantInit
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));
}
示例3: test_Win32_Service
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 );
}
示例4: AttachImage_ToolBarButton_command
// ----------------------------------------------------------------------------
// 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);
}
示例5: V_DISPATCH
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;
}
示例6: set_downloading_proc
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);
}
}
}
示例7: add_keyitem_pair
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;
}
示例8: handle_navigation_error
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");
}
示例9: notify_travellog_update
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);
}
}
示例10: Function_length
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;
}
示例11: switch
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));
}
}
示例12: reg_enum_key
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;
}
示例13: ASSERT
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);
}
示例14: on_commandstate_change
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);
}
示例15: ReadyStateInvoke
//+----------------------------------------------------------------------------
//
// 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);
}