alan_copeland | 17 Jan 22:28 2008

Should I manually unload the dll when I am done?

Does comtypes automatically handle Object cleanup when the code goes out of scope? Or is there some command that I should send to release the Object/.dll?

 

comtypes has saved the day…. Thanks for your hard work!

 

 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
comtypes-users mailing list
comtypes-users@...
https://lists.sourceforge.net/lists/listinfo/comtypes-users
Thomas Heller | 18 Jan 09:18 2008

Re: Should I manually unload the dll when I am done?

alan_copeland@... schrieb:
> Does comtypes automatically handle Object cleanup when the code goes
> out of scope? Or is there some command that I should send to release
> the Object/.dll?

Unloading the server that implements the COM object is done by the COM runtime;
there is nothing special that you have to do.  Normally you do not even
know or have to care which dll/exe this is.

> comtypes has saved the day.... Thanks for your hard work!
> 
You're welcome!

Thomas

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Josh Steiner | 22 Jan 01:04 2008

embedding IWebBrowser2 into a PyGtk app

Hello,

I'm working on a PyGtk project that runs only window and I need to embed 
an ie IWebBrowser2 COM object into my app.  I found this:

http://www.daa.com.au/pipermail/pygtk/2005-June/010461.html

But that uses the ctypes.com module,  as far as I can tell comtypes 
seems to be API incompatible, so my attempts to substitute it in place 
failed. 

Is there a way to generate something like the ie6_gen.py from ctypes.com 
with comtypes?

I'm totally new to windows specific Python coding, any help or pointers 
would be greatly appreciated.

-Josh

--

-- 
________________________________________________________________
tasty electronic music vittles      --  bluevitriol.com
the only music blog you need        --  playtherecords.com
you are the dj.  interactive music  --  improbableorchestra.com
random observations of the bizarre  --  vitriolix.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Thomas Heller | 23 Jan 19:38 2008

Re: embedding IWebBrowser2 into a PyGtk app

Josh Steiner schrieb:
> Hello,
> 
> I'm working on a PyGtk project that runs only window and I need to embed 
> an ie IWebBrowser2 COM object into my app.  I found this:
> 
> http://www.daa.com.au/pipermail/pygtk/2005-June/010461.html
> 
> But that uses the ctypes.com module,  as far as I can tell comtypes 
> seems to be API incompatible, so my attempts to substitute it in place 
> failed. 
> 
> Is there a way to generate something like the ie6_gen.py from ctypes.com 
> with comtypes?
> 
> I'm totally new to windows specific Python coding, any help or pointers 
> would be greatly appreciated.

Usually, comtypes generates the wrappers automatically on demand.  The attached
script works for me; the needed magic is done by the (awfully named)
comtypes.client.wrap function.  This function queries the com object for the default
interface, which is IWebBrowser2 in this case.

On the other hand, if you want to generate the module 'manually', you do this by
calling comtypes.client.GetModule(<typelib-name>).  <typelib-name> for internet
explorer is "shdocvw.dll", the module is generated in the comtypes.gen package, in
this case as comtypes.gen.SHDocVw module.

Thomas

Attachment (ie_in_gtk.py): application/x-python, 6720 bytes
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
comtypes-users mailing list
comtypes-users@...
https://lists.sourceforge.net/lists/listinfo/comtypes-users
Josh Steiner | 23 Jan 21:46 2008

Re: embedding IWebBrowser2 into a PyGtk app

Thomas Heller wrote:
> Usually, comtypes generates the wrappers automatically on demand.  The attached
> script works for me; the needed magic is done by the (awfully named)
> comtypes.client.wrap function.  This function queries the com object for the default
> interface, which is IWebBrowser2 in this case.
>   

Great!  Thanks, Thomas, works perfectly. 

> On the other hand, if you want to generate the module 'manually', you do this by
> calling comtypes.client.GetModule(<typelib-name>).  <typelib-name> for internet
> explorer is "shdocvw.dll", the module is generated in the comtypes.gen package, in
> this case as comtypes.gen.SHDocVw module.
>   

Ahh, that makes sense.  I'll dig through there and take a look. 

Thanks again.

-Josh

--

-- 
________________________________________________________________
tasty electronic music vittles      --  bluevitriol.com
the only music blog you need        --  playtherecords.com
you are the dj.  interactive music  --  improbableorchestra.com
random observations of the bizarre  --  vitriolix.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Suraj Barkale | 30 Jan 19:41 2008

Strange error while creating Lotus.NotesSesstion [Probably OT]

Hi All,
    I restarted writing a script for Lotus Notes after a gap of 1/2
weeks and found that I can no longer create a Lotus.NotesSession
object! I cleaned up the comtypes/gen directory to no avail. The
strange thing is that I get a different error message for the first
time I try CreateObject('Lotus.NotesSession'). I am suspecting that
this problem has nothing to do with comtypes. However I am putting
this on the mailing list to get some info about the underlying problem
from the lurking experts. Thanks for your attention :) Here is a trial
session in IDLE:
----------------------------------------------------------------------------------------------------------------------------
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
IDLE 1.2.1
>>> import comtypes.client
>>> lns = comtypes.client.CreateObject('Lotus.NotesSession')

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    lns = comtypes.client.CreateObject('Lotus.NotesSession')
  File "C:\Python25\Lib\site-packages\comtypes\client\__init__.py",
line 198, in CreateObject
    obj = comtypes.CoCreateInstance(clsid, clsctx=clsctx, interface=interface)
  File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 931,
in CoCreateInstance
    _ole32.CoCreateInstance(byref(clsid), punkouter, clsctx,
byref(iid), byref(p))
WindowsError: exception code 0xe06d7363
>>> lns = comtypes.client.CreateObject('Lotus.NotesSession')

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    lns = comtypes.client.CreateObject('Lotus.NotesSession')
  File "C:\Python25\Lib\site-packages\comtypes\client\__init__.py",
line 198, in CreateObject
    obj = comtypes.CoCreateInstance(clsid, clsctx=clsctx, interface=interface)
  File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 931,
in CoCreateInstance
    _ole32.CoCreateInstance(byref(clsid), punkouter, clsctx,
byref(iid), byref(p))
  File "\loewis\25\python\Modules\_ctypes\callproc.c", line 754, in GetResult
WindowsError: [Error -2147024882] Not enough storage is available to
complete this operation
>>> ea = comtypes.client.CreateObject('Excel.Application')
# Generating comtypes.gen._00020813_0000_0000_C000_000000000046_0_1_4
# Generating comtypes.gen._2DF8D04C_5BFA_101B_BDE5_00AA0044DE52_0_2_2
# Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
# Generating comtypes.gen.stdole
# Generating comtypes.gen.Office
# Generating comtypes.gen._0002E157_0000_0000_C000_000000000046_0_5_3
# Generating comtypes.gen._2DF8D04C_5BFA_101B_BDE5_00AA0044DE52_0_2_4
# Generating comtypes.gen.VBIDE
# Generating comtypes.gen.Excel
>>> ea.Quit()
0
>>>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane