in reply to Starting a process from a win32 perl service

First, it must be $site, not site. Next. You must use backslaches with $prog,. Finally, if the program call itself includes the executable without the path, it works.
#!/usr/bin/perl use Win32::Process; my $prog="C:\\Programme\\Internet Explorer\\iexplore.exe"; my $site="http://www.gmx.de"; Win32::Process::Create($ProcessObj,$prog,'iexplore "' . $site . '"', 0 +, NORMAL_PRIORITY_CLASS, ".");
Check the Task Manager to see, if the iexplorer did start! See the Win32::Process pod, too:
sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } Win32::Process::Create($ProcessObj, "D:\\winnt35\\system32\\notepad.exe", "notepad temp.txt", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); $ProcessObj->Suspend(); $ProcessObj->Resume(); $ProcessObj->Wait(INFINITE);

Replies are listed 'Best First'.
Re^2: Starting a process from a win32 perl service
by displeaser (Hermit) on Feb 09, 2005 at 11:02 UTC
    Hi,
    thanks for getting back to me.

    my problem is that I can sucessfully create the iexplore process, it is visable from the task manager, I just cant visably see it, which I would like to.

    When taking the code to call Internet explorer and put it into a basic command line script (as opposed to a service) it works fine.

    I think the problem lies in and around the fact that as the service has not got an active/displayed window, I think this is "inherited" to process's created from it, hence my Internet explorer window is running but just has no window visable...argh.
    I think all I need is some way to tell the process that it's window should be visable. I tried using Win32::SetChildShowWindow to display the window but didnt get anywhere (i can post code if needed)
    jd
      Code would be helpful.