Example #1
0
	def Accelerator(self, msg):
		ms = sgsm.get(msg.message, "XXX")
		if ms == "WM_KEYDOWN":
			return self.KeyDown(msg.wParam)
		elif ms == "WM_SYSKEYDOWN":
			return self.KeyDown(msg.wParam, "<alt>")
		return False
Example #2
0
	def WndProc(self, h, m, w, l):
		ms = sgsm.get(m, "XXX")
		if trace:
			print hex(h)[2:],ms,w,l
		if ms == "WM_CLOSE":
			user32.PostQuitMessage(0)
			if self.rt:
				self.rt.exit = True
			return 0
		elif ms == "WM_CREATE":
			self.OnCreate(h)
			return 0
		elif ms == "WM_SIZE":
			# Work out size
			if w != 1:
				self.OnSize()
			return 0
		elif ms == "WM_COMMAND":
			self.Command(self.cmds[w & 0xffff])
			return 0
		elif ms == "WM_ACTIVATE":
			if w != WA_INACTIVE:
				self.FocusText()
			return 0
		elif ms == "WM_USER":
			data = self.queue.get()
			self.ControlActive().InsertBytes(self.pdoc.pbuffer.Length(), data, len(data))
			self.ControlActive().ScrollTo(self.pdoc.pbuffer.Length(), True)
			self.Invalidate()
			time.sleep(0.01)	# Give the producer some time
			return 0
		else:
			return user32.DefWindowProcW(h, m, w, l)
Example #3
0
	def WndProc(self, h, m, w, l):
		ms = sgsm.get(m, "XXX")
		if trace:
			print("%s %s %s %s" % (hex(h)[2:],ms,w,l))
		if ms == "WM_CLOSE":
			user32.PostQuitMessage(0)
		elif ms == "WM_CREATE":
			self.OnCreate(h)
			return 0
		elif ms == "WM_SIZE":
			# Work out size
			if w != 1:
				self.OnSize()
			return 0
		elif ms == "WM_COMMAND":
			cmdCode = w & 0xffff
			if cmdCode in self.cmds:
				self.Command(self.cmds[cmdCode])
			return 0
		elif ms == "WM_ACTIVATE":
			if w != WA_INACTIVE:
				self.ed.FocusOn()
			return 0
		else:
			return user32.DefWindowProcW(h, m, w, l)
		return 0
Example #4
0
	def AppLoop(self):
		msg = ctypes.wintypes.MSG()
		lpmsg = ctypes.byref(msg)
		while user32.GetMessageW(lpmsg, 0, 0, 0):
			if trace and msg.message != msgs["WM_TIMER"]:
				print('mm', hex(msg.hWnd)[2:],sgsm.get(msg.message, "XXX"))
			if not self.Accelerator(msg):
				user32.TranslateMessage(lpmsg)
				user32.DispatchMessageW(lpmsg)
Example #5
0
 def AppLoop(self):
     msg = ctypes.wintypes.MSG()
     lpmsg = ctypes.byref(msg)
     while user32.GetMessageW(lpmsg, 0, 0, 0):
         if trace and msg.message != msgs["WM_TIMER"]:
             print('mm', hex(msg.hWnd)[2:], sgsm.get(msg.message, "XXX"))
         if not self.Accelerator(msg):
             user32.TranslateMessage(lpmsg)
             user32.DispatchMessageW(lpmsg)