Skip to content

Commit

Permalink
Docs: add explanation about COM model to how to
Browse files Browse the repository at this point in the history
  • Loading branch information
airelil committed Jan 2, 2019
1 parent 020193e commit 0840701
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/HowTo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,26 @@ e.g.
# Select an item in the popup menu
outlook.PopupMenu.Menu().get_menu_path("Cancel Server Request")[0].click()



COM Model
------------------------------------------------------------------------------------
By default, pywinauto sets up the client Multithreading COM model (MTA) on init if
no other model was defined prior to import of pywinauto. The model can be set up by
another imported module implicitly or specified explicitly through ```sys.coinit_flags```

Example for settinpu single threaded appartment model explicitly.

::

import sys
sys.coinit_flags = 2 # COINIT_APARTMENTTHREADED

import pywinauto


Notice that final value is assigned back to sys.coinit_flags. This is to avoid conflicts with
other modules. Possible values for sys.coint_flags:
0 - Multi-Threaded Apartment model (MTA)
2 - Single-Threaded Apartments model (STA)

0 comments on commit 0840701

Please sign in to comment.