def OnInitDialog(self):
rc = dialog.Dialog.OnInitDialog(self)
self.editwindow = self.GetDlgItem(132)
self.editwindow.HookAllKeyStrokes(self.OnKey)
self.olectl = MySerialControl(self)
try:
self.olectl.CreateControl("OCX",
win32con.WS_TABSTOP | win32con.WS_VISIBLE,
(7,43,500,300), self._obj_, 131)
except win32ui.error:
self.MessageBox("The Serial Control could not be created")
self.olectl = None
self.EndDialog(win32con.IDCANCEL)
if self.olectl:
self.olectl.Settings = SERIAL_SETTINGS
self.olectl.CommPort = SERIAL_PORT
self.olectl.RThreshold = 1
try:
self.olectl.PortOpen = 1
except pythoncom.com_error, details:
print "Could not open the specified serial port - %s" % (details.excepinfo[2])
self.EndDialog(win32con.IDCANCEL)
return rc
评论列表
文章目录