Autor Beitrag
Ebil
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131



BeitragVerfasst: So 15.06.08 20:54 
Ich will bei der eingabe einer tastenkombination (alt+strg zb.), ein bestimmtes Formular nach ganz vorne gebracht wird und alle anderen anwendungen dahinter liegen.
Hab sowas noch nie gemacht, wie funktioniert das?
Hab leider auch nichts sinnvolles gefunden :/

Gruß
Ebil
j.klugmann
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 15.06.08 21:12 
:welcome: !
willst du dass das formular immer solange es aktiviert ist im Vordergrund bleibt oder nur
für eine bestimmte Zeit?
Du musst also einen system weiten Hotkey setzen:
In der Projectdatei äönderst du erstmal das:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
program Project1;
uses Forms, Unit1 in 'Unit1.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.ShowMainForm := False; // <- !!!! /////FORM WIRD NICHT ANGEZEIGT
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

dann in die normale unit zurück:
ausblenden volle Höhe Delphi-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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;


type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
protected
procedure hotkey(var msg:TMessage); message WM_HOTKEY; // !
private
id : Integer;
end;

procedure TForm1.hotkey(var msg:TMessage);
begin
if (msg.LParamLo = MOD_CONTROL+MOD_ALT) and (msg.LParamHi = 83) then begin
self.Visible := not self.Visible;
form1.formstyle:=FSSTAYONTOP;///IM VORDERGRUND
if self.Visible then
self.WindowState := wsNormal
else
self.WindowState := wsMinimized
end
end;
procedure FormCreate(Sender: TObject);
begin
id:= GlobalAddAtom('hotkey1');
RegisterHotKey(handle,id,MOD_CONTROL + MOD_ALT,83)
end;

hab noch nich ausprobiert! :wink: :wink:
Ebil Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131



BeitragVerfasst: Mo 16.06.08 00:31 
Hu,
Funktioniert leider nicht :/
Aber falls das relevant ist, ich erzeuge erst eine hauptform (frmMain) und will dann eine andere ( die erst unsichtbare, dann per shortcut aufrufbare), aufrufen lassen.
Hab den code auch in meiner hauptform ausprobiert, ging leider nicht ( hab natürlich das self, verändert...).
Ich teste mal weiter~

Ebil

//Edit:
Oha da hab ich was hammergeiles gefunden
www.delphi-library.d...rarbeiten_19371.html
Hoffe ich darf den link posten...

Dort steht alles genau beschrieben, trozdem danke an klugmann, auch wenn ich insgeheim doch gehofft hab das es nicht so kompliziert ist.

Ist es am ende ja nun auch garnicht :P
j.klugmann
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 16.06.08 10:29 
also mein quelltext funktioniert bei mir. :wink:

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

kann ich mal den debugger-fehler sehen?
wäre mal ganz lustig. :wink:
Ebil Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131



BeitragVerfasst: Sa 21.06.08 23:04 
Es gab keinen fehler, es hat einfach nicht funktioniert =o