Autor Beitrag
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 08.08.02 12:55 
Hi,
wie kann ich Windows 2000/XP via Delphi in den Ruhezustand fahren? Diese Funktion ist im Windows aktiviert und der angemeldete Benutzer verfügt über die entsprechenden Rechte. Kann mir jemand sagen, wie ich diese Aufgabe bewältigen kann?

Danke für alle Antworten,
maxk
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Fr 09.08.02 10:11 
Titel: ADF Components
:oops: Tja, ich habe jetzt in einem anderen Beitrag eine Antwort gefunden. Mit den ADF Components kann man diese Aufgabe bewältigen. Wobei der funktionierende Sourcecode natürlich mal interessant wäre...
cbs
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 207
Erhaltene Danke: 1



BeitragVerfasst: Fr 09.08.02 19:45 
oder das hier?

den Standby Modus einschalten (swissdelphicenter.ch)

ausblenden Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject); 
begin 
  SendMessage(Handle, WM_SYSCOMMAND, SC_SCREENSAVE, 1); 
end;


test it
Arakis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 344



BeitragVerfasst: Mi 14.08.02 14:19 
cbs hat folgendes geschrieben:
oder das hier?

den Standby Modus einschalten (swissdelphicenter.ch)

ausblenden Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject); 
begin 
  SendMessage(Handle, WM_SYSCOMMAND, SC_SCREENSAVE, 1); 
end;


test it


StandBy-Modus und Ruhestand ist nicht das selbe. Beim Ruhezustand wird der RAM + CPU-register komplett auf Festplatte geschrieben und der Strom kann aus. Beim StandBy-Modus wird der computer nur auf minimalem Energie-Modus gebracht, so ziemlich alles schaltet sich ab, nur der RAM und die CPU-Register müssen noch weiterhin unter Strom stehen.

Folgende Info gibt es dazu bei MSDN:
msdn.microsoft.com/l...power/power_84md.asp
Da brauchtst du aber vermutlich eine überstzte version der Powrprof.h, die du dir aber irgendwo bei www.delphi-jedi.org runterladen kannst.

Bis dann
user defined image

_________________
Mit dem Computer löst man Probleme, die man ohne ihn nicht hätte.
Entwickler von SpaceTrek: The New Empire - Siehe Hompage!
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mi 14.08.02 14:57 
Probier's mal so:

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
var
  _SetSuspendState: function (Hibernate, ForceCritical, DisableWakeEvent: BOOL): BOOL
  stdcall = nil;

  function LinkAPI(const module, functionname: string): Pointer; forward;

function SetSuspendState(Hibernate, ForceCritical,
  DisableWakeEvent: Boolean): Boolean;
begin
  if not Assigned(_SetSuspendState) then
    @_SetSuspendState := LinkAPI('POWRPROF.dll', 'SetSuspendState');
  if Assigned(_SetSuspendState) then
    Result := _SetSuspendState(Hibernate, ForceCritical,
      DisableWakeEvent)
  else
    Result := False;
end;

function LinkAPI(const module, functionname: string): Pointer;
var
  hLib: HMODULE;
begin
  hLib := GetModulehandle(PChar(module));
  if hLib = 0 then
    hLib := LoadLibrary(PChar(module));
  if hLib <> 0 then
    Result := getProcAddress(hLib, PChar(functionname))
  else
    Result := nil;
end;

// Beispielaufruf:

procedure TForm1.Button1Click(Sender: TObject);
begin
  SetSuspendState(True, False, False);
end;


tom
cbs
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 207
Erhaltene Danke: 1



BeitragVerfasst: Mi 14.08.02 19:15 
@Arakis: ok danke für die info, war mir nicht klar das es da unterschiede gibt
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Fr 16.08.02 10:05 
@toms: Danke, ich werde das Script mal testen

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Bela Urlaub
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Di 27.05.03 22:56 
Geht das bei allen Windows?

_________________
mensch, menschen können auch probleme haben...
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 28.05.03 11:22 
Bela Urlaub hat folgendes geschrieben:
Geht das bei allen Windows?

Klares Jein! Der Ruhezustand ist ab Windows 98 verfügbar, funktioniert (nach eigener Erfahrung) aber nur auf wenigen Rechnern. Hier sollte mal lieber externe Programme benutzen, die den Speichern "capturn". Ab Windows 2000 funktioniert der Ruhezustand auf allen Computern (muss natürlich vorher aktiviert werden).

maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
BoMbY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Do 05.06.03 10:35 
Hallo,

Du könntest es auch mal über die "Windows Native API Interface Unit" und die Funktion

NtSetSystemPowerState(PowerActionHibernate, PowerSystemUnspecified, 0);

versuchen.

Die Unit bekommt man hier: members.chello.nl/m.vanbrakel2/

Ich nehme an man braucht dafür auch das SE_SHUTDOWN_NAME privilege, ich hab die Funktion selber nie ausprobiert...

m.f.g.
BoMbY