1. PC switch off from pgm

I'd like to swich off an ATX PC in pgm, but I do not know how.
Please help me!

Thans!

Attila Kondor
--

new topic     » topic index » view message » categorize

2. Re: PC switch off from pgm

On Sat, 6 Aug 2005 21:17:02 +0200, Kondor Attila <euf-lev at dpg.hu>
wrote:

>I'd like to swich off an ATX PC in pgm, but I do not know how.

More details required.

Apart from "a computer", what do you mean by "ATX PC"?

To get this into perspective, I could reply "F4", and while you
obviously won't know what that means, it _IS_ a perfectly valid 
answer to the question as asked.

Regards,
Pete

PS. Just in case anyone really wants to know, that is not the function
key between F3 and F5, it is the binary (in hexadecimal notation) for
the HLT instruction on 80x86 pcs, though it probably is why some geek
originally chose Alt F4 to shut a program or windows itself down.

new topic     » goto parent     » topic index » view message » categorize

3. Re: PC switch off from pgm

Pete Lomax wrote:
> 
> On Sat, 6 Aug 2005 21:17:02 +0200, Kondor Attila <euf-lev at dpg.hu>
> wrote:
> 
> >I'd like to swich off an ATX PC in pgm, but I do not know how.
> 
> More details required.
> 
> Apart from "a computer", what do you mean by "ATX PC"?
> 

I would guess an ATX form factor case/motherboard,
which could a number of processor/os configurations.

If your looking to do a system call you
can find some third party command line utilities 

I looked through Snapfiles for freeware; 
http://www.snapfiles.com/opinions/Quick_ShutDown/Quick_ShutDown.html 






--"ask about our layaway plan".
--

new topic     » goto parent     » topic index » view message » categorize

4. Re: PC switch off from pgm

Attila asked, somewhat vaguely, and besides, I wanted to punish all those
bloaters too lazy to *EDIT* their reply-to's.


--shut down Windows, also, if ATX, power.
--only tested on 98, 2K
include dll.e
include machine.e
include misc.e
constant
 KERNEL32=open_dll("kernel32.dll")
,GetVersion=define_c_func(KERNEL32,"GetVersion",{},C_UINT)
,GetCurrentProcess=define_c_func(KERNEL32,"GetCurrentProcess",{},C_UINT)
,hToken=allocate(4)
,ADVAPI32=open_dll("advapi32.dll")
,OpenProcessToken=define_c_func(ADVAPI32,"OpenProcessToken",
  {C_UINT,C_UINT,C_POINTER},C_UINT)
,TOKEN_ADJUST_PRIVILEGES=#20
,TOKEN_QUERY=#8
,struct_TOKEN_PRIVILEGES=allocate(16) --4 for count + 12 per privilege
,LookupPrivilegeValue=define_c_func(ADVAPI32,"LookupPrivilegeValueA",
  {C_POINTER,C_POINTER,C_POINTER},C_UINT)
,SE_SHUTDOWN_NAME=allocate_string("SeShutdownPrivilege")
,SE_PRIVILEGE_ENABLED=2
,AdjustTokenPrivileges=define_c_func(ADVAPI32,"AdjustTokenPrivileges",
  {C_UINT,C_UINT,C_POINTER,C_UINT,C_POINTER,C_POINTER},C_UINT)
--Win9x's really only need items below
,USER32=open_dll("user32.dll")
,ExitWindowsEx=define_c_func(USER32,"ExitWindowsEx",
  {C_UINT,C_UINT},C_UINT)
,EWX_SHUTDOWN=1
--,EWX_FORCE=4 --not used here

function hi_word( atom d )
  return floor(d/#10000)
end function

atom current, jk

--is this NT/2000/XP?
if hi_word( c_func(GetVersion,{}) ) < #8000 then
mem_set(struct_TOKEN_PRIVILEGES,0,16)
current=c_func(GetCurrentProcess,{})
jk=c_func(OpenProcessToken,
  {current,TOKEN_ADJUST_PRIVILEGES+TOKEN_QUERY,hToken})

  if jk then
    poke4(struct_TOKEN_PRIVILEGES,1) --only one privilege
--to enable privilege
    poke4(struct_TOKEN_PRIVILEGES+12,SE_PRIVILEGE_ENABLED)
--get Luid into same struct
    jk=c_func(LookupPrivilegeValue,
      {0,SE_SHUTDOWN_NAME,struct_TOKEN_PRIVILEGES+4})

    jk=c_func(AdjustTokenPrivileges,
      {peek4u(hToken),0,struct_TOKEN_PRIVILEGES,0,0,0})
    printf(1,"%s\n",{"..attempting NT/2000/XP shutdown"})
    sleep(2)
    free_console() --apparently not necessary on NT/2000/XP
    jk=c_func(ExitWindowsEx,{EWX_SHUTDOWN,0})
  end if
else
  printf(1,"%s\n",{"..attempting Win9x/ME shutdown"})
  sleep(2)
  free_console() -- you *must* do this for 9x's
  jk=c_func(ExitWindowsEx,{EWX_SHUTDOWN,0})
end if

--

new topic     » goto parent     » topic index » view message » categorize

5. Re: PC switch off from pgm

Hi

This will shutdown the computer, or is it too simple

system("shutdown -s -t 40", 2)

Chris

http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/

new topic     » goto parent     » topic index » view message » categorize

6. Re: PC switch off from pgm

Michael Raley  <guest at RapidEuphoria.com> 2005.08.08. 22:18:45 -7h-kor =EDrt=
a:

>
>
> posted by: Michael Raley <thinkways at yahoo.com>
>
> Pete Lomax wrote:
> >=20
> > On Sat, 6 Aug 2005 21:17:02 +0200, Kondor Attila <euf-lev at dpg.hu>
> > wrote:
> >=20
> > >I'd like to swich off an ATX PC in pgm, but I do not know how.
> >=20
> > More details required.
> >=20
> > Apart from "a computer", what do you mean by "ATX PC"?
> >=20
>
> I would guess an ATX form factor case/motherboard,
> which could a number of processor/os configurations.
>
> If your looking to do a system call you
> can find some third party command line utilities=20
>
> I looked through Snapfiles for freeware;=20
> http://www.snapfiles.com/opinions/Quick_ShutDown/Quick_ShutDown.html
>

Thank You, I will download.

Attila Kondor
--

new topic     » goto parent     » topic index » view message » categorize

7. Re: PC switch off from pgm

Wolf  <wolfritz at KING.IGS.NET> 2005.08.09. 14:38:34 -4h-kor =EDrta:

>
>
> Attila asked, somewhat vaguely, and besides, I wanted to punish all those=

> bloaters too lazy to *EDIT* their reply-to's.
>
>
> --shut down Windows, also, if ATX, power.
> --only tested on 98, 2K

This is what I would like do.
Thank you veru much, I will try after reading the emails.

Attila
--

new topic     » goto parent     » topic index » view message » categorize

8. Re: PC switch off from pgm

Pete Lomax  <petelomax at blueyonder.co.uk> 2005.08.08. 18:59:40 +1h-kor =EDrt=
a:

>
>
> On Sat, 6 Aug 2005 21:17:02 +0200, Kondor Attila <euf-lev at dpg.hu>
> wrote:
>
> >I'd like to swich off an ATX PC in pgm, but I do not know how.
>
> More details required.
>
> Apart from "a computer", what do you mean by "ATX PC"?
>
> To get this into perspective, I could reply "F4", and while you
> obviously won't know what that means, it _IS_ a perfectly valid
> answer to the question as asked.
>
> Regards,
> Pete
>
> PS. Just in case anyone really wants to know, that is not the function
> key between F3 and F5, it is the binary (in hexadecimal notation) for
> the HLT instruction on 80x86 pcs, though it probably is why some geek
> originally chose Alt F4 to shut a program or windows itself down.
>

Thank you, I hope Wolf's pgm will be good.

Attila
--

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu