serviceapplication error

Hello

i’ set up an serviceApplication to create an screenshot:

[code]dim s as Shell

s= new shell
s.Execute (“c:\inetpub\imgserv\i_view32.exe /capture=1 /resize=(250,141) /aspectratio /resample /convert=c:\inetpub\imgserv\screen.jpg”)[/code]

if i start the app from the commandline in windows it works:

cd c:\inetpub\imgserv
then
imgsrv.exe 5000

(“5000” is the interval which is passed as argument)

Then i registered the application to run as service:

sc create cms type= own start= auto Displayname= "Imageserver" binpath= "c:\\inetpub\\imgserv\\imgsrv.exe 5000"

But when i start the service it creates the screenshot but its only black. What am i doing wrong?

Thanks Marco

it is probably taking a screen shot of the environment it is running in, which is NOT the same as the environment the calling app is in.

Shell calls start a new “user environement” which lasts for the life of the shell command… it is a sub process to the calling app

Thanks, Dave.

but just to get it right, if i start the app by double-click (just to test), it opens a shell window and executes as long as the shell window is open. But what is the difference when the same call comes from a service to open the app? It just runs in background or am i wrong?

Without more details about your utility, difficult to know what is going on.

I would switch to a non service solution, eventually using a declare to suppress the taskbar icon for the app. See
https://forum.xojo.com/13817-creating-an-application-with-no-taskbar-icon/0

basically it’s just a wrapper to call another app with parameters at an specific interval. This has to run when the computer has started up, thats why i came up with a service.
I would love to have it in the tray icon (where the volume control etc. are) with just “start” “stop” and a interval field.

Can someone point me to a direction where to look for this?

http://documentation.xojo.com/index.php/TrayItem

Thanks, i used this, too. didn’t thought about that.

one last question:

how can i pass variables to the application?

e.g. myprog,exe -5000, so that i can handle the “-5000” in the app, in console apps i used the args(), how do i do this in desktop apps?

thanks, its system.commandline