1. Re: To David Cuny re. Win32Lib - What to do?

At 12:53 24-02-98 -0800, Monty wrote:
>>I was under the impression that DLL calls were limited to Win32 systems,
>     What I was wondering, since we are running Win32 stuff, can we call up
>dos sessions, or even multiple dos sessions?  That way we could have a
>program call up several dos programs running in their own boxes...


Monty,

  From a windows application not only you can launch many dos applications
 (including euphoria ones) but also others windows applications. Here is a demo:

---------------------------  code begin here -------------------------
-- ShellExecute demo


include dll.e
include machine.e

atom iShellExecute, shell32


shell32 = open_dll("shell32.dll")
if not shell32 then
        abort(1)
end if

iShellExecute = define_c_func(shell32,"ShellExecuteA",
                                    {C_INT,C_INT,C_INT,C_INT,C_INT,C_INT},C_INT)
if iShellExecute = -1 then
        abort(1)
end if

constant -- show mode
    SW_HIDE = 0,
    SW_NORMAL = 1,
    SW_MAXIMIZE = 3,
    SW_MINIMIZE = 6

function ShellExec(atom Parent, -- handle of parent windows (may be NULL)
                  sequence ProgramName, -- program to execute
                  sequence Param, -- command line parameters of the program.
                  integer ShowMode) -- window size

atom pName, pParam, hInstance
    pName = allocate_string(ProgramName)
    pParam = allocate_string(Param)
hInstance =
        c_func(iShellExecute,{Parent,NULL,pName,pParam,NULL,ShowMode})
        free(pName)
        free(pParam)
        return hInstance
end function

-- enter a dos shell and execute a dir
? ShellExec(NULL,"command","/K dir c:\\windows\\system",SW_NORMAL)
-- launch windows explorer
? ShellExec(NULL,"EXPLORER.EXE","c:\\windows\\system",SW_NORMAL)

--------------------   code end here ----------------------

NOTES: 1) ShellExec return the instance handle of the program.
        2) The first parameter is the handle of the parent windows it may be
 NULL.
       3) the number of programs lauched is only limited by the system
                         resources available.




Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at globetrotter.qc.ca

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu