=== modified file 'source/NVDAObjects/IAccessible/sysListView32.py'
--- source/NVDAObjects/IAccessible/sysListView32.py	2010-10-11 06:42:53 +0000
+++ source/NVDAObjects/IAccessible/sysListView32.py	2011-09-24 12:58:33 +0000
@@ -16,6 +16,7 @@
 import winUser
 from . import IAccessible, List
 from ..window import Window 
+import watchdog
 
 #Window messages
 LVM_FIRST=0x1000
@@ -111,7 +112,7 @@
 	localInfo.stateMask=0xffffffff
 	remoteInfo=winKernel.virtualAllocEx(processHandle,None,sizeof(LVGROUP),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 	winKernel.writeProcessMemory(processHandle,remoteInfo,byref(localInfo),sizeof(LVGROUP),None)
-	messageRes=winUser.sendMessage(windowHandle,LVM_GETGROUPINFOBYINDEX,groupIndex,remoteInfo)
+	messageRes=watchdog.cancellableSendMessage(windowHandle,LVM_GETGROUPINFOBYINDEX,groupIndex,remoteInfo)
 	winKernel.readProcessMemory(processHandle,remoteInfo,byref(localInfo),sizeof(LVGROUP),None)
 	winKernel.virtualFreeEx(processHandle,remoteInfo,0,winKernel.MEM_RELEASE)
 	localHeader=create_unicode_buffer(localInfo.cchHeader)
@@ -136,7 +137,7 @@
 		#See if this object is the focus and the focus is on a group item.
 		#if so, then morph this object to a groupingItem object
 		if self is api.getFocusObject():
-			groupIndex=winUser.sendMessage(self.windowHandle,LVM_GETFOCUSEDGROUP,0,0)
+			groupIndex=watchdog.cancellableSendMessage(self.windowHandle,LVM_GETFOCUSEDGROUP,0,0)
 			if groupIndex>=0:
 				info=getListGroupInfo(self.windowHandle,groupIndex)
 				if info is not None:
@@ -201,7 +202,7 @@
 		processHandle=self.processHandle
 		internalItem=winKernel.virtualAllocEx(processHandle,None,sizeof(LVItemStruct),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 		winKernel.writeProcessMemory(processHandle,internalItem,byref(item),sizeof(LVItemStruct),None)
-		winUser.sendMessage(self.windowHandle,LVM_GETITEM,0,internalItem)
+		watchdog.cancellableSendMessage(self.windowHandle,LVM_GETITEM,0,internalItem)
 		dispInfo=NMLVDispInfoStruct()
 		dispInfo.item=internalItem
 		dispInfo.hdr.hwndFrom=self.windowHandle
@@ -209,7 +210,7 @@
 		dispInfo.hdr.code=LVN_GETDISPINFO
 		internalDispInfo=winKernel.virtualAllocEx(processHandle,None,sizeof(NMLVDispInfoStruct),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 		winKernel.writeProcessMemory(processHandle,internalDispInfo,byref(dispInfo),sizeof(NMLVDispInfoStruct),None)
-		winUser.sendMessage(self.parent.parent.windowHandle,winUser.WM_NOTIFY,LVN_GETDISPINFO,internalDispInfo)
+		watchdog.cancellableSendMessage(self.parent.parent.windowHandle,winUser.WM_NOTIFY,LVN_GETDISPINFO,internalDispInfo)
 		winKernel.virtualFreeEx(processHandle,internalDispInfo,0,winKernel.MEM_RELEASE)
 		winKernel.readProcessMemory(processHandle,internalItem,byref(item),sizeof(LVItemStruct),None)
 		winKernel.virtualFreeEx(processHandle,internalItem,0,winKernel.MEM_RELEASE)
@@ -231,7 +232,7 @@
 
 	def _get_positionInfo(self):
 		index=self.IAccessibleChildID
-		totalCount=winUser.sendMessage(self.windowHandle,LVM_GETITEMCOUNT,0,0)
+		totalCount=watchdog.cancellableSendMessage(self.windowHandle,LVM_GETITEMCOUNT,0,0)
 		return dict(indexInGroup=index,similarItemsInGroup=totalCount) 
 
 	def event_stateChange(self):

=== modified file 'source/NVDAObjects/IAccessible/sysTreeView32.py'
--- source/NVDAObjects/IAccessible/sysTreeView32.py	2010-05-20 23:21:44 +0000
+++ source/NVDAObjects/IAccessible/sysTreeView32.py	2011-09-24 13:07:13 +0000
@@ -8,7 +8,6 @@
 from ctypes.wintypes import *
 import api
 import winKernel
-import winUser
 import controlTypes
 import speech
 import UIAHandler
@@ -16,6 +15,7 @@
 if UIAHandler.isUIAAvailable: from ..UIA import UIA
 from .. import NVDAObject
 from logHandler import log
+import watchdog
 
 TV_FIRST=0x1100
 TVIS_STATEIMAGEMASK=0xf000
@@ -67,7 +67,7 @@
 
 	def _get_treeview_hItem(self):
 		if not hasattr(self,'_treeview_hItem'):
-			self._treeview_hItem=winUser.sendMessage(self.windowHandle,TVM_MAPACCIDTOHTREEITEM,self.IAccessibleChildID,0)
+			self._treeview_hItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_MAPACCIDTOHTREEITEM,self.IAccessibleChildID,0)
 			if not self._treeview_hItem:
 				# Tree views from comctl < 6.0 use the hItem as the child ID.
 				self._treeview_hItem=self.IAccessibleChildID
@@ -79,7 +79,7 @@
 	def _get_states(self):
 		states=super(TreeViewItem,self)._get_states()
 		hItem=self.treeview_hItem
-		itemStates=winUser.sendMessage(self.windowHandle,TVM_GETITEMSTATE,hItem,TVIS_STATEIMAGEMASK)
+		itemStates=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETITEMSTATE,hItem,TVIS_STATEIMAGEMASK)
 		ch=(itemStates>>12)&3
 		if ch>0:
 			states.add(controlTypes.STATE_CHECKABLE)
@@ -98,10 +98,10 @@
 		hItem=self.treeview_hItem
 		if not hItem:
 			return super(TreeViewItem,self)._get_parent()
-		parentItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_PARENT,hItem)
+		parentItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_PARENT,hItem)
 		if parentItem<=0:
 			return super(TreeViewItem,self)._get_parent()
-		newID=winUser.sendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,parentItem,0)
+		newID=watchdog.cancellableSendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,parentItem,0)
 		if not newID:
 			# Tree views from comctl < 6.0 use the hItem as the child ID.
 			newID=parentItem
@@ -113,10 +113,10 @@
 		hItem=self.treeview_hItem
 		if not hItem:
 			return super(TreeViewItem,self)._get_firstChild()
-		childItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_CHILD,hItem)
+		childItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_CHILD,hItem)
 		if childItem<=0:
 			return super(TreeViewItem,self)._get_firstChild()
-		newID=winUser.sendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,childItem,0)
+		newID=watchdog.cancellableSendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,childItem,0)
 		if not newID:
 			# Tree views from comctl < 6.0 use the hItem as the child ID.
 			newID=childItem
@@ -128,10 +128,10 @@
 		hItem=self.treeview_hItem
 		if not hItem:
 			return None
-		nextItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_NEXT,hItem)
+		nextItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_NEXT,hItem)
 		if nextItem<=0:
 			return None
-		newID=winUser.sendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,nextItem,0)
+		newID=watchdog.cancellableSendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,nextItem,0)
 		if not newID:
 			# Tree views from comctl < 6.0 use the hItem as the child ID.
 			newID=nextItem
@@ -143,10 +143,10 @@
 		hItem=self.treeview_hItem
 		if not hItem:
 			return None
-		prevItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_PREVIOUS,hItem)
+		prevItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_PREVIOUS,hItem)
 		if prevItem<=0:
 			return None
-		newID=winUser.sendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,prevItem,0)
+		newID=watchdog.cancellableSendMessage(self.windowHandle,TVM_MAPHTREEITEMTOACCID,prevItem,0)
 		if not newID:
 			# Tree views from comctl < 6.0 use the hItem as the child ID.
 			newID=prevItem
@@ -164,13 +164,13 @@
 		hItem=self.treeview_hItem
 		if not hItem:
 			return 0
-		childItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_CHILD,hItem)
+		childItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_CHILD,hItem)
 		if childItem<=0:
 			return 0
 		numItems=0
 		while childItem>0:
 			numItems+=1
-			childItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_NEXT,childItem)
+			childItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_NEXT,childItem)
 		return numItems
 
 	def _get_positionInfo(self):
@@ -185,12 +185,12 @@
 		index=0
 		while newItem>0:
 			index+=1
-			newItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_PREVIOUS,newItem)
+			newItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_PREVIOUS,newItem)
 		newItem=hItem
 		numItems=index-1
 		while newItem>0:
 			numItems+=1
-			newItem=winUser.sendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_NEXT,newItem)
+			newItem=watchdog.cancellableSendMessage(self.windowHandle,TVM_GETNEXTITEM,TVGN_NEXT,newItem)
 		info['indexInGroup']=index
 		info['similarItemsInGroup']=numItems
 		return info

=== modified file 'source/NVDAObjects/window/__init__.py'
--- source/NVDAObjects/window/__init__.py	2011-06-06 07:43:30 +0000
+++ source/NVDAObjects/window/__init__.py	2011-09-24 13:11:41 +0000
@@ -16,6 +16,7 @@
 import eventHandler
 from NVDAObjects import NVDAObject
 from NVDAObjects.behaviors import EditableText, LiveText
+import watchdog
 
 re_WindowsForms=re.compile(r'^WindowsForms[0-9]*\.(.*)\.app\..*$')
 re_ATL=re.compile(r'^ATL:(.*)$')
@@ -201,9 +202,9 @@
 			winUser.RDW_INVALIDATE | winUser.RDW_UPDATENOW)
 
 	def _get_windowText(self):
-		textLength=winUser.sendMessage(self.windowHandle,winUser.WM_GETTEXTLENGTH,0,0)
+		textLength=watchdog.cancellableSendMessage(self.windowHandle,winUser.WM_GETTEXTLENGTH,0,0)
 		textBuf=ctypes.create_unicode_buffer(textLength+2)
-		winUser.sendMessage(self.windowHandle,winUser.WM_GETTEXT,textLength+1,textBuf)
+		watchdog.cancellableSendMessage(self.windowHandle,winUser.WM_GETTEXT,textLength+1,textBuf)
 		return textBuf.value
 
 	def _get_processID(self):

=== modified file 'source/NVDAObjects/window/akelEdit.py'
--- source/NVDAObjects/window/akelEdit.py	2011-05-22 14:50:08 +0000
+++ source/NVDAObjects/window/akelEdit.py	2011-09-24 13:15:32 +0000
@@ -7,6 +7,7 @@
 import winUser
 import winKernel
 import ctypes
+import watchdog
 
 # Messages
 AEM_GETINDEX          =(winUser.WM_USER + 2106)
@@ -52,7 +53,7 @@
 		ciChar=AECHARINDEX()
 		processHandle=self.obj.processHandle
 		internalCiChar=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(ciChar),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
-		winUser.sendMessage(self.obj.windowHandle,AEM_RICHOFFSETTOINDEX,offset,internalCiChar)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,AEM_RICHOFFSETTOINDEX,offset,internalCiChar)
 		winKernel.readProcessMemory(processHandle,internalCiChar,ctypes.byref(ciChar),ctypes.sizeof(ciChar),None)
 		winKernel.virtualFreeEx(processHandle,internalCiChar,0,winKernel.MEM_RELEASE)
 		return ciChar.nLine
@@ -61,8 +62,8 @@
 		ciChar=AECHARINDEX()
 		processHandle=self.obj.processHandle
 		internalCiChar=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(ciChar),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
-		winUser.sendMessage(self.obj.windowHandle,AEM_GETINDEX,AEGI_LASTCHAR,internalCiChar)
-		end=winUser.sendMessage(self.obj.windowHandle,AEM_INDEXTORICHOFFSET,0,internalCiChar)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,AEM_GETINDEX,AEGI_LASTCHAR,internalCiChar)
+		end=watchdog.cancellableSendMessage(self.obj.windowHandle,AEM_INDEXTORICHOFFSET,0,internalCiChar)
 		winKernel.virtualFreeEx(processHandle,internalCiChar,0,winKernel.MEM_RELEASE)
 		return end+1
 
@@ -73,9 +74,9 @@
 		ciChar=AECHARINDEX()
 		processHandle=self.obj.processHandle
 		internalCiChar=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(ciChar),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
-		winUser.sendMessage(self.obj.windowHandle,AEM_RICHOFFSETTOINDEX,offset,internalCiChar)
-		winUser.sendMessage(self.obj.windowHandle,AEM_GETINDEX,AEGI_NEXTLINE,internalCiChar)
-		end=winUser.sendMessage(self.obj.windowHandle,AEM_INDEXTORICHOFFSET,0,internalCiChar)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,AEM_RICHOFFSETTOINDEX,offset,internalCiChar)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,AEM_GETINDEX,AEGI_NEXTLINE,internalCiChar)
+		end=watchdog.cancellableSendMessage(self.obj.windowHandle,AEM_INDEXTORICHOFFSET,0,internalCiChar)
 		winKernel.virtualFreeEx(processHandle,internalCiChar,0,winKernel.MEM_RELEASE)
 		return (start,end)
 
@@ -96,7 +97,7 @@
 			self.bindGesture(gesture, "caret_moveByLine")
 
 	def _getControlVersion(self):
-		res=winUser.sendMessage(self.windowHandle,AEM_CONTROLVERSION,None,None)
+		res=watchdog.cancellableSendMessage(self.windowHandle,AEM_CONTROLVERSION,None,None)
 		major=winUser.LOBYTE(winUser.LOWORD(res))
 		minor=winUser.HIBYTE(winUser.LOWORD(res))
 		version=major+(0.1*minor)

=== modified file 'source/NVDAObjects/window/edit.py'
--- source/NVDAObjects/window/edit.py	2011-06-23 01:12:48 +0000
+++ source/NVDAObjects/window/edit.py	2011-09-24 13:26:09 +0000
@@ -30,6 +30,7 @@
 from .. import NVDAObjectTextInfo
 from ..behaviors import EditableTextWithAutoSelectDetection
 import braille
+import watchdog
 
 selOffsetsAtLastCaretEvent=None
 
@@ -173,12 +174,12 @@
 			internalP=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(PointLStruct),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 			p=PointLStruct(0,0)
 			winKernel.writeProcessMemory(processHandle,internalP,ctypes.byref(p),ctypes.sizeof(p),None)
-			winUser.sendMessage(self.obj.windowHandle,EM_POSFROMCHAR,internalP,offset)
+			watchdog.cancellableSendMessage(self.obj.windowHandle,EM_POSFROMCHAR,internalP,offset)
 			winKernel.readProcessMemory(processHandle,internalP,ctypes.byref(p),ctypes.sizeof(p),None)
 			winKernel.virtualFreeEx(processHandle,internalP,0,winKernel.MEM_RELEASE)
 			point=textInfos.Point(p.x,p.y)
 		else:
-			res=winUser.sendMessage(self.obj.windowHandle,EM_POSFROMCHAR,offset,None)
+			res=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_POSFROMCHAR,offset,None)
 			point=textInfos.Point(winUser.LOWORD(res),winUser.HIWORD(res))
 		(left,top,width,height)=self.obj.location
 		if point.x and point.y:
@@ -195,11 +196,11 @@
 			internalP=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(PointLStruct),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 			p=PointLStruct(x-left,y-top)
 			winKernel.writeProcessMemory(processHandle,internalP,ctypes.byref(p),ctypes.sizeof(p),None)
-			offset=winUser.sendMessage(self.obj.windowHandle,EM_CHARFROMPOS,0,internalP)
+			offset=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_CHARFROMPOS,0,internalP)
 			winKernel.virtualFreeEx(processHandle,internalP,0,winKernel.MEM_RELEASE)
 		else:
 			p=(x-left)+((y-top)<<16)
-			offset=winUser.sendMessage(self.obj.windowHandle,EM_CHARFROMPOS,0,p)&0xffff
+			offset=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_CHARFROMPOS,0,p)&0xffff
 		return offset
 
 	def _getCharFormat(self,offset):
@@ -215,7 +216,7 @@
 		processHandle=self.obj.processHandle
 		internalCharFormat=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(charFormat),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 		winKernel.writeProcessMemory(processHandle,internalCharFormat,ctypes.byref(charFormat),ctypes.sizeof(charFormat),None)
-		winUser.sendMessage(self.obj.windowHandle,EM_GETCHARFORMAT,SCF_SELECTION, internalCharFormat)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,EM_GETCHARFORMAT,SCF_SELECTION, internalCharFormat)
 		winKernel.readProcessMemory(processHandle,internalCharFormat,ctypes.byref(charFormat),ctypes.sizeof(charFormat),None)
 		winKernel.virtualFreeEx(processHandle,internalCharFormat,0,winKernel.MEM_RELEASE)
 		if oldSel!=(offset,offset+1):
@@ -264,14 +265,14 @@
 			charRange=CharRangeStruct()
 			processHandle=self.obj.processHandle
 			internalCharRange=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(charRange),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
-			winUser.sendMessage(self.obj.windowHandle,EM_EXGETSEL,0, internalCharRange)
+			watchdog.cancellableSendMessage(self.obj.windowHandle,EM_EXGETSEL,0, internalCharRange)
 			winKernel.readProcessMemory(processHandle,internalCharRange,ctypes.byref(charRange),ctypes.sizeof(charRange),None)
 			winKernel.virtualFreeEx(processHandle,internalCharRange,0,winKernel.MEM_RELEASE)
 			return (charRange.cpMin,charRange.cpMax)
 		else:
 			start=ctypes.c_uint()
 			end=ctypes.c_uint()
-			res=winUser.sendMessage(self.obj.windowHandle,EM_GETSEL,ctypes.byref(start),ctypes.byref(end))
+			res=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_GETSEL,ctypes.byref(start),ctypes.byref(end))
 			return start.value,end.value
 
 	def _setSelectionOffsets(self,start,end):
@@ -282,12 +283,12 @@
 			processHandle=self.obj.processHandle
 			internalCharRange=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(charRange),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 			winKernel.writeProcessMemory(processHandle,internalCharRange,ctypes.byref(charRange),ctypes.sizeof(charRange),None)
-			winUser.sendMessage(self.obj.windowHandle,EM_EXSETSEL,0, internalCharRange)
+			watchdog.cancellableSendMessage(self.obj.windowHandle,EM_EXSETSEL,0, internalCharRange)
 			winKernel.virtualFreeEx(processHandle,internalCharRange,0,winKernel.MEM_RELEASE)
 		else:
-			winUser.sendMessage(self.obj.windowHandle,EM_SETSEL,start,end)
+			watchdog.cancellableSendMessage(self.obj.windowHandle,EM_SETSEL,start,end)
 		#Make sure the Window is always scrolled to the caret
-		winUser.sendMessage(self.obj.windowHandle,EM_SCROLLCARET,0,0)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,EM_SCROLLCARET,0,0)
 
 	def _getCaretOffset(self):
 		return self._getSelectionOffsets()[0]
@@ -311,14 +312,14 @@
 			processHandle=self.obj.processHandle
 			internalInfo=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(info),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 			winKernel.writeProcessMemory(processHandle,internalInfo,ctypes.byref(info),ctypes.sizeof(info),None)
-			textLen=winUser.sendMessage(self.obj.windowHandle,EM_GETTEXTLENGTHEX,internalInfo,0)
+			textLen=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_GETTEXTLENGTHEX,internalInfo,0)
 			winKernel.virtualFreeEx(processHandle,internalInfo,0,winKernel.MEM_RELEASE)
 			return textLen+1
 		else:
-			return winUser.sendMessage(self.obj.windowHandle,winUser.WM_GETTEXTLENGTH,0,0)+1
+			return watchdog.cancellableSendMessage(self.obj.windowHandle,winUser.WM_GETTEXTLENGTH,0,0)+1
 
 	def _getLineCount(self):
-		return winUser.sendMessage(self.obj.windowHandle,EM_GETLINECOUNT,0,0)
+		return watchdog.cancellableSendMessage(self.obj.windowHandle,EM_GETLINECOUNT,0,0)
 
 	def _getTextRange(self,start,end):
 		if self.obj.editAPIVersion>=2:
@@ -334,7 +335,7 @@
 			textRange.lpstrText=internalBuf
 			internalTextRange=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(textRange),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 			winKernel.writeProcessMemory(processHandle,internalTextRange,ctypes.byref(textRange),ctypes.sizeof(textRange),None)
-			res=winUser.sendMessage(self.obj.windowHandle,EM_GETTEXTRANGE,0,internalTextRange)
+			res=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_GETTEXTRANGE,0,internalTextRange)
 			winKernel.virtualFreeEx(processHandle,internalTextRange,0,winKernel.MEM_RELEASE)
 			buf=(ctypes.c_byte*bufLen)()
 			winKernel.readProcessMemory(processHandle,internalBuf,buf,bufLen,None)
@@ -348,11 +349,11 @@
 
 	def _getWordOffsets(self,offset):
 		if self.obj.editAPIVersion>=2:
-			start=winUser.sendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDLEFT,offset)
-			end=winUser.sendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDRIGHT,start)
+			start=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDLEFT,offset)
+			end=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDRIGHT,start)
 			if end<=offset:
 				start=end
-				end=winUser.sendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDRIGHT,offset)
+				end=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDRIGHT,offset)
 			return (start,end)
 		elif sys.getwindowsversion().major<6: #Implementation of standard edit field wordbreak behaviour (only breaks on space)
 			lineStart,lineEnd=self._getLineOffsets(offset)
@@ -394,15 +395,15 @@
 
 	def _getLineNumFromOffset(self,offset):
 		if self.obj.editAPIVersion>=1:
-			res=winUser.sendMessage(self.obj.windowHandle,EM_EXLINEFROMCHAR,0,offset)
+			res=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_EXLINEFROMCHAR,0,offset)
 			return res
 		else:
-			return winUser.sendMessage(self.obj.windowHandle,EM_LINEFROMCHAR,offset,0)
+			return watchdog.cancellableSendMessage(self.obj.windowHandle,EM_LINEFROMCHAR,offset,0)
 
 	def _getLineOffsets(self,offset):
 		lineNum=self._getLineNumFromOffset(offset)
-		start=winUser.sendMessage(self.obj.windowHandle,EM_LINEINDEX,lineNum,0)
-		length=winUser.sendMessage(self.obj.windowHandle,EM_LINELENGTH,offset,0)
+		start=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_LINEINDEX,lineNum,0)
+		length=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_LINELENGTH,offset,0)
 		end=start+length
 		#If we just seem to get invalid line info, calculate manually
 		if start<=0 and end<=0 and lineNum<=0 and self._getLineCount()<=0 and self._getStoryLength()>0:
@@ -462,7 +463,7 @@
 		processHandle=self.obj.processHandle
 		internalCharFormat=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(charFormat),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 		winKernel.writeProcessMemory(processHandle,internalCharFormat,ctypes.byref(charFormat),ctypes.sizeof(charFormat),None)
-		winUser.sendMessage(self.obj.windowHandle,EM_GETCHARFORMAT,SCF_SELECTION, internalCharFormat)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,EM_GETCHARFORMAT,SCF_SELECTION, internalCharFormat)
 		winKernel.readProcessMemory(processHandle,internalCharFormat,ctypes.byref(charFormat),ctypes.sizeof(charFormat),None)
 		winKernel.virtualFreeEx(processHandle,internalCharFormat,0,winKernel.MEM_RELEASE)
 		if not (oldSel.start==range.start and oldSel.end==range.end):

=== modified file 'source/NVDAObjects/window/scintilla.py'
--- source/NVDAObjects/window/scintilla.py	2010-08-06 02:40:05 +0000
+++ source/NVDAObjects/window/scintilla.py	2011-09-24 14:24:39 +0000
@@ -11,6 +11,7 @@
 from .. import NVDAObjectTextInfo
 from ..behaviors import EditableTextWithAutoSelectDetection
 import locale
+import watchdog
 
 #Window messages
 SCI_POSITIONFROMPOINT=2022
@@ -62,12 +63,12 @@
 class ScintillaTextInfo(textInfos.offsets.OffsetsTextInfo):
 
 	def _getOffsetFromPoint(self,x,y):
-		return winUser.sendMessage(self.obj.windowHandle,SCI_POSITIONFROMPOINT,x,y)
+		return watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POSITIONFROMPOINT,x,y)
 
 	def _getPointFromOffset(self,offset):
 		point=textInfos.Point(
-		winUser.sendMessage(self.obj.windowHandle,SCI_POINTXFROMPOSITION,None,offset),
-		winUser.sendMessage(self.obj.windowHandle,SCI_POINTYFROMPOSITION,None,offset)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POINTXFROMPOSITION,None,offset),
+		watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POINTYFROMPOSITION,None,offset)
 		)
 		if point.x and point.y:
 			return point
@@ -75,20 +76,20 @@
 			raise NotImplementedError
 
 	def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):
-		style=winUser.sendMessage(self.obj.windowHandle,SCI_GETSTYLEAT,offset,0)
+		style=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETSTYLEAT,offset,0)
 		if calculateOffsets:
 			#we need to manually see how far the style goes, limit to line
 			lineStart,lineEnd=self._getLineOffsets(offset)
 			startOffset=offset
 			while startOffset>lineStart:
-				curStyle=winUser.sendMessage(self.obj.windowHandle,SCI_GETSTYLEAT,startOffset-1,0)
+				curStyle=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETSTYLEAT,startOffset-1,0)
 				if curStyle==style:
 					startOffset-=1
 				else:
 					break
 			endOffset=offset+1
 			while endOffset<lineEnd:
-				curStyle=winUser.sendMessage(self.obj.windowHandle,SCI_GETSTYLEAT,endOffset,0)
+				curStyle=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETSTYLEAT,endOffset,0)
 				if curStyle==style:
 					endOffset+=1
 				else:
@@ -100,33 +101,33 @@
 			#To get font name, We need to allocate memory with in Scintilla's process, and then copy it out
 			fontNameBuf=ctypes.create_string_buffer(32)
 			internalBuf=winKernel.virtualAllocEx(self.obj.processHandle,None,len(fontNameBuf),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
-			winUser.sendMessage(self.obj.windowHandle,SCI_STYLEGETFONT,style, internalBuf)
+			watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_STYLEGETFONT,style, internalBuf)
 			winKernel.readProcessMemory(self.obj.processHandle,internalBuf,fontNameBuf,len(fontNameBuf),None)
 			winKernel.virtualFreeEx(self.obj.processHandle,internalBuf,0,winKernel.MEM_RELEASE)
 			formatField["font-name"]=fontNameBuf.value
 		if formatConfig["reportFontSize"]:
-			formatField["font-size"]="%spt"%winUser.sendMessage(self.obj.windowHandle,SCI_STYLEGETSIZE,style,0)
+			formatField["font-size"]="%spt"%watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_STYLEGETSIZE,style,0)
 		if formatConfig["reportLineNumber"]:
 			formatField["line-number"]=self._getLineNumFromOffset(offset)+1
 		if formatConfig["reportFontAttributes"]:
-			formatField["bold"]=bool(winUser.sendMessage(self.obj.windowHandle,SCI_STYLEGETBOLD,style,0))
-			formatField["italic"]=bool(winUser.sendMessage(self.obj.windowHandle,SCI_STYLEGETITALIC,style,0))
-			formatField["underline"]=bool(winUser.sendMessage(self.obj.windowHandle,SCI_STYLEGETUNDERLINE,style,0))
+			formatField["bold"]=bool(watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_STYLEGETBOLD,style,0))
+			formatField["italic"]=bool(watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_STYLEGETITALIC,style,0))
+			formatField["underline"]=bool(watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_STYLEGETUNDERLINE,style,0))
 		return formatField,(startOffset,endOffset)
 
 	def _getCaretOffset(self):
-		return winUser.sendMessage(self.obj.windowHandle,SCI_GETCURRENTPOS,0,0)
+		return watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETCURRENTPOS,0,0)
 
 	def _setCaretOffset(self,offset):
-		winUser.sendMessage(self.obj.windowHandle,SCI_GOTOPOS,offset,0)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GOTOPOS,offset,0)
 
 	def _getSelectionOffsets(self):
-		start=winUser.sendMessage(self.obj.windowHandle,SCI_GETSELECTIONSTART,0,0)
-		end=winUser.sendMessage(self.obj.windowHandle,SCI_GETSELECTIONEND,0,0)
+		start=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETSELECTIONSTART,0,0)
+		end=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETSELECTIONEND,0,0)
 		return (start,end)
 
 	def _setSelectionOffsets(self,start,end):
-		winUser.sendMessage(self.obj.windowHandle,SCI_SETSEL,start,end)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_SETSEL,start,end)
 
 	def _getStoryText(self):
 		if not hasattr(self,'_storyText'):
@@ -136,11 +137,11 @@
 
 	def _getStoryLength(self):
 		if not hasattr(self,'_storyLength'):
-			self._storyLength=winUser.sendMessage(self.obj.windowHandle,SCI_GETTEXTLENGTH,0,0)
+			self._storyLength=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETTEXTLENGTH,0,0)
 		return self._storyLength
 
 	def _getLineCount(self):
-		return winUser.sendMessage(self.obj.windowHandle,SCI_GETLINECOUNT,0,0)
+		return watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETLINECOUNT,0,0)
 
 	def _getTextRange(self,start,end):
 		bufLen=(end-start)+1
@@ -152,39 +153,39 @@
 		textRange.lpstrText=internalBuf
 		internalTextRange=winKernel.virtualAllocEx(processHandle,None,ctypes.sizeof(textRange),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 		winKernel.writeProcessMemory(processHandle,internalTextRange,ctypes.byref(textRange),ctypes.sizeof(textRange),None)
-		winUser.sendMessage(self.obj.windowHandle,SCI_GETTEXTRANGE,0,internalTextRange)
+		watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETTEXTRANGE,0,internalTextRange)
 		winKernel.virtualFreeEx(processHandle,internalTextRange,0,winKernel.MEM_RELEASE)
 		buf=ctypes.create_string_buffer(bufLen)
 		winKernel.readProcessMemory(processHandle,internalBuf,buf,bufLen,None)
 		winKernel.virtualFreeEx(processHandle,internalBuf,0,winKernel.MEM_RELEASE)
-		cp=winUser.sendMessage(self.obj.windowHandle,SCI_GETCODEPAGE,0,0)
+		cp=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_GETCODEPAGE,0,0)
 		if cp==SC_CP_UTF8:
 			return unicode(buf.value, errors="replace", encoding="utf-8")
 		else:
 			return unicode(buf.value, errors="replace", encoding=locale.getlocale()[1])
 
 	def _getWordOffsets(self,offset):
-		start=winUser.sendMessage(self.obj.windowHandle,SCI_WORDSTARTPOSITION,offset,0)
-		end=winUser.sendMessage(self.obj.windowHandle,SCI_WORDENDPOSITION,start,0)
+		start=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_WORDSTARTPOSITION,offset,0)
+		end=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_WORDENDPOSITION,start,0)
 		if end<=offset:
 			start=end
-			end=winUser.sendMessage(self.obj.windowHandle,SCI_WORDENDPOSITION,offset,0)
+			end=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_WORDENDPOSITION,offset,0)
 		return [start,end]
 
 	def _getLineNumFromOffset(self,offset):
-		return winUser.sendMessage(self.obj.windowHandle,SCI_LINEFROMPOSITION,offset,0)
+		return watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_LINEFROMPOSITION,offset,0)
 
 	def _getLineOffsets(self,offset):
-		line=winUser.sendMessage(self.obj.windowHandle,SCI_LINEFROMPOSITION,offset,0)
-		start=winUser.sendMessage(self.obj.windowHandle,SCI_POSITIONFROMLINE,line,0)
-		end=start+winUser.sendMessage(self.obj.windowHandle,SCI_LINELENGTH,line,0)
+		line=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_LINEFROMPOSITION,offset,0)
+		start=watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POSITIONFROMLINE,line,0)
+		end=start+watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_LINELENGTH,line,0)
 		return (start,end)
 
 	def _getParagraphOffsets(self,offset):
 		return self._getLineOffsets(offset)
 
 	def _getCharacterOffsets(self,offset):
-		return [offset,winUser.sendMessage(self.obj.windowHandle,SCI_POSITIONAFTER,offset,0)]
+		return [offset,watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POSITIONAFTER,offset,0)]
 
 #The Scintilla NVDA object, inherists the generic MSAA NVDA object
 class Scintilla(EditableTextWithAutoSelectDetection, Window):

=== modified file 'source/appModules/miranda32.py'
--- source/appModules/miranda32.py	2011-02-03 06:00:43 +0000
+++ source/appModules/miranda32.py	2011-09-24 12:23:46 +0000
@@ -9,7 +9,6 @@
 from ctypes import *
 from ctypes.wintypes import *
 import winKernel
-import winUser
 from NVDAObjects.IAccessible import IAccessible, ContentGenericClient
 from NVDAObjects.behaviors import Dialog
 import appModuleHandler
@@ -21,6 +20,7 @@
 import mouseHandler
 import oleacc
 from keyboardHandler import KeyboardInputGesture
+import watchdog
 
 #contact list window messages
 CLM_FIRST=0x1000    #this is the same as LVM_FIRST
@@ -125,13 +125,13 @@
 class mirandaIMContactList(IAccessible):
 
 	def _get_name(self):
-		hItem=winUser.sendMessage(self.windowHandle,CLM_GETSELECTION,0,0)
+		hItem=watchdog.cancellableSendMessage(self.windowHandle,CLM_GETSELECTION,0,0)
 		internalBuf=winKernel.virtualAllocEx(self.processHandle,None,MAXITEMTEXTLEN,winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
-		winUser.sendMessage(self.windowHandle,CLM_GETITEMTEXT,hItem,internalBuf)
+		watchdog.cancellableSendMessage(self.windowHandle,CLM_GETITEMTEXT,hItem,internalBuf)
 		buf=create_unicode_buffer(MAXITEMTEXTLEN)
 		winKernel.readProcessMemory(self.processHandle,internalBuf,buf,MAXITEMTEXTLEN,None)
 		text=buf.value
-		statusMsgPtr=winUser.sendMessage(self.windowHandle,CLM_GETSTATUSMSG,hItem,0)
+		statusMsgPtr=watchdog.cancellableSendMessage(self.windowHandle,CLM_GETSTATUSMSG,hItem,0)
 		if statusMsgPtr>0:
 			buf2=create_unicode_buffer(MAXSTATUSMSGLEN)
 			winKernel.readProcessMemory(self.processHandle,statusMsgPtr,buf2,MAXSTATUSMSGLEN,None)
@@ -140,8 +140,8 @@
 		return text
 
 	def _get_role(self):
-		hItem=winUser.sendMessage(self.windowHandle,CLM_GETSELECTION,0,0)
-		iType=winUser.sendMessage(self.windowHandle,CLM_GETITEMTYPE,hItem,0)
+		hItem=watchdog.cancellableSendMessage(self.windowHandle,CLM_GETSELECTION,0,0)
+		iType=watchdog.cancellableSendMessage(self.windowHandle,CLM_GETITEMTYPE,hItem,0)
 		if iType==CLCIT_DIVIDER or iType==CLCIT_INVALID: #some clists treat invalid as divider
 			return controlTypes.ROLE_SEPARATOR
 		else:
@@ -149,8 +149,8 @@
 
 	def _get_states(self):
 		newStates=super(mirandaIMContactList,self)._get_states()
-		hItem=winUser.sendMessage(self.windowHandle,CLM_GETSELECTION,0,0)
-		state=winUser.sendMessage(self.windowHandle,CLM_GETEXPAND,hItem,0)
+		hItem=watchdog.cancellableSendMessage(self.windowHandle,CLM_GETSELECTION,0,0)
+		state=watchdog.cancellableSendMessage(self.windowHandle,CLM_GETEXPAND,hItem,0)
 		if state==CLE_EXPAND:
 			newStates.add(controlTypes.STATE_EXPANDED)
 		elif state==CLE_COLLAPSE:

=== modified file 'source/appModules/msimn.py'
--- source/appModules/msimn.py	2011-06-15 04:29:22 +0000
+++ source/appModules/msimn.py	2011-09-24 12:23:30 +0000
@@ -13,6 +13,7 @@
 import speech
 from keyboardHandler import KeyboardInputGesture
 from NVDAObjects.IAccessible import sysListView32
+import watchdog
 
 #Labels for the header fields of an email, by control ID
 envelopeNames={
@@ -67,7 +68,7 @@
 
 	def _get_states(self):
 		states=super(MessageRuleListItem,self).states
-		if (winUser.sendMessage(self.windowHandle,sysListView32.LVM_GETITEMSTATE,self.IAccessibleChildID-1,sysListView32.LVIS_STATEIMAGEMASK)>>12)==8:
+		if (watchdog.cancellableSendMessage(self.windowHandle,sysListView32.LVM_GETITEMSTATE,self.IAccessibleChildID-1,sysListView32.LVIS_STATEIMAGEMASK)>>12)==8:
 			states.add(controlTypes.STATE_CHECKED)
 		return states
 
@@ -85,7 +86,7 @@
 
 	def _get_name(self):
 		nameList=[]
-		imageState=winUser.sendMessage(self.windowHandle,sysListView32.LVM_GETITEMSTATE,self.IAccessibleChildID-1,sysListView32.LVIS_STATEIMAGEMASK)>>12
+		imageState=watchdog.cancellableSendMessage(self.windowHandle,sysListView32.LVM_GETITEMSTATE,self.IAccessibleChildID-1,sysListView32.LVIS_STATEIMAGEMASK)>>12
 		if imageState==5:
 			nameList.append(controlTypes.speechStateLabels[controlTypes.STATE_COLLAPSED])
 		elif imageState==6:

=== modified file 'source/appModules/winamp.py'
--- source/appModules/winamp.py	2010-11-26 07:31:58 +0000
+++ source/appModules/winamp.py	2011-09-24 12:48:57 +0000
@@ -15,6 +15,7 @@
 import locale
 import controlTypes
 import api
+import watchdog
 
 # message used to sent many messages to winamp's main window. 
 # most all of the IPC_* messages involve sending the message in the form of:
@@ -44,11 +45,11 @@
 
 def getShuffle():
 	global hwndWinamp
-	return winUser.sendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GET_SHUFFLE)
+	return watchdog.cancellableSendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GET_SHUFFLE)
 
 def getRepeat():
 	global hwndWinamp
-	return winUser.sendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GET_REPEAT)
+	return watchdog.cancellableSendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GET_REPEAT)
 
 class AppModule(appModuleHandler.AppModule):
 
@@ -96,14 +97,14 @@
 class winampPlaylistEditor(winampMainWindow):
 
 	def _get_name(self):
-		curIndex=winUser.sendMessage(hwndWinamp,WM_WA_IPC,-1,IPC_PLAYLIST_GET_NEXT_SELECTED)
+		curIndex=watchdog.cancellableSendMessage(hwndWinamp,WM_WA_IPC,-1,IPC_PLAYLIST_GET_NEXT_SELECTED)
 		if curIndex <0:
 			return None
 		info=fileinfo2()
 		info.fileindex=curIndex
 		internalInfo=winKernel.virtualAllocEx(self.processHandle,None,sizeof(info),winKernel.MEM_COMMIT,winKernel.PAGE_READWRITE)
 		winKernel.writeProcessMemory(self.processHandle,internalInfo,byref(info),sizeof(info),None)
-		winUser.sendMessage(self.windowHandle,WM_WA_IPC,IPC_PE_GETINDEXTITLE,internalInfo)
+		watchdog.cancellableSendMessage(self.windowHandle,WM_WA_IPC,IPC_PE_GETINDEXTITLE,internalInfo)
 		winKernel.readProcessMemory(self.processHandle,internalInfo,byref(info),sizeof(info),None)
 		winKernel.virtualFreeEx(self.processHandle,internalInfo,0,winKernel.MEM_RELEASE)
 		return unicode("%d.\t%s\t%s"%(curIndex+1,info.filetitle,info.filelength), errors="replace", encoding=locale.getlocale()[1])

