in reply to Re^2: Win32 wperl open Console when system
in thread Win32 wperl open Console when system

But the linked thread looks good to me.

Did you look into it and try all listed options?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^3: Win32 wperl open Console when system

Replies are listed 'Best First'.
Re^4: Win32 wperl open Console when system
by fdesar (Beadle) on Jan 21, 2020 at 13:38 UTC

    Yes I did read the threads.

    But my problem is not hiding the console while running a Perl script : I do that by running wperl.

    I just want to run a windows command to display a PDF file FROM wperl that doesn't open a console but only the reader (ie. Internet Explorer).

      The "normal" way to open any file on Windows is to invoke ShellExecute() with hwnd set to 0, lpOperation set to NULL or to "open", lpFile set to the file to be opened, lpParameters and lpDirectory set to NULL, and nShowCmd set to SW_SHOWNORMAL.

      In other words:

      /* In C/C++: */ ShellExecute(0, NULL, file, NULL, NULL, SW_SHOWNORMAL); // request def +ault action ShellExecute(0, "open", file, NULL, NULL, SW_SHOWNORMAL); // request o +pen ShellExecute(0, "print", file, NULL, NULL, SW_SHOWNORMAL); // request +printing

      This should be equal to a double click on the respective file.

      I'm to lazy to search for a module exporting ShellExecute(), Win32::API should be able to import that function from shell32.dll.

      Update: Win32::FileOp exports ShellExecute(). Win32::GUI also has a ShellExecute() method, burried somewhere.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)