Re: error? Print Preview
Pete wrote:
> On Sat, 20 Sep 2003 23:10:11 -0600, sixs at ida.net wrote:
>
>> I am running pptest.exw in Meditor and it says "Can't open
>> C:\uphoria\Demo\Print.exw" the the message "Press Enter,,,".
>
> Ah! The penny drops. It's not coping with a space in the directory
> name very well. Try renaming the "Print Preview" directory (with a
> space) to "PrintPreview" (without a space).
>
> Can anyone help here, I don't know what else MEditor should do:
> the variable exe is set to:
> C:\EUPHORIA\bin\exw.exe "D:\Print Preview\pptest.exw"
> but
> err_msg = system_exec(exe, 2)
>
> dies with the above message. I'm sure putting the quotes round the
> path&name helped in the past, but they don't seem to anymore.
Also for me the following code snippet didn't run as expected.
Windows 98 always said: "Can't open D:\Print.exw". Very strange!
<begin code>
sequence exe
exe = "C:\\EUPHORIA\\bin\\exw.exe \"D:\\Print Preview\\pptest.exw\""
? system_exec(exe, 2)
if getc(0) then end if
<end code>
Using my own function 'system_wait()' works fine, though.
<begin code>
include system_wait.ew
sequence exe
exe = "C:\\EUPHORIA\\bin\\exw.exe \"D:\\Print Preview\\pptest.exw\""
? system_wait(exe)
if getc(0) then end if
<end code>
---------------------------[ system_wait.ew ]---------------------------
-- by Juergen Luethje
-- Euphoria 2.3+
-- works like Euphoria's system_exec()
include dll.e
include machine.e
constant
FALSE = 0,
INFINITE = #FFFFFFFF -- Infinite timeout
constant -- TYPE STARTUPINFO
cb = 0, -- DWORD
-- lpReserved = 4, -- ASCIIZ PTR
-- lpDesktop = 8, -- ASCIIZ PTR
-- lpTitle = 12, -- ASCIIZ PTR
-- dwX = 16, -- DWORD
-- dwY = 20, -- DWORD
-- dwXSize = 24, -- DWORD
-- dwYSize = 28, -- DWORD
-- dwXCountChars = 32, -- DWORD
-- dwYCountChars = 36, -- DWORD
-- dwFillAttribute = 40, -- DWORD
-- dwFlags = 44, -- DWORD
-- wShowWindow = 48, -- WORD
-- cbReserved2 = 50, -- WORD
-- lpReserved2 = 52, -- BYTE PTR
-- hStdInput = 56, -- DWORD
-- hStdOutput = 60, -- DWORD
-- hStdError = 64, -- DWORD
SIZEOF_STARTUPINFO = 68
constant -- TYPE PROCESS_INFORMATION
hProcess = 0, -- DWORD
hThread = 4, -- DWORD
-- dwProcessId = 8, -- DWORD
-- dwThreadId = 12, -- DWORD
SIZEOF_PROCESS_INFORMATION = 16
constant
kernel32 = open_dll("kernel32.dll"),
CreateProcess = define_c_func(kernel32, "CreateProcessA",
{C_POINTER, C_POINTER, C_POINTER, C_POINTER,
C_LONG,
C_ULONG, C_POINTER, C_POINTER, C_POINTER,
C_POINTER},
C_LONG),
WaitForSingleObject = define_c_func(kernel32, "WaitForSingleObject",
{C_ULONG, C_ULONG},
C_ULONG),
CloseHandle = define_c_func(kernel32, "CloseHandle", {C_ULONG}, C_LONG)
global function system_wait (sequence child_process)
-- after
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_processes.asp
--
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
--
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/waitforsingleobject.asp
atom si, pi, child, ret, void, hProc, hThr
si = allocate(SIZEOF_STARTUPINFO)
poke(si, repeat(0, SIZEOF_STARTUPINFO))
poke4(si+cb, SIZEOF_STARTUPINFO)
pi = allocate(SIZEOF_PROCESS_INFORMATION)
poke(pi, repeat(0, SIZEOF_PROCESS_INFORMATION))
child = allocate_string(child_process)
-- Start the child process.
if c_func(CreateProcess,
{NULL, -- No module name (use command line).
child, -- Command line.
NULL, -- Process handle not inheritable.
NULL, -- Thread handle not inheritable.
FALSE, -- Set handle inheritance to FALSE.
0, -- No creation flags.
NULL, -- Use parent's environment block.
NULL, -- Use parent's starting directory.
si, -- Pointer to STARTUPINFO structure.
pi}) -- Pointer to PROCESS_INFORMATION structure.
= 0 then
free(si)
free(pi)
free(child)
return -1 -- error
end if
hProc = peek4u(pi+hProcess)
hThr = peek4u(pi+hThread)
-- Wait until child process exits.
ret = c_func(WaitForSingleObject, {hProc, INFINITE})
-- Close process and thread handles.
void = c_func(CloseHandle, {hProc})
void = c_func(CloseHandle, {hThr})
free(si)
free(pi)
free(child)
return ret
end function
------------------------------------------------------------------------
Regards,
Juergen
|
Not Categorized, Please Help
|
|