Autor Beitrag
Alice
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Fr 05.01.07 21:37 
hi all,

ich würde gerne von sagen wir einmal einem laufendem notepad den fentertyp ändern.
also z.b. auf dialogtype setzen oder ganz wegblenden.
wie stelle ich das am besten an?

thx

alice
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Fr 05.01.07 23:57 
Ich weiß nciht genau, vielleicht geht es mit SetWindowLong
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 06.01.07 02:03 
Nicht nur vielleicht ;-), das geht mit GWL_STYLE als zweitem Parameter und dem entsprechenden Wert aus der Liste der Styles als dritten Parameter. Mehr dazu hier:
msdn.microsoft.com/l...ns/setwindowlong.asp
Alice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Sa 06.01.07 08:31 
hi,

erst mal thx für die tips!
folg. habe ich gefunden (geht wunderbar für die EINE form / appl.):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.HideTitlebar; 
var 
  Style: Longint; 
begin 
  if BorderStyle = bsNone then Exit; 
  Style := GetWindowLong(Handle, GWL_STYLE); 
  if (Style and WS_CAPTION) = WS_CAPTION then 
  begin 
    case BorderStyle of 
      bsSingle, 
      bsSizeable: SetWindowLong(Handle, GWL_STYLE, Style and 
          (not (WS_CAPTION)) or WS_BORDER); 
      bsDialog: SetWindowLong(Handle, GWL_STYLE, Style and 
          (not (WS_CAPTION)) or DS_MODALFRAME or WS_DLGFRAME); 
    end; 
    Height := Height - GetSystemMetrics(SM_CYCAPTION); 
    Refresh; 
  end; 
end;


aber ich will ja z.b. das notepad borderless bringen und nicht die eigene app.
wie bekomme ich nun am besten das windowhandle von z.b. einem laufendem notepad?


alice

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 06.01.07 11:51 
Wie wärs mit Suche in: Delphi-Forum FINDWINDOW?
Alice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Di 09.01.07 12:07 
hi,

ja mit findwindow hat es geklappt, ich habe dann falls ich per findwindow keine inst. finden konnte
per die appl. (in diesem falle outl.express) gestartet. per shellexecute.

das klappt auch alles nur weiss ich nicht genau wann ich danach (nach dem aufruf von shellexecute)
denn rahmen ausblenden soll/kann. falls ich das zu früh tue klappt es nicht und sec.lang will ich nicht warten...

vorgeh.weise:

1* schauen ob eine instanz läuft, -> findwindow

2* wenn nein dann per shellexecute starten

(warten? wann ist die appl. kompl. geladen?
wann kann ich den rahmen im nächsten schritt ausblenden?)


3* wenn ja dann per SetWindowLong den rahmen ausblenden (hwnd über findwindow)

... und thx für die tipps... :-)

alice
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.01.07 15:32 
Hmm, weiß ich aus dem Kopf auch nicht. Irgendwas gabs da. Ich seh mal nach...

Eine Lösung müsste aber sein:
Mit GetWindowLong überprüpfen, ob das geklappt hat und ggf. mit Sleep 50 ms oder so wartenm und es erneut versuchen. Vielleicht am besten mit while.
Aber Vorsicht! Die Schleife muss dann auch nach einer gewissen Zeit auf jeden Fall abbrechen (falls was schief geht...).
Also so in der Art:
Solange noch nicht 5 Minuten rum sind (GetTickCount ;-)) UND GetWindowLong einen falschen Wert liefert:
1. 50 ms warten
2. Application.ProcessMessages, damit das Programm nicht hängt
3. SetWindowLong