How to hide a program?

J

jvdb

Hi all,

I've created a program that receives files and opens the corresponding
program (for example adobe acrobat). However, when started, i would
like to see nothing of the running program. I only want to see the
program that will be opened.
Is it possible to start a program 'hidden' or minimized to at least
the system tray? And, if yes., could some one help me on this?

Thanks already!

Jeroen
 
D

Diez B. Roggisch

jvdb said:
Hi all,

I've created a program that receives files and opens the corresponding
program (for example adobe acrobat). However, when started, i would
like to see nothing of the running program. I only want to see the
program that will be opened.
Is it possible to start a program 'hidden' or minimized to at least
the system tray? And, if yes., could some one help me on this?

I'm not exactly sure what you mean here, but I guess you want the
command-window suppressed. You can do so by naming your scripts *.pyw,
which will invoke pythonw.exe instead. That has no command-window.

Diez
 
J

jvdb

I'm not exactly sure what you mean here, but I guess you want the
command-window suppressed. You can do so by naming your scripts *.pyw,
which will invoke pythonw.exe instead. That has no command-window.

Diez

Hi Diez,

I forgot to mention that i have created a Windows executable of the
script.
What i want is to run the application minimized in the system tray or
totally hidden.

regards,
Jeroen
 
L

Larry Bates

jvdb said:
Hi all,

I've created a program that receives files and opens the corresponding
program (for example adobe acrobat). However, when started, i would
like to see nothing of the running program. I only want to see the
program that will be opened.
Is it possible to start a program 'hidden' or minimized to at least
the system tray? And, if yes., could some one help me on this?

Thanks already!

Jeroen
You can do this with:

import win32process

STARTUPINFO=win32process.STARTUPINFO()
STARTUPINFO.dwX=0
STARTUPINFO.dwY=0
STARTUPINFO.dwXSize=800
STARTUPINFO.dwYSize=600
execute_target="enter program to run here"
commandLine=None
processAttributes=None
threadAttributes=None
bInheritHandles=0
dwCreationFlags=0
currentDirectory=None
#
# Start the program
#
win32process.CreateProcess(execute_target,
commandLine,
processAttributes,
threadAttributes,
bInheritHandles,
dwCreationFlags,
newEnvironment,
currentDirectory,
STARTUPINFO)


-Larry Bates
 
J

jvdb

You can do this with:

import win32process

STARTUPINFO=win32process.STARTUPINFO()
STARTUPINFO.dwX=0
STARTUPINFO.dwY=0
STARTUPINFO.dwXSize=800
STARTUPINFO.dwYSize=600
execute_target="enter program to run here"
commandLine=None
processAttributes=None
threadAttributes=None
bInheritHandles=0
dwCreationFlags=0
currentDirectory=None
#
# Start the program
#
win32process.CreateProcess(execute_target,
commandLine,
processAttributes,
threadAttributes,
bInheritHandles,
dwCreationFlags,
newEnvironment,
currentDirectory,
STARTUPINFO)

-Larry Bates

Hi Larry,

The thing is, i don't want to see anything of my program, just the
launched program.
I already have the program working. But when i create an executable of
it with py2exe and start it, i don't want to see that it is running,
perhaps just in the systemtray. That is my problem.

thanks!
Jeroen
 
D

David Wahler

The thing is, i don't want to see anything of my program, just the
launched program.
I already have the program working. But when i create an executable of
it with py2exe and start it, i don't want to see that it is running,
perhaps just in the systemtray. That is my problem.

Try renaming your main script to have a .pyw extension as Diez said,
or use the --windows option when running py2exe.

http://mail.python.org/pipermail/python-list/2003-December/241319.html

-- David
 
J

jvdb

Hi all,

thanks very much! it was indeed how i compiled to .exe
After using the windows= , my issue was solved. Thanks to all who took
the time on helping me.

Jeroen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top