• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PyWinObject_AsWCHAR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PyWinObject_AsWCHAR函数的典型用法代码示例。如果您正苦于以下问题:C++ PyWinObject_AsWCHAR函数的具体用法?C++ PyWinObject_AsWCHAR怎么用?C++ PyWinObject_AsWCHAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PyWinObject_AsWCHAR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetI

// @pymethod |PyIBackgroundCopyJob|SetProxySettings|Description of SetProxySettings.
PyObject *PyIBackgroundCopyJob::SetProxySettings(PyObject *self, PyObject *args)
{
	IBackgroundCopyJob *pIBCJ = GetI(self);
	if ( pIBCJ == NULL )
		return NULL;
	BG_JOB_PROXY_USAGE ProxyUsage;
	// @pyparm int|ProxyUsage||Description for ProxyUsage
	WCHAR * ProxyList;
	PyObject *obProxyList;
	// @pyparm unicode|ProxyList||Description for ProxyList
	WCHAR * ProxyBypassList;
	PyObject *obProxyBypassList;
	// @pyparm unicode|ProxyBypassList||Description for ProxyBypassList
	if ( !PyArg_ParseTuple(args, "lOO:SetProxySettings", &ProxyUsage, &obProxyList, &obProxyBypassList) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR( obProxyList, &ProxyList, TRUE )) bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR( obProxyBypassList, &ProxyBypassList, TRUE )) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIBCJ->SetProxySettings( ProxyUsage, ProxyList, ProxyBypassList );
	PyWinObject_FreeWCHAR(ProxyList);
	PyWinObject_FreeWCHAR(ProxyBypassList);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIBCJ, IID_IBackgroundCopyJob );
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:31,代码来源:PyIBackgroundCopyJob.cpp


示例2: returning

// @pymethod int|win32ts|WTSSendMessage|Sends a popup message to a terminal services session
// @rdesc Returns one of IDABORT,IDCANCEL,IDIGNORE,IDNO,IDOK,IDRETRY,IDYES,IDASYNC,IDTIMEOUT, 
static PyObject *PyWTSSendMessage(PyObject *self, PyObject *args, PyObject *kwargs)
{
	static char *keywords[]={"Server","SessionId","Title","Message","Style","Timeout","Wait", NULL};
	PyObject *obh=NULL;
	HANDLE h;
	DWORD SessionId, TitleLen, MessageLen, Style, Timeout, Response;
	WCHAR *Title=NULL, *Message=NULL;
	PyObject *obTitle, *obMessage, *ret=NULL;
	BOOL Wait;
	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OkOOkkl:WTSSendMessage", keywords,
		&obh,		// @pyparm <o PyHANDLE>|Server|WTS_CURRENT_SERVER_HANDLE|Handle to a terminal server, or WTS_CURRENT_SERVER_HANDLE
		&SessionId,	// @pyparm int|SessionId||Terminal services session id
		&obTitle,	// @pyparm <o PyUnicode>|Title||Title of dialog
		&obMessage,	// @pyparm <o PyUnicode>|Message||Message to be displayed
		&Style,		// @pyparm int|Style||Usually MB_OK
		&Timeout,	// @pyparm int|Timeout||Seconds to wait before returning (only used if Wait is True)
		&Wait))		// @pyparm boolean|Wait||Specifies if function should wait for user input before returning
		return NULL;
	if (PyWinObject_AsHANDLE(obh, &h)
		&&PyWinObject_AsWCHAR(obTitle, &Title, FALSE, &TitleLen)
		&&PyWinObject_AsWCHAR(obMessage, &Message, FALSE, &MessageLen)){
		if (WTSSendMessage(h, SessionId, Title, TitleLen*sizeof(WCHAR), Message, MessageLen*sizeof(WCHAR), Style, Timeout, &Response, Wait))
			ret=PyLong_FromUnsignedLong(Response);
		else
			PyWin_SetAPIError("WTSSendMessage");
		}
	PyWinObject_FreeWCHAR(Title);
	PyWinObject_FreeWCHAR(Message);
	return ret;
}
开发者ID:Logan-lu,项目名称:pywin32,代码行数:32,代码来源:win32tsmodule.cpp


示例3: PyNetUseEnum

// @pymethod ([dict, ...], total, resumeHandle)|win32net|NetUseEnum|Retrieves information about transport protocols that are currently managed by the redirector
// @rdesc The result is a list of items read (with each item being a dictionary of format
// <o PyUSE_INFO_*>, depending on the level parameter),
// the total available, and a new "resume handle".  The first time you call
// this function, you should pass zero for the resume handle.  If more data
// is available than what was returned, a new non-zero resume handle will be
// returned, which can be used to call the function again to fetch more data.
// This process may repeat, each time with a new resume handle, until zero is
// returned for the new handle, indicating all the data has been read.
PyObject *
PyNetUseEnum(PyObject *self, PyObject *args)
{
	WCHAR *szServer = NULL, *szDomain = NULL;
	PyObject *obServer, *obDomain = Py_None;
	PyObject *ret = NULL;
	PyNET_STRUCT *pInfo;
	DWORD err;
	DWORD dwPrefLen = MAX_PREFERRED_LENGTH;
	DWORD level;
	BOOL ok = FALSE;
	DWORD resumeHandle = 0;
	DWORD numRead, i;
	PyObject *list;
	BYTE *buf = NULL;
	DWORD totalEntries = 0;
	// @pyparm string/<o PyUnicode>|server||The name of the server to execute on, or None.
	// @pyparm int|level||The level of data required. Currently levels 0, 1 and
	// 2 are supported.
	// @pyparm int|resumeHandle|0|A resume handle.  See the return description for more information.
	// @pyparm int|prefLen|MAX_PREFERRED_LENGTH|The preferred length of the data buffer.
	if (!PyArg_ParseTuple(args, "Oi|ii", &obServer, &level, &resumeHandle, &dwPrefLen))
		return NULL;
	if (!PyWinObject_AsWCHAR(obServer, &szServer, TRUE))
		goto done;
	if (!PyWinObject_AsWCHAR(obDomain, &szDomain, TRUE))
		goto done;

	if (!FindNET_STRUCT(level, use_infos, &pInfo))
		goto done;

	err = NetUseEnum(szServer, level, &buf, dwPrefLen, &numRead, &totalEntries, &resumeHandle);
	if (err!=0 && err != ERROR_MORE_DATA) {
		ReturnNetError("NetUseEnum",err);
		goto done;
	}
	list = PyList_New(numRead);
	if (list==NULL) goto done;
	for (i=0;i<numRead;i++) {
		PyObject *sub = PyObject_FromNET_STRUCT(pInfo, buf+(i*pInfo->structsize));
		if (sub==NULL) goto done;
		PyList_SetItem(list, i, sub);
	}
	resumeHandle = err==0 ? 0 : resumeHandle;
	ret = Py_BuildValue("Oll", list, totalEntries, resumeHandle);
	Py_DECREF(list);
	ok = TRUE;
done:
	if (buf) NetApiBufferFree(buf);
	if (!ok) {
		Py_XDECREF(ret);
		ret = NULL;
	}
	PyWinObject_FreeWCHAR(szServer);
	return ret;
	// @pyseeapi NetUseEnum
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:66,代码来源:win32netuse.cpp


示例4: time

// @pymethod object|win32ts|WTSQueryUserConfig|Returns user configuration
// @rdesc The type of the returned value is dependent on the config class requested
static PyObject *PyWTSQueryUserConfig(PyObject *self, PyObject *args, PyObject *kwargs)
{
	static char *keywords[]={"ServerName","UserName","WTSConfigClass",NULL};
	WCHAR *ServerName=NULL, *UserName=NULL;
	PyObject *obServerName, *obUserName, *ret=NULL;
	WTS_CONFIG_CLASS WTSConfigClass;
	LPWSTR buf=NULL;
	DWORD bufsize=0;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOk:WTSQueryUserConfig", keywords,
		&obServerName,	// @pyparm <o PyUnicode>|ServerName||Name ot terminal server
		&obUserName,	// @pyparm <o PyUnicode>|UserName||Name of user
		&WTSConfigClass))	// @pyparm int|ConfigClass||Type of information to be returned, win32ts.WTSUserConfig*
		return NULL;
	if (PyWinObject_AsWCHAR(obServerName, &ServerName, TRUE)
		&&PyWinObject_AsWCHAR(obUserName, &UserName, FALSE))
		if (!WTSQueryUserConfig(ServerName, UserName, WTSConfigClass, &buf, &bufsize))
			PyWin_SetAPIError("WTSQueryUserConfig");
		else
			switch(WTSConfigClass){
				// @flagh ConfigClass|Returned value
				case WTSUserConfigInitialProgram:				// @flag WTSUserConfigInitialProgram|Unicode string, program to be run when user logs on
				case WTSUserConfigWorkingDirectory:				// @flag WTSUserConfigWorkingDirectory|Unicode string, working dir for initial program
				case WTSUserConfigModemCallbackPhoneNumber:		// @flag WTSUserConfigModemCallbackPhoneNumber|Unicode string
				case WTSUserConfigTerminalServerProfilePath:	// @flag WTSUserConfigTerminalServerProfilePath|Unicode string
				case WTSUserConfigTerminalServerHomeDir:		// @flag WTSUserConfigTerminalServerHomeDir|Unicode string
				case WTSUserConfigTerminalServerHomeDirDrive:	// @flag WTSUserConfigTerminalServerHomeDirDrive|Unicode string
					ret=PyWinObject_FromWCHAR(buf);
					break;
				case WTSUserConfigfInheritInitialProgram:		// @flag WTSUserConfigfInheritInitialProgram|Int
				case WTSUserConfigfAllowLogonTerminalServer:	// @flag WTSUserConfigfAllowLogonTerminalServer|Int, 1 if user can log on thru Terminal Service
				case WTSUserConfigTimeoutSettingsConnections:	// @flag WTSUserConfigTimeoutSettingsConnections |Int, max connection time (ms)
				case WTSUserConfigTimeoutSettingsDisconnections:// @flag WTSUserConfigTimeoutSettingsDisconnections|Int
				case WTSUserConfigTimeoutSettingsIdle:			// @flag WTSUserConfigTimeoutSettingsIdle|Int, max idle time (ms)
				case WTSUserConfigfDeviceClientDrives:			// @flag WTSUserConfigfDeviceClientDrives|Int
				case WTSUserConfigfDeviceClientPrinters:		// @flag WTSUserConfigfDeviceClientPrinters|Int
				case WTSUserConfigfDeviceClientDefaultPrinter:	// @flag WTSUserConfigfDeviceClientDefaultPrinter|Int
				case WTSUserConfigBrokenTimeoutSettings:		// @flag WTSUserConfigBrokenTimeoutSettings|Int
				case WTSUserConfigReconnectSettings:			// @flag WTSUserConfigReconnectSettings|Int
				case WTSUserConfigModemCallbackSettings:		// @flag WTSUserConfigModemCallbackSettings|Int
				case WTSUserConfigShadowingSettings:			// @flag WTSUserConfigShadowingSettings|Int, indicates if user's session my be monitored
				case WTSUserConfigfTerminalServerRemoteHomeDir:	// @flag WTSUserConfigfTerminalServerRemoteHomeDir|Int,
					ret=PyLong_FromUnsignedLong(*(DWORD *)buf);
					break;
				default:
					PyErr_SetString(PyExc_NotImplementedError,"Config class not supported yet");
			}

	PyWinObject_FreeWCHAR(ServerName);
	PyWinObject_FreeWCHAR(UserName);
	if (buf)
		WTSFreeMemory(buf);
	return ret;
}
开发者ID:Logan-lu,项目名称:pywin32,代码行数:56,代码来源:win32tsmodule.cpp


示例5: PyWinObject_FromHKEY

// IEmptyVolumeCache2
// @object PyIEmptyVolumeCache2|See also <o PyIEmptyVolumeCache>
// @pymeth PyIEmptyVolumeCache|Deactivate
// @pymethod |PyIEmptyVolumeCache2|InitializeEx|
STDMETHODIMP PyGEmptyVolumeCache2::InitializeEx(
		/* [in] */ HKEY hkRegKey,
		/* [in] */ LPCWSTR pcwszVolume,
		/* [in] */ LPCWSTR pcwszKeyName,
		/* [out] */ LPWSTR * ppwszDisplayName,
		/* [out] */ LPWSTR * ppwszDescription,
		/* [out] */ LPWSTR * ppwszBtnText,
		/* [out] */ DWORD * pdwFlags)
{
	PY_GATEWAY_METHOD;
	BOOL bPythonIsHappy = TRUE;
	ULONG dwFlags;
	HRESULT hr;
	PyObject *result;
	PyObject *obppwszDisplayName; 
	PyObject *obppwszDescription;
	PyObject *obppwszBtnText; 
	PyObject *obpcwszVolume = NULL;
	PyObject *obpcwszKeyName = NULL;
	PyObject *obhkRegKey = PyWinObject_FromHKEY(hkRegKey);
	if (!obhkRegKey) goto args_failed;
	if (!(obpcwszVolume = MakeOLECHARToObj(pcwszVolume))) goto args_failed;
	if (!(obpcwszKeyName = MakeOLECHARToObj(pcwszKeyName))) goto args_failed;
	hr=InvokeViaPolicy("InitializeEx", &result, "NNNk", obhkRegKey, obpcwszVolume, obpcwszKeyName, *pdwFlags);
	// NOTE: From here, do *not* exit via args_failed - the args have been cleaned up
	if (FAILED(hr)) return hr;
	// Process the Python results, and convert back to the real params

	if (!PyTuple_Check(result)) {
		PyErr_Format(PyExc_TypeError, 
				"Initialize must return a tuple of (unicode, unicode, unicode, long) - got '%s'",
				result->ob_type->tp_name);
		bPythonIsHappy = FALSE;
	}
	if (bPythonIsHappy && !PyArg_ParseTuple(result, "OOOl" , &obppwszDisplayName, &obppwszDescription, &obppwszBtnText, &dwFlags))
		bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszDisplayName, ppwszDisplayName)) bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszDescription, ppwszDescription)) bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszBtnText, ppwszBtnText)) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) hr = PyCom_SetAndLogCOMErrorFromPyException("InitializeEx", IID_IEmptyVolumeCache);
	if (pdwFlags) *pdwFlags = dwFlags;

	Py_DECREF(result);
	return hr;
args_failed:
	// only hit on error convering input args, not normal exit.
	Py_XDECREF(obhkRegKey);
	Py_XDECREF(obpcwszVolume);
	Py_XDECREF(obpcwszKeyName);
	return MAKE_PYCOM_GATEWAY_FAILURE_CODE("InitializeEx");
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:55,代码来源:PyIEmptyVolumeCache.cpp


示例6: PyWinObject_AsMAPIStr

BOOL PyWinObject_AsMAPIStr(PyObject *stringObject, LPTSTR *pResult, BOOL asUnicode, BOOL bNoneOK /*= FALSE*/, DWORD *pResultLen /* = NULL */)
{
#if PY_MAJOR_VERSION >= 3
	if (asUnicode)
		return PyWinObject_AsWCHAR(stringObject, (LPWSTR *)pResult, bNoneOK, pResultLen);
	else
		return PyWinObject_AsString(stringObject, (LPSTR *)pResult, bNoneOK, pResultLen);
#else
	if (asUnicode && PyUnicode_Check(stringObject))
		return PyWinObject_AsWCHAR(stringObject, (LPWSTR *)pResult, bNoneOK, pResultLen);
	// allows already encoded string pass-through workaround (backwards compat)
	return PyWinObject_AsString(stringObject, (LPSTR *)pResult, bNoneOK, pResultLen);
#endif
}
开发者ID:Dechy,项目名称:pywin32,代码行数:14,代码来源:mapiutil.cpp


示例7: GetI

// @pymethod |PyICustomDestinationList|AppendCategory|Adds a custom category to the jump list
PyObject *PyICustomDestinationList::AppendCategory(PyObject *self, PyObject *args)
{
	ICustomDestinationList *pICDL = GetI(self);
	if ( pICDL == NULL )
		return NULL;
	
	TmpWCHAR Category;
	PyObject *obCategory, *obItems;
	IObjectArray *Items;
	// @pyparm str|Category||Display name of the category, can also be a dll and resource id for localization
	// @pyparm <o PyIObjectArray>|Items||Collection of IShellItem and/or IShellLink interfaces
	if ( !PyArg_ParseTuple(args, "OO:AppendCategory", &obCategory, &obItems))
		return NULL;
	if (!PyWinObject_AsWCHAR(obCategory, &Category, FALSE))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obItems, IID_IObjectArray, (void **)&Items, FALSE))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pICDL->AppendCategory(Category, Items);
	Items->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pICDL, IID_ICustomDestinationList );
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:29,代码来源:PyICustomDestinationList.cpp


示例8: GetI

// @pymethod |PyIQueryAssociations|Init|Initializes the IQueryAssociations interface and sets the root key to the appropriate ProgID.
PyObject *PyIQueryAssociations::Init(PyObject *self, PyObject *args)
{
	IQueryAssociations *pIQA = GetI(self);
	if ( pIQA == NULL )
		return NULL;
	// @pyparm int|flags||One of shellcon.ASSOCF_* flags
    // @pyparm string|assoc||The string data (ie, extension, prog-id, etc)
    // @pyparm <o PyHKEY>|hkeyProgId|None|Root registry key, can be None
    // @pyparm <o PyHANDLE>|hwnd|None|Reserved, must be 0 or None
    int flags;
	HWND hwnd;
	HKEY hkProgid;
    PyObject *obAssoc, *obhwnd=Py_None, *obhkProgid=Py_None;
    WCHAR *pszAssoc = NULL;
	if (!PyArg_ParseTuple(args, "lO|OO:Init", &flags, &obAssoc, &obhkProgid, &obhwnd))
		return NULL;
	if (!PyWinObject_AsWCHAR(obAssoc, &pszAssoc, TRUE))
        return NULL;
	if (!PyWinObject_AsHKEY(obhkProgid, &hkProgid))
		return NULL;
	if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIQA->Init( flags, pszAssoc, hkProgid, hwnd);
	PyWinObject_FreeWCHAR(pszAssoc);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIQA, IID_IQueryAssociations );
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:33,代码来源:PyIQueryAssociations.cpp


示例9: HRESULT

// @pymethod <o PyIID>|pythoncom|PropStgNameToFmtId|Converts a property set name to its format id (GUID)
PyObject *pythoncom_PropStgNameToFmtId(PyObject *self, PyObject *args)
{
	// @pyparm string/unicode|Name||Storage stream name
	FMTID fmtid;
	WCHAR *oszName=NULL;
	HRESULT err;
	PyObject *obName=NULL;

	typedef HRESULT (WINAPI * PFNPropStgNameToFmtId)(const LPOLESTR, FMTID*);
	static PFNPropStgNameToFmtId pfnPropStgNameToFmtId=NULL;
	static BOOL pfnchecked=FALSE;
	if (!pfnchecked){
		if (ole32==NULL)
			ole32=GetModuleHandle(_T("Ole32.dll"));
		if (ole32!=NULL)
			pfnPropStgNameToFmtId = (PFNPropStgNameToFmtId)GetProcAddress(ole32, "PropStgNameToFmtId");
		pfnchecked=TRUE;
		}
	if (pfnPropStgNameToFmtId==NULL)
		return PyErr_Format(PyExc_NotImplementedError,"PropStgNameToFmtId is not available on this platform");

	if (!PyArg_ParseTuple(args, "O:PropStgNameToFmtId", &obName))
		return NULL;
	if (!PyWinObject_AsWCHAR(obName,&oszName))
		return NULL;

	PY_INTERFACE_PRECALL;
	err = (*pfnPropStgNameToFmtId)(oszName, &fmtid);
	PY_INTERFACE_POSTCALL;

	PyWinObject_FreeWCHAR(oszName);
	if (err!=S_OK)
		return PyCom_BuildPyException(err);
	return PyWinObject_FromIID(fmtid);
}
开发者ID:locsic,项目名称:Law-Enforcement-Scripts,代码行数:36,代码来源:PyStorage.cpp


示例10: GetI

// @pymethod |PyIActiveScriptDebug|GetScriptletTextAttributes|Description of GetScriptletTextAttributes.
PyObject *PyIActiveScriptDebug::GetScriptletTextAttributes(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IActiveScriptDebug *pIASD = GetI(self);
	if ( pIASD == NULL )
		return NULL;
	// @pyparm string|pstrCode||The script block text.
	// @pyparm string|pstrDelimiter||See <om PyIActiveScriptParse::ParseScriptText> for a description of this argument.
	// @pyparm int|dwFlags||See <om PyIActiveScriptParse::ParseScriptText> for a description of this argument.
	DWORD dwFlags;
	PyObject *obCode, *obDelim;
	if ( !PyArg_ParseTuple(args, "OOi:GetScriptletTextAttributes", &obCode, &obDelim, &dwFlags) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	WCHAR *pstrDelimiter;
	BSTR bstr;
	if (!PyWinObject_AsWCHAR(obDelim, &pstrDelimiter)) bPythonIsHappy = FALSE;
	if (!PyCom_BstrFromPyObject(obCode, &bstr)) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	ULONG uNumCodeChars = SysStringLen(bstr);
	SOURCE_TEXT_ATTR *pattr = new SOURCE_TEXT_ATTR[uNumCodeChars];
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIASD->GetScriptletTextAttributes( bstr, uNumCodeChars, pstrDelimiter, dwFlags, pattr );
	PY_INTERFACE_POSTCALL;
	SysFreeString(bstr);
	PyWinObject_FreeWCHAR(pstrDelimiter);
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	return PyAXDebug_PyObject_FromSOURCE_TEXT_ATTR(pattr, uNumCodeChars);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:32,代码来源:PyIActiveScriptDebug.cpp


示例11: GetI

// @pymethod |PyIPropertySystem|UnregisterPropertySchema|Removes a set of registered properties
PyObject *PyIPropertySystem::UnregisterPropertySchema(PyObject *self, PyObject *args)
{
	IPropertySystem *pIPS = GetI(self);
	if ( pIPS == NULL )
		return NULL;

	WCHAR *path;
	PyObject *obpath;
	// @pyparm str|Path||Path to a property schema XML file (.propdesc)
	if ( !PyArg_ParseTuple(args, "O:UnregisterPropertySchema", &obpath))
		return NULL;
	if (!PyWinObject_AsWCHAR(obpath, &path, FALSE))
		return NULL;

	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIPS->UnregisterPropertySchema(path);
	PY_INTERFACE_POSTCALL;
	PyWinObject_FreeWCHAR(path);

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPS, IID_IPropertySystem );
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:26,代码来源:PyIPropertySystem.cpp


示例12: GetI

// @pymethod |PyIDocHostUIHandler|TranslateUrl|Description of TranslateUrl.
PyObject *PyIDocHostUIHandler::TranslateUrl(PyObject *self, PyObject *args)
{
	IDocHostUIHandler *pIDHUIH = GetI(self);
	if ( pIDHUIH == NULL )
		return NULL;
	// @pyparm int|dwTranslate||Description for dwTranslate
	// @pyparm <o unicode>|pchURLIn||Description for pchURLIn
	PyObject *obpchURLIn;
	DWORD dwTranslate;
	OLECHAR *pchURLIn;
	OLECHAR *pchURLOut = 0;
	if ( !PyArg_ParseTuple(args, "lO:TranslateUrl", &dwTranslate, &obpchURLIn) )
		return NULL;
	if (!PyWinObject_AsWCHAR(obpchURLIn, &pchURLIn))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDHUIH->TranslateUrl( dwTranslate, pchURLIn, &pchURLOut);
	PyWinObject_FreeWCHAR(pchURLIn);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
	PyObject *pyretval = MakeOLECHARToObj(pchURLOut);
	CoTaskMemFree(pchURLOut);
	return pyretval;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:27,代码来源:PyIDocHostUIHandler.cpp


示例13: PyCom_BuildPyException

// @pymethod <o PyPROPVARIANT>|propsys|PSGetNamedPropertyFromPropertyStorage|Extracts a property value from a serialized buffer by name
static PyObject *PyPSGetNamedPropertyFromPropertyStorage(PyObject *self, PyObject *args)
{
	TmpWCHAR name;
	void *buf;
	DWORD bufsize;
	PROPVARIANT val;
	PyObject *obname, *obbuf;
	// @pyparm buffer|ps||Bytes or buffer (or str in python 2) containing a serialized property set (see <om PyIPersistSerializedPropStorage.GetPropertyStorage>)
	// @pyparm str|name||Property to return
	if (!PyArg_ParseTuple(args, "OO:PSGetNamedPropertyFromPropertyStorage",
		&obbuf, &obname))
		return NULL;
	if (!PyWinObject_AsReadBuffer(obbuf, &buf, &bufsize, FALSE))
		return NULL;
	if (!PyWinObject_AsWCHAR(obname, &name, FALSE))
		return NULL;

	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = PSGetNamedPropertyFromPropertyStorage((PCUSERIALIZEDPROPSTORAGE)buf, bufsize, name, &val);
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr))
		return PyCom_BuildPyException(hr);
	return PyWinObject_FromPROPVARIANT(val);
}
开发者ID:locsic,项目名称:Law-Enforcement-Scripts,代码行数:26,代码来源:propsys.cpp


示例14: GetI

// @pymethod |PyIPropertyBag|Write|Called by the control to write each property in turn to the storage provided by the container.
PyObject *PyIPropertyBag::Write(PyObject *self, PyObject *args)
{
	PyObject *obName;
	PyObject *obValue;
	// @pyparm str|propName||Name of the property to read.
	// @pyparm object|value||The value for the property.  The value must be able to be converted to a COM VARIANT.
	if ( !PyArg_ParseTuple(args, "OO:Write", &obName, &obValue) )
		return NULL;

	IPropertyBag *pIPB = GetI(self);
	if ( pIPB == NULL )
		return NULL;

	TmpWCHAR Name;
	if ( !PyWinObject_AsWCHAR(obName, &Name))
		return NULL;
	VARIANT var;
	if ( !PyCom_VariantFromPyObject(obValue, &var) )
		return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pIPB->Write(Name, &var);
	VariantClear(&var);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPB, IID_IPropertyBag);

	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:31,代码来源:PyIPropertyBag.cpp


示例15: GetI

// @pymethod <o PyIShellItem>|PyIShellLibrary|SaveInKnownFolder|Saves the library in a known folder
PyObject *PyIShellLibrary::SaveInKnownFolder(PyObject *self, PyObject *args)
{
	IShellLibrary *pISL = GetI(self);
	if ( pISL == NULL )
		return NULL;
	KNOWNFOLDERID FolderToSaveIn;
	TmpWCHAR LibraryName;
	PyObject *obLibraryName;
	LIBRARYSAVEFLAGS Flags;
	IShellItem *SavedTo;
	// @pyparm <o PyIID>|FolderToSaveIn||The destination folder, shell.FOLDERID_*
	// @pyparm str|LibraryName||Filename for the new library, without file extension
	// @pyparm int|Flags||Determines behaviour if file already exists, shellcon.LSF_*
	if (!PyArg_ParseTuple(args, "O&Oi:SaveInKnownFolder",
		PyWinObject_AsIID, &FolderToSaveIn,
		&obLibraryName, &Flags))
		return NULL;
	if (!PyWinObject_AsWCHAR(obLibraryName, &LibraryName, FALSE))
		return NULL;

	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISL->SaveInKnownFolder(FolderToSaveIn, LibraryName, Flags, &SavedTo);
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISL, IID_IShellLibrary );
	return PyCom_PyObjectFromIUnknown(SavedTo, IID_IShellItem, FALSE);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:30,代码来源:PyIShellLibrary.cpp


示例16: PyErr_Clear

int PyDSOP_SCOPE_INIT_INFO::setattro(PyObject *self, PyObject *obname, PyObject *val)
{
	PyDSOP_SCOPE_INIT_INFO *p = (PyDSOP_SCOPE_INIT_INFO *)self;
	DSOP_SCOPE_INIT_INFO *pssi = p->owner->pScopes + p->index;
	char *name=PyString_AsString(obname);
	PyErr_Clear();
	if (strcmp(name, "type")==0) {
		pssi->flType = PyInt_AsLong(val);
		if (PyErr_Occurred()) return -1;
	}
	else if (strcmp(name, "scope")==0) {
		pssi->flScope = PyInt_AsLong(val);
		if (PyErr_Occurred()) return -1;
	}
	else if (strcmp(name, "scope")==0) {
		pssi->hr = PyInt_AsLong(val);
		if (PyErr_Occurred()) return -1;
	}
	else if (strcmp(name, "dcName")==0) {
		WCHAR *buf;
		if (!PyWinObject_AsWCHAR(val, &buf, TRUE))
			return -1;
		PyWinObject_FreeWCHAR((WCHAR *)pssi->pwzDcName);
		pssi->pwzDcName = buf;
	}
	else if (strcmp(name, "filterFlags")==0) {
		PyErr_SetString(PyExc_AttributeError, "filterFlags attribute can not be set (try setting attributes on the object itself)");
		return -1;
	}
	else {
		return PyObject_GenericSetAttr(self, obname, val);
	}
	return 0;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:34,代码来源:PyDSOPObjects.cpp


示例17: PyADSI_MakeNames

// Helpers for passing arrays of Unicode around.
BOOL PyADSI_MakeNames(PyObject *obNames, WCHAR ***names, DWORD *pcnames)
{
	if (!PySequence_Check(obNames)) {
		PyErr_SetString(PyExc_TypeError, "names must be a sequence of strings");
		return FALSE;
	}
	*names = NULL;
	int cnames = PySequence_Length(obNames);
	WCHAR **buf = (WCHAR **)malloc(cnames * sizeof(WCHAR *));
	if (buf==NULL) {
		PyErr_NoMemory();
		return FALSE;
	}
	memset(buf, 0, cnames * sizeof(WCHAR *));
	int i=0;
	for (i=0;i<cnames;i++) {
		PyObject *ob = PySequence_GetItem(obNames, i);
		if (ob==NULL)
			goto done;
		BOOL ok = PyWinObject_AsWCHAR(ob, &buf[i], FALSE);
		Py_DECREF(ob);
		if (!ok) goto done;
	}
	*names = buf;
	*pcnames = cnames;
done:
	if (*names==NULL) {
		PyADSI_FreeNames(buf, cnames);
	}
	return (*names != NULL);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:32,代码来源:PyADSIUtil.cpp


示例18: GetI

// @pymethod |PyIShellIconOverlayManager|GetReservedOverlayInfo|Description of GetReservedOverlayInfo.
PyObject *PyIShellIconOverlayManager::GetReservedOverlayInfo(PyObject *self, PyObject *args)
{
	IShellIconOverlayManager *pISIOM = GetI(self);
	if ( pISIOM == NULL )
		return NULL;
	// @pyparm str|path||Description for path
	// @pyparm int|attrib||Description for attrib
	// @pyparm int|flags||Description for flags
	// @pyparm int|ireservedID||Description for ireservedID
	PyObject *obpath;
	TmpWCHAR path;
	DWORD attrib;
	int index;
	DWORD flags;
	int ireservedID;
	if ( !PyArg_ParseTuple(args, "Olli:GetReservedOverlayInfo", &obpath, &attrib, &flags, &ireservedID) )
		return NULL;
	if (!PyWinObject_AsWCHAR(obpath, &path))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISIOM->GetReservedOverlayInfo( path, attrib, &index, flags, ireservedID );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISIOM, IID_IShellIconOverlayManager );

	return PyInt_FromLong(index);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:30,代码来源:PyIShellIconOverlayManager.cpp


示例19: GetI

// @pymethod int|PyIActiveScriptSite|GetItemInfo|
PyObject *PyIActiveScriptSite::GetItemInfo(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	PyObject *obName;
	int mask;
	IActiveScriptSite *pMySite = GetI(self);
	if (pMySite==NULL) return NULL;
	if (!PyArg_ParseTuple(args, "Oi:GetItemInfo", &obName, &mask))
		return NULL;
	OLECHAR *name;
	if (!PyWinObject_AsWCHAR(obName, &name))
		return NULL;
	IUnknown *punk = NULL;
	ITypeInfo *ptype = NULL;

	PY_INTERFACE_PRECALL;
	SCODE sc = pMySite->GetItemInfo(name, mask, &punk, &ptype);
	PY_INTERFACE_POSTCALL;
	PyWinObject_FreeWCHAR(name);
	if (FAILED(sc))
		return SetPythonCOMError(self, sc);
	PyObject *obDispatch = PyCom_PyObjectFromIUnknown(punk, IID_IUnknown);
	PyObject *obType = PyCom_PyObjectFromIUnknown(ptype, IID_ITypeInfo);
	PyObject *rc = NULL;
	if (obDispatch && obType)
		rc = Py_BuildValue("OO", obDispatch, obType);
	Py_XDECREF(obDispatch);
	Py_XDECREF(obType);
	return rc;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:31,代码来源:PyIActiveScriptSite.cpp


示例20: PyADSIObject_AsTypedValue

BOOL PyADSIObject_AsTypedValue(PyObject *val, ADSVALUE &v)
{
	BOOL ok = TRUE;
	switch (v.dwType) {
		// OK - get lazy - we know its a union!
		case ADSTYPE_DN_STRING:
		case ADSTYPE_CASE_EXACT_STRING:
		case ADSTYPE_CASE_IGNORE_STRING:
		case ADSTYPE_PRINTABLE_STRING:
		case ADSTYPE_NUMERIC_STRING:
		case ADSTYPE_OBJECT_CLASS:
			ok = PyWinObject_AsWCHAR(val, &v.DNString, FALSE);
			break;
		case ADSTYPE_BOOLEAN:
			v.Boolean = PyInt_AsLong(val);
			break;
		case ADSTYPE_INTEGER:
			v.Integer = PyInt_AsLong(val);
			break;
		case ADSTYPE_UTC_TIME:
			ok = PyWinObject_AsSYSTEMTIME(val, &v.UTCTime);
			break;
		case ADSTYPE_LARGE_INTEGER:
			ok = PyWinObject_AsLARGE_INTEGER(val, &v.LargeInteger);
			break;
		default:
			PyErr_SetString(PyExc_TypeError, "Cant convert to this type");
			return FALSE;
	}
	return ok;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:31,代码来源:PyADSIUtil.cpp



注:本文中的PyWinObject_AsWCHAR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PyXBMCGUILock函数代码示例发布时间:2022-05-30
下一篇:
C++ PyVarObject_HEAD_INIT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap