Re: Win32Lib: how run another program?
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Aug 31, 2000
- 490 views
> From: wolfgang fritz > > Check out my 'tutorial' engines. > Depending on which version you have, it's either Tutor3.exw, > ... or WinTutor.exw. [ in my latest 'beta' ] > It uses shellExecute() for *everything*... > My address7.zip also uses shellExecute() to start an e-mail... > > ...and Kat, you might try shellExecute() with the following flag. > > SW_SHOWMINNOACTIVE -- Displays the window as a minimized > window. The active > window remains active. > > ...haven't tried it, but if a program opened this way actually *does* > anything while it's minimized, I suppose this is what you > might be looking > for. Well, I sort of got it to work. One problem was that I wasn't using the flags properly. Also, it doesn't seem to like command line arguments, like "winword.exe document.txt". To run and forget, you need to add: xShellExecuteNoRet = linkProc( shell32, "ShellExecuteA", {C_LONG, C_LONG, C_LONG, C_LONG, C_LONG, C_LONG} ) global procedure shellExecuteNoRet( sequence cmd, sequence file, atom style ) -- call ShellExecute to display a file atom result, file_string, cmd_string -- convert to strings file_string = allocate_string( file ) cmd_string = allocate_string( cmd ) -- call ShellExecute c_proc( xShellExecuteNoRet, { getHandle( mainWindow ), cmd_string, file_string, 0, 0, style } ) -- free the strings free( cmd_string ) free( file_string ) end procedure The procedure is the same as shellExecute(), except it doesn't wait for the exit code from windows. Matt