ocxserialtest.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:remoteControlPPT 作者: htwenning 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号