PDA

View Full Version : DLL: PCPower



RizlaUK
06-11-2007, 05:26 PM
This DLL enables you to set the users PC and monitor power state from within your AMS project.

The functions are:

SetPCPowerState

arguments:
1 = Hibernate
2 = Standby
3 = LogOffUser
4 = Reboot
5 = ShutDown

returns: nothing

example usage:

result = DLL.CallFunction("AutoPlay\\Docs\\PCPower.dll", "SetPCPowerState", 1, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);



SetMonitorPowerState

arguments:
1 = Show Screen Saver
2 = Standby Monitor
3 = Turn Off Monitor
4 = Turn On Monitor

returns: nothing

example usage:

result = DLL.CallFunction("AutoPlay\\Docs\\PCPower.dll", "SetMonitorPowerState", 3, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);

Solmos
10-01-2007, 08:22 AM
EXCELLENT!!!!!!!!!!!!!!

Very very thanks!!!

One questio:

¿works in windows vista?

And other question:

The accion reboot or ShutDown is forced (force windows for run this acction, and closs the aplication (no wait))

¿it posiible one option for force action and NO force action??

Very thanks!

wasim21k
10-01-2007, 08:35 AM
well you can use shutdown -s -f and shutdown -s and if you want to give some warning you can use -t 100 -c "Hellow IR"
that should do the job

Solmos
10-02-2007, 02:35 PM
RizlaUK please add option "NO force action" in the DLL file please!!

RizlaUK
10-08-2007, 05:04 AM
Sure, i can make it ask for conformation, but im not at my pc and dont have PB installed here, i will make the changes as soon as i can :yes

arb
10-08-2007, 08:22 AM
Good idea & Nice job

Thanx :yes

Solmos
10-08-2007, 10:50 AM
Very tanks RizlaUK

waiting the updated .dll :yes:yes

Very very thanks

RizlaUK
10-09-2007, 01:55 PM
Hey Solmos, i cant find the source files to this dll so i am going to have to rewrite the whole thing, it should not take to long, while i am at it is there anything else you need in the dll ??

Derek
10-09-2007, 02:19 PM
How about creating a DLL to win the Euro Millions! :yes:yes

Solmos
10-09-2007, 02:39 PM
1. System Poweroff (forced action or not)
2. System reboot (forced acction or not)
3. Close session (forced action or not)
4. Suspend (forced action or not)
5. Hibernate system (forced action or not)

¿6. Clearclipboard?

¿7. Search for multiple file extensions?

¿8. Get target shortcut? (return de real pach of de acces direct (file .lnk))

and of course

1 = Show Screen Saver
2 = Standby Monitor
3 = Turn Off Monitor
4 = Turn On Monitor

:yes:yes:yes:yes

Very thanks

RizlaUK
10-09-2007, 02:41 PM
lmao...i dont think PB is that powerful


AMS can do it though

Here

a = Math.Random(1, 50);
b = Math.Random(1, 50);
c = Math.Random(1, 50);
d = Math.Random(1, 50);
e = Math.Random(1, 50);
f = Math.Random(1, 9);
g = Math.Random(1, 9);


result = Dialog.Message("Notice", "Your Lucky Euro Millions Numbers Are : "..a..", "..b..", "..c..", "..d..", "..e..", "..f..", "..g.."\r\n\r\nRemember To Donate 25% To D-Net Software When You Win", MB_OK, MB_ICONNONE, MB_DEFBUTTON1);

Remember.....anyone wins useing this code.....i want 25% :D


EDIT, ok sol, ill see what i can do

Derek
10-09-2007, 02:57 PM
lol .. that's funny, even tho the code says to donate 25% - when i ran it it only said 5% ;)

Just for a laugh, I had a go at making something similar to this for the Lotto .. a while back now. I'd coded it to generate as many lines of numbers as entered in input box [we're talking min 10,000], then go thru to find the six most common numbers.
I figured you cant get much worse! The six most common numbers from so many lines stands a pretty good chance, right?

Yeah well i scrapped the idea when i ran it and it was still going when i got home from work the next day :wow
.. and it was running soooo sloooow - lol

What was i thinking?!

RizlaUK
10-09-2007, 03:06 PM
hmmm, well a small bug is going to lose me 20% of everyones winnings......:eek:....peps....read the small print....plz 25% for the first win, 50% for the second win, and 100% of all wins thereafter, as agreed by using this code :D


that sounds a good idea, if there is some way to to do it so it dosent lock up or run slow, i might look into something like that when iv nothing better to do

RizlaUK
10-09-2007, 03:22 PM
ok Solmos, heres the pc power part of the dll, b4 i do any more i want you to test this for me

i will add the monitor power and other stuff when i know this works ok

just one more thing.....do you want to add your own text to the conformation messages? (test the dll and you will see what i mean)

Solmos
10-09-2007, 04:16 PM
Thanks

But NO message confirmation please :rolleyes

tested system reboot in windows xp pro sp2

- NO force accion not work.
- system reboot no work all times

--------------------

1. System Poweroff (forced action or not)
2. System reboot (forced acction or not)
3. Close session (forced action or not)
4. Suspend (forced action or not)
5. Hibernate system (forced action or not)

¿6. Clearclipboard?

¿7. Search for multiple file extensions?

¿8. Get target shortcut? (return de real pach of de acces direct (file .lnk))

Add other function if is posible

Folder copy


and of course

1 = Show Screen Saver
2 = Standby Monitor
3 = Turn Off Monitor
4 = Turn On Monitor

RizlaUK
10-09-2007, 05:08 PM
ok, well iv finished other stuff i was working on for now so i can test now, i will have something for you late tonite or tomoz :yes

limboo
08-23-2008, 04:19 PM
i know it´s a long time ago and bringing a dead post to life again but do you have the completed dll?
because i need the one with vista support

jpdragon
01-09-2010, 03:10 PM
Where can I download the PCPower.dll file?

I would like to try this out for my project.

Scriptonite
01-09-2010, 11:20 PM
You can use the command line plugin (or bat files) and use the shutdown command if you can't get this dll.

RizlaUK
01-14-2010, 09:48 AM
Where can I download the PCPower.dll file?

look below :yes

i dont know if it works on vista tho, i haven't got the source any more