Dim WApp as New Winx32Lib.Winx32App ' Get an instance of Winx32App
WApp.ShowDemoBox("This is a demo box") ' Call the client ShowDemoBox()
From Python I try the following which starts the client application and
then timesout with the following error msg:
>>> import win32com.client
>>> MyCLSID = '{1A762221-D8BA-11CF-AFC2-508201C10000}'
>>> WApp = win32com.client.Dispatch(MyCLSID)
Traceback (innermost last):
File "<interactive input>", line 1, in ?
File "D:\Python\win32com\client\__init__.py", line 94, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName
(dispatch,userName,clsctx)
File "D:\Python\win32com\client\dynamic.py", line 66, in
_GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "D:\Python\win32com\client\dynamic.py", line 57, in
_GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2146959355, 'Server execution failed', None, None)
>>>
Any help would be appreciated
Samuel W. Schulenburg
Sent via Deja.com http://www.deja.com/
Before you buy.
Let me know if changing this works...
Mark.
"Sam Schulenburg" <sams...@pacbell.net> wrote in message
news:8dqver$l4v$1...@nnrp1.deja.com...
if (ex.Start(dx)) then
While ex.GetParam(EXP_RUNNING,bRes)
DoEvents 'Wait for detector to finish
Wend
dx.GetFrame 1, theFrame 'Retreive one image
end if
'===============================================
In Python I have the equivalent:
from PrincetonInst import * # Get the renamed Makepy file for the
# COM object
theFrame = [] # Set up the Varient
dx = DocFile() # Get the DocFile class
ex = win32com.client.Dispatch(ExpSetup.CLSID)
bRes = 0
if (ex.Start(dx)) then # Start detector scanning for data
While ex.GetParam(EXP_RUNNING,bRes): # Detector is scanning
## DoEvents # Wait for detector to finish, This has no
# equivalent in Pythonwin
s = 1 # This gives the while loop something to do
#### This is where everything falls apart
#### theFrame is not the correct datatype
dx.GetFrame(1,theFrame) # Retreive one image
How do I define the correct Varient type in Python?
Sam Schulenburg
> ## DoEvents # Wait for detector to finish, This has no
> # equivalent in Pythonwin
Actually, you _may_ need to call pythoncom.PumpWaitingMessages() here (and
it can never really hurt :-)
> s = 1 # This gives the while loop something to do
> #### This is where everything falls apart
> #### theFrame is not the correct datatype
> dx.GetFrame(1,theFrame) # Retreive one image
>
> How do I define the correct Varient type in Python?
You shouldnt need to.
Try saying:
theFrame = dx.GetFrame(1)
[Or try passing None as the second param]
And magically it should all work. If it doesnt, look into running
"makepy" over your object and try again. If it still doesnt work, post
the code makepy generated for the GetFrame() method and the specific
traceback you see...
Mark.