Hi everyone,
I need your help.
I create a IEHtmlWindow with “wx.Dialog” and set “wx.STAY_ON_TOP”.
…
self.dlg = wx.Dialog(parent=None,id=-1,title=title, size=(700, 500), pos=(-1,-1),
style=wx.STAY_ON_TOP|wx.SUNKEN_BORDER|wx.DEFAULT_DIALOG_STYLE)
sizer = wx.BoxSizer(wx.VERTICAL)
self.ie = iewin.IEHtmlWindow(self.dlg, -1,
style = wx.NO_FULL_REPAINT_ON_RESIZE )
…
Using py2ex, I generate its binary for window xp. I want this IEHtmlWindow pop out first and stay on top whenever my computer reboots. So I put its the binary’s name into
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Everything works fine except one things:
Since it takes a while (5-7 seconds, python24.dll is too big?) for this binary to pop up the IEHtmlWindow after pc reboot, if a user clicks microsoft’s IE before IEHtmlWindow pops out, IEHtmlWindow can not stay on top (in fact, it stays behind microsoft’s IE). If this user just waits for IEHtmlWindow pop out, then does not matter what he/she clicks on window, IEHtmlWindow can stay on top always.
Anyone knows how to make IEHtmlWindow stay on top always in the above case? Or make IEHtmlWindow pop out very fast (say, like pop out with those icons on window xp) so a user has no time to click microsoft’s IE?
Thanks a lot.
Ouyang
The attached is my python script.
···
####################################################################
import wx
import string
if wx.Platform == ‘WXMSW’:
import wx.lib.iewin as iewin
class App(wx.App):
def OnInit(self):
title = “test”
self.dlg = wx.Dialog(parent=None,id=-1,title=title, size=(700, 500), pos=(-1,-1),
style=wx.STAY_ON_TOP|wx.SUNKEN_BORDER|wx.DEFAULT_DIALOG_STYLE)
sizer = wx.BoxSizer(wx.VERTICAL)
self.ie = iewin.IEHtmlWindow(self.dlg, -1,
style = wx.NO_FULL_REPAINT_ON_RESIZE )
sizer.Add(self.ie, 1, wx.EXPAND)
self.location = wx.ComboBox(
self.dlg, -1, “”,style = wx.CB_DROPDOWN|wx.PROCESS_ENTER
)
self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location)
self.location.Bind(wx.EVT_KEY_UP, self.OnLocationKey)
self.location.Bind(wx.EVT_CHAR, self.IgnoreReturn)
self.current = “http://localhost/logon_ck.htm”
self.ie.LoadUrl(self.current)
self.location.Append(self.current)
self.dlg.SetSizer(sizer)
self.dlg.Bind(wx.EVT_CLOSE, self.OnClose)
self.dlg.Bind(wx.EVT_MOVE, self.OnMove)
self.dlg.ShowModal()
return True
def OnMove(self, evt):
self.dlg.Move((10,30))
evt.Skip()
def OnClose(self, evt):
fileStr = self.ie.GetText(True)
if string.find(fileStr,‘service you requested is not started’) > 0:
evt.Skip()
self.dlg.Destroy()
elif string.find(fileStr,unicode(“��������”,“gb2312”)) > 0:
evt.Skip()
self.dlg.Destroy()
elif string.find(fileStr,‘logonSuccessfulx19521207’) > 0:
evt.Skip()
self.dlg.Destroy()
else:
wx.MessageBox(“you can not close this window, please login first!”)
evt.Veto()
def OnLocationSelect(self, evt):
url = self.location.GetStringSelection()
self.log.write(‘OnLocationSelect: %s\n’ % url)
self.ie.Navigate(url)
def OnLocationKey(self, evt):
if evt.KeyCode() == wx.WXK_RETURN:
URL = self.location.GetValue()
self.location.Append(URL)
self.ie.Navigate(URL)
else:
evt.Skip()
def IgnoreReturn(self, evt):
if evt.GetKeyCode() != wx.WXK_RETURN:
evt.Skip()
if name == ‘main’:
app = App()
app.MainLoop()
###############################################################
Celebrate Yahoo!'s 10th Birthday!