Win32 MessageBox has other programs

I recently started learning Python and wrote a little script that tells me when a particular website changes content. Then I added it as a scheduled task for Windows so that it could run every 10 minutes. I would like to receive information about a site change immediately, so I added a win32ui MessageBox error message if the script detects that the website has changed. Here is a small piece of code that I use for MessageBox (creative text, I know):

win32ui.MessageBox("The website has changed.", "Website Change", 0)

My problem is that I spend most of my time on the remote desktop, so when a MessageBox pops up, it sits at a remote desktop session, is there a way to get the MessageBox to appear on top of it?

In a similar note, when a script is run, the command line opens very briefly on a remote desktop session that I don't want, is there any way to stop this behavior?

I am pleased with the Windows solutions, as I know that this could mean working with a window manager or perhaps an alternative way to tell me, rather than using a MessageBox.

+2
source share
5 answers

When you start something from the Task Scheduler, Windows blocks any "simple" ways to bring your windows or dialogs to the beginning.

  • The first way is to use the flag MB_SYSTEMMODAL(4096 value). In my experience, he makes the Msg "Always On Top" dialog.

    win32ui.MessageBox("The website has changed.", "Website Change", MB_SYSTEMMODAL)
    
  • - // . , MessageBox, ( ) MessageBox.

    SetForegroundWindow(Wnd);
    BringWindowToTop(Wnd);
    SetForegroundWindow(Wnd);
    

, Python . , ConEmu, 'HidCon cmdow. , :

ConEmu -basic -MinTSA -cmd C:\Python27\python.exe C:\pythonScript.py
    or
CMDOW /RUN /MIN C:\Python27\python.exe C:\pythonScript.py
+6
+1

ctypes Windows, ,

import ctypes
if condition:
    ctypes.windll.user32.MessageBoxW(0, u"Error", u"Error", 0)
+1

, , . , , .

0

Windows , . , , .

Windows - , . () .

, Windows python .

0

All Articles