我试图使用pywin32和pythonnet python库中的变量(pythoncom.VT_VARIANT | pythoncom.VT_BYREF,value),但没有成功
以下是COM函数的语法:
object.ExtendedGetSourceName(int iSource, VARIANT* ovSourceName) as Boolean
与:
object: a COM object
iSource: index of the source (starting from 0)
ovSourceName: name of the source
ovSourceName获取返回值
import win32com.client
import pythoncom
xmpmapPath = r"C:\LM.Irradiance.1.xmp"
XMPViewer = win32com.client.Dispatch("XMPViewer.Application") # START INSTANCE
XMPViewer.OpenFile(xmpmapPath)# Opens XMP file
iNbSource = XMPViewer.ExtendedGetNbSource #Returns the number of sources
for sourceindex in range(0, iNbSource):
sSourceName = win32com.client.VARIANT(pythoncom.VT_VARIANT | pythoncom.VT_BYREF, 1)
RetVal = XMPViewer.ExtendedGetSourceName(sourceindex, sSourceName) #Returns TRUE if the call has succeeded, FALSE otherwise.
print(str(RetVal))
print(str(sSourceName))
Visual Studio代码返回
True
win32com.client.VARIANT(16396, 1)
您知道如何生成COM变量指针,然后用Python返回它吗
目前没有回答
相关问题 更多 >
编程相关推荐