Fenster Vista-like schließen

Hier könnt Ihr gute, von Euch geschriebene Codes posten. Sie müssen auf jeden Fall funktionieren und sollten möglichst effizient, elegant und beispielhaft oder einfach nur cool sein.
Benutzeravatar
Scarabol
Beiträge: 1427
Registriert: 30.11.2005 21:00

Beitrag von Scarabol »

@Tafkadasom2k5
Die beiden Funktionen die du vorschlägst funktionieren leider nicht flackert trotzdem...

LockWindowUpdate_() ist schon nicht schlecht, aber dabei müsste der Fensterinhalt erhalten bleiben...

Das Flackern liegt wohl an ResizeWindow() wird in der Hilfe ja auch angesprochen, das dieses Problem auftreten kann. (siehe SmartWindowRefresh)

Ich probier mal mit API-Resize...

Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch: PureArea

PB-V: 4
WinXP
Benutzeravatar
inc.
Beiträge: 348
Registriert: 27.10.2004 12:25

Beitrag von inc. »

Code: Alles auswählen

Procedure TRound(Number.f) 
  If Number-Int(Number) < 0.5 
    ProcedureReturn Int(Number) 
  Else 
    ProcedureReturn Int(Number)+1 
  EndIf 
EndProcedure 
IMHO gehts so fixer?

Code: Alles auswählen

Macro Round2Nearest(___val___)
   Int(___val___# + 0.5 )
EndMacro 
Hier gibts die OOP Option für PureBasic.
Benutzeravatar
rolaf
Beiträge: 3843
Registriert: 10.03.2005 14:01

Beitrag von rolaf »

Wie wär es damit:

1. Screenshot vom Fenster machen
2. Fenster schließen (Kann man auch nach 4. machen um keinen Übergang zu sehen!)
3. Randloses-Fenster gleicher Größe öffnen
4. Screenshot rein
5. bis X. Fenster verkleinern, Screenshot anpassen, Transparenz steigern , (Schleife)
Y. Fenster schließen
:::: WIN 10 :: PB 5.73 :: (x64) ::::
Benutzeravatar
#NULL
Beiträge: 2237
Registriert: 20.04.2006 09:50

Beitrag von #NULL »

hatte ich probiert. war irre langsam.
my pb stuff..
Bild..jedenfalls war das mal so.
Benutzeravatar
Tafkadasom2k5
Beiträge: 1578
Registriert: 13.08.2005 14:31
Kontaktdaten:

Beitrag von Tafkadasom2k5 »

Scarabol hat geschrieben:Ich probier mal mit API-Resize...
Versuchs mal damit
Win32API.hlp hat geschrieben:The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.

BOOL SetWindowPos(

HWND hWnd, // handle of window
HWND hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
UINT uFlags // window-positioning flags
);
Parameters

hWnd
Identifies the window.

hWndInsertAfter
Identifies 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 Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP Places the window at the top of the Z order.
HWND_TOPMOST Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
For more information about how this parameter is used, see the following Remarks section.

[X,Y,width,height schneid ich mal weg ;) ]

uFlags
SWP_DRAWFRAME
Draws a frame (defined in the window’s class description) around the window.
SWP_FRAMECHANGED
Sends a WM_NCCALCSIZE message to the window, even if the window’s size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window’s size is being changed.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS
Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE
Retains the current position (ignores the X and Y parameters).
SWP_NOOWNERZORDER
Does not change the owner window’s position in the Z order.
SWP_NOREDRAW
Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION
Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING
Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER
Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW
Displays the window.
OpenNetworkConnection() hat geschrieben:Versucht eine Verbindung mit dem angegebenen Server aufzubauen. 'ServerName$' kann eine IP-Adresse oder ein voller Name sein (z.B.: "127.0.0.1" oder "ftp.home.net").
php-freak hat geschrieben:Ich hab die IP von google auch ned rausgefunden!
Benutzeravatar
AND51
Beiträge: 5220
Registriert: 01.10.2005 13:15

Beitrag von AND51 »

@ Tafkadasom2k5:
Alles na Frage der Perpektive :roll:

@ Topic:
Ich höre was von LockWindowUpdate_()? Refreshprobleme? Ich würde es mal mit DisableWindow() probieren, da brauchste dann keinen (manuellen) Refresh. (Ich hoffe, das passte einigermaßen zum Thema)
PB 4.30

Code: Alles auswählen

Macro Happy
 ;-)
EndMacro

Happy End
Benutzeravatar
Scarabol
Beiträge: 1427
Registriert: 30.11.2005 21:00

Beitrag von Scarabol »

Hi Leute,

Problem ist der PB interne Refresh bei ResizeWindow()...

Ich werd mal den Code von Tafkadasom2k5 genauer unter die Lupe nehmen..., vielleicht hat die API diesen BUG ja nicht...

Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch: PureArea

PB-V: 4
WinXP
Benutzeravatar
hardfalcon
Beiträge: 3447
Registriert: 29.08.2004 20:46

Beitrag von hardfalcon »

Wenn euch das Resizen zu langsam geht, versucht es vll. mal mit nem WindowedScreen(). Dann könnt ihr das Sprite (=den Screenshot vom zu minimierenden Fenster) ja auch von der Grafikkarte hardwarebeschleunigt verkleinern lassen. Stellt sich natürlich nur die Frage, ob der WindowedScreen() selbst schnell genug geladen ist...
Benutzeravatar
Scarabol
Beiträge: 1427
Registriert: 30.11.2005 21:00

Beitrag von Scarabol »

So Leute hab das Flackern gelöst!!!

Code: Alles auswählen

Procedure Vista_CloseWindow(win, time)
  Protected x, y, w, h, t.f, winid, d
  winid = WindowID(win)
  x = WindowX(win)
  y = WindowY(win)
  w = WindowWidth(win)
  h = WindowHeight(win)
  t.f = 255
  s.f = 255/10
  d = Int(time/10 + 0.5)
  SetWindowLong_(winid, #GWL_EXSTYLE, GetWindowLong_(winid, #GWL_EXSTYLE) | #WS_EX_LAYERED)
  For i = 1 To 10
    SetLayeredWindowAttributes_(winid,-1,Int(t),2|1)
    Delay(d)
    SetWindowPos_(winid, 0, x+Int(w*0.01+05), y+Int(h*0.01+0.5), Int(w*0.99+0.5), Int(h*0.99+0.5), 0)
    x+Int(w*0.005+0.5)
    y+Int(h*0.005+0.5)
    w = Int(w*0.99+0.5)
    h = Int(h*0.99+0.5)
    t - s
  Next
  CloseWindow(win)
EndProcedure

OpenWindow(1, #PB_Ignore, #PB_Ignore, 400, 300, "test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget)
CreateGadgetList(WindowID(1))
  ButtonGadget(1, 10, 10, 80, 20, "test")

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Vista_CloseWindow(1, 200)
Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch: PureArea

PB-V: 4
WinXP
Benutzeravatar
X0r
Beiträge: 2770
Registriert: 15.03.2007 21:47
Kontaktdaten:

Beitrag von X0r »

Nicht flüssig.
Antworten