Re: WIN32LIB - shellExecute

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.

------=_NextPart_000_0011_01C0D333.D0951D40
	charset="iso-8859-1"

TRY the attached and tell me if it works..

Euman

----- Original Message ----- 
From: <michaelstee at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: WIN32LIB - shellExecute


> 
> 
> Hi all!
> I've got a Win32Lib app that will be running on Win2000, and I want
> to launch WordPad from my app. I'm trying shellExecute(), but it
> doesn't seem to do anything. Here's the snippet of code:
> 
>    str = "C:\\program files\\windows NT\\accessories\\wordpad.exe "
>    outfile = "C:\\rich.rtf"
>    shellExecute(str,outfile, 0) 
> 
> The documentation says the 3 params are command,file,style. I'm sure 
> I've got them wrong in my code, but there's no example. Can anyone help?
> 
> Thanks!
> 
> 
> 
> 
> 
> 

------=_NextPart_000_0011_01C0D333.D0951D40
Content-Type: application/octet-stream;
	name="shellexec2.exw"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="shellexec2.exw"

--start example--
include win32lib.ew
without warning

-- originally from DaJaRo jumpto.ew
atom lib
integer jJumpto    --id
if platform() = WIN32 then
lib = open_dll("shell32.dll")
jJumpto = define_c_func(lib,"ShellExecuteA",
  {C_INT,C_POINTER,C_POINTER,C_POINTER,C_POINTER,C_INT},C_INT)
if jJumpto = -1 then
puts(1,"couldn't find ShellExecuteA\n")
abort(1)
end if
end if

procedure Jump_to(integer id,sequence filename,
  sequence defaultpath,sequence parameters, integer flag)
sequence command, Filenam, DefaultPath, Parameters
integer Nop
atom command_ptr,Fnm_ptr,Prm_ptr,Dfp_ptr,hw
command = "Open"
Filenam= filename
Parameters=parameters
DefaultPath=defaultpath
command_ptr = allocate_string(command)
Fnm_ptr = allocate_string(Filenam)
Prm_ptr = allocate_string(Parameters)
Dfp_ptr = allocate_string(DefaultPath)
hw= getHandle(id )
Nop=c_func(jJumpto,{hw,command_ptr,
  Fnm_ptr,Prm_ptr,Dfp_ptr,flag})
free(command_ptr)
free(Fnm_ptr)
free(Prm_ptr)
free(Dfp_ptr)
end procedure

constant
Win=create(Window,"Test",0,0,0,200,100,0),
FileMenu=create( Menu,"File",Win,0,0,0,0,0),
OpenMenu=create(MenuItem,"&Open File",FileMenu,0,0,0,0,0),
ExitMenu=create(MenuItem,"E&xit",FileMenu,0,0,0,0,0)
----
procedure onMenu_Exit()
closeWindow(Win)
end procedure
onClick [ExitMenu] = routine_id("onMenu_Exit")
----
procedure OpenFile()
Jump_to(
-- passing your main window's id
Win,
-- with the program to call
--"exw.exe",
"wordpad.exe",
-- this is my current 'tutorials' default path !!
"C:\\program files\\windows NT\\accessories\\",
-- the parameter to pass to exw.exe
"C:\\rich.rtf",

-- and last, the 'show' parameter
SW_HIDE )
end procedure
onClick [OpenMenu] = routine_id("OpenFile")
----
WinMain(Win,Normal)

------=_NextPart_000_0011_01C0D333.D0951D40--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu