Re: test if a program is running

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

Hi

I used the above get processes code as an include, and wrote a small program

--  code generated by Win32Lib IDE v1.0.4 Build July-06-2008 
 
constant TheProgramType="exw"  
  
include Win32Lib.ew 
without warning 
include processes.ex 
 
-------------------------------------------------------------------------------- 
--  Window Window1 
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) 
constant List2 = createEx( List, "List2", Window1, 12, 16, 356, 204, 0, 0 ) 
constant PushButton3 = createEx( PushButton, "Show processess", Window1, 12, 228, 108, 28, 0, 0 ) 
--------------------------------------------------------- 
-------------------------------------------------------------------------------- 
procedure PushButton3_onClick (integer self, integer event, sequence params)--params is () 
object proclist, void 
 
proclist= GetAllProcessesNames() 
if sequence(proclist) then 
  for i = 1 to length(proclist) do 
     if length(proclist[i]) then 
 
       --puts(1,name_only(proclist[i])&"\n") 
       addItem(List2, name_only(proclist[i])) 
     end if 
  end for 
  void = message_box("Items added", "", 0) 
end if 
 
 
end procedure 
setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) 
--------------------------------------------------------- 
 
 
WinMain( Window1,Normal ) 
 

And it did not crash. (Note, I exported name_only from the include too)

I'm using eu4 latest, win32lib 0704 (last unmodified package, not yet been updated)

Incidentally, remove the void = from in front of message_box, and the interpreter complains about expecting a procedure, not a function. (should be expecting a function, not a procedure, but I thought this behaviour had been squashed anyway. Strange)

Chris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu