Autor Beitrag
Premaider
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 04.02.12 13:12 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
HWND := FindWindow("Minecraft", "Minecraft Launcher");
SetWindowPos(HWND ,HWND_TOPMOST,1080,720,0,0,SWP_NOACTIVATE or SWP_NOMOVE);
end;

Ist für Button1.

Er zeigt mir an, dass ( erwartet aber := gefunden wurde in der FindWindow-Zeile.

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Moderiert von user profile iconNarses: Titel geändert, war: "Was ist an meinem Schript falsch ? [Delphi7]".
Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Sa 04.02.2012 um 15:38
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Sa 04.02.12 13:17 
Hallo

die Anführungszeichen können nicht richtig sein.
Zitat:
'
statt
Zitat:
"


Gruß Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)

Für diesen Beitrag haben gedankt: Premaider
Premaider Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 04.02.12 13:20 
Immer noch der selbe Fehler
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Sa 04.02.12 13:21 
user profile iconPremaider hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
  HWND := FindWindow("Minecraft", "Minecraft Launcher");
  SetWindowPos(HWND ,HWND_TOPMOST,1080,720,0,0,SWP_NOACTIVATE or SWP_NOMOVE);
end;


Ist für Button1.

Er zeigt mir an, dass ( erwartet aber := gefunden wurde in der FindWindow-Zeile.

Die Fehlermeldung sagt es eigentlich schon:


ausblenden Delphi-Quelltext
1:
HWND(FindWindow('Minecraft''Minecraft Launcher'));					


Zum einen wird eine Klammer erwartet und zum anderen sind die Anführungszeichen falsch.


PS 1:

SetWindowPos ist auch falsch:
Zitat:

Syntax

BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);


PS 2:
Bitte verwende die Delphi-Tags beim posten von Quelltext.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)


Zuletzt bearbeitet von Blawen am Sa 04.02.12 13:26, insgesamt 1-mal bearbeitet

Für diesen Beitrag haben gedankt: Premaider
Premaider Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 04.02.12 13:25 
Zitat:
[Fehler] Unit1.pas(33): Anweisung erforderlich, aber Ausdruck vom Typ 'HWND' gefunden
[Fehler] Unit1.pas(34): '(' erwartet, aber ',' gefunden
[Fehler] Unit1.pas(34): Anweisung erforderlich, aber Ausdruck vom Typ 'Integer' gefunden
[Fataler Fehler] Project1.dpr(5): Verwendete Unit 'Unit1.pas' kann nicht compiliert werden


Jetzt kommen diese Fehler.Tut mir leid hab damit grad erst in Informatik angefangen ;D


Zuletzt bearbeitet von Premaider am Sa 04.02.12 13:30, insgesamt 1-mal bearbeitet
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Sa 04.02.12 13:29 
Im oberen Beitrag habe ich die Syntax des Befehls aufgeführt.
Um die Syntax (u.ä.) von Befehlen zu erfahren, genügt es, den Cursor auf das betreffende Wort zu setzen und die F1-Taste zu drücken. Sehr oft gibt es auch einen Beispielquelltext mit dazu.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)

Für diesen Beitrag haben gedankt: Premaider
Premaider Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Sa 04.02.12 13:36 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
begin
HWND(FindWindow('Minecraft''Minecraft Launcher'));
BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int 1,
int 1,
int 1080,
int 720,
UINT uFlags
);end;


So sieht es im moment aus. Hab da nicht so viel Ahnung von vllt 1%.
Er zeigt mit aber immer noch an, dass etwas bei FindWindow nicht stimmt.

Moderiert von user profile iconNarses: Quote- durch Delphi-Tags ersetzt
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Sa 04.02.12 14:57 
Moderiert von user profile iconNarses: Komplett-Zitat des letzten Beitrags entfernt.

Es handelt sich nur um die Syntax...
Dein Code war nicht komplett falsch. Wenn Du Deinen Code mit der Syntax vergleichst, findets Du den Fehler sicherlich selber.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Sa 04.02.12 22:37 
Ich hoffe, Du hast unterdessen die Fehler entdeckt.
Falls nicht, habe ich mal Dein Beispiel angepasst, wobei ich nicht beurteilen kann, ob Du das gefundene Fenster wirklich auf 0-Pixel zurücksetzen willst. Überprüfe auch die uFlags.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var
  iHandle : Integer;
begin
  iHandle := HWND(FindWindow('Minecraft''Minecraft Launcher'));
  SetWindowPos(iHandle, HWND_TOPMOST,1080,720,0,0, SWP_NOACTIVATE or SWP_NOMOVE);
end;


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:
38:
39:
40:
41:
42:
43:
44:
45:
Syntax:
-------

BOOL SetWindowPos(          
    HWND hWnd,
    HWND hWndInsertAfter,
    int X,
    int Y,
    int cx,
    int cy,
    UINT uFlags
);

Parameters:
-----------

hWnd [in] 
  Handle to the window.
hWndInsertAfter [in] 
  Handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the 
  following values.
  HWND_BOTTOM
  HWND_NOTOPMOST
  HWND_TOP
  HWND_TOPMOST
X [in] - Specifies the new position of the left side of the window, in client coordinates. 
Y [in] - Specifies the new position of the top of the window, in client coordinates. 
cx [in] - Specifies the new width of the window, in pixels. 
cy [in] - Specifies the new height of the window, in pixels. 
uFlags [in] -   Specifies the window sizing and positioning flags. This parameter can be a combination of the following values. 
  SWP_ASYNCWINDOWPOS
  SWP_DEFERERASE
  SWP_DRAWFRAME
  SWP_FRAMECHANGED
  SWP_HIDEWINDOW
  SWP_NOACTIVATE
  SWP_NOCOPYBITS
  SWP_NOMOVE  --> Retains the current position (ignores X and Y parameters).
  SWP_NOOWNERZORDER
  SWP_NOREDRAW   
  SWP_NOREPOSITION  --> Same as the SWP_NOOWNERZORDER flag.
  SWP_NOSENDCHANGING
  SWP_NOSIZE
  SWP_NOZORDER
  SWP_SHOWWINDOW

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)