Jason R. Coombs  committed b3017fd

Fixed issue with environment notification

  • Participants
  • Parent commits b5d0ea8
  • Branches default
  • Tags 2.3.1

Comments (0)

Files changed (1)

File jaraco/windows/

 # $Id$
 import ctypes
-from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, DWORD
+from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, DWORD, LPVOID
-class StringCapableLPARAM(LPARAM):
+class LPARAM_wstr(LPARAM):
 	A special instance of LPARAM that can be constructed from a string
 	instance (for functions such as SendMessage, whose LPARAM may point to
 	def from_param(cls, param):
 		if isinstance(param, basestring):
-			param = ctypes.cast(ctypes.c_wchar_p(param), ctypes.c_void_p).value
+			return LPVOID.from_param(unicode(param))
 		return LPARAM.from_param(param)
 SendMessage = ctypes.windll.user32.SendMessageW
-SendMessage.argtypes = (HWND, UINT, WPARAM, StringCapableLPARAM)
+SendMessage.argtypes = (HWND, UINT, WPARAM, LPARAM_wstr)
 SendMessage.restype = LRESULT
 def unicode_as_lparam(source):
 	pointer = ctypes.cast(ctypes.c_wchar_p(source), ctypes.c_void_p)
 	return LPARAM(pointer.value)