vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Brandneu! sevEingabe v3.0 - Das Eingabecontrol der Superlative!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB & Windows API
SetWindowPlacement 
Autor: emersonlakeandpalmer
Datum: 25.10.11 11:30

Hallo,

ich benötige eine Routine, welche in einer gemischten XP 32bit und Win7 64bit Umgebung (mit der alten Tastleiste) in der Lage, ist ein Fenster falls nur verdeckt, in den Vordergrund zu bringen (funktionert!) oder wenn es minimiert in der Taskleiste (Tray währe der nächste Schritt) dieses zu maximieren und dann in den Vordergrund zu bringen.

WndPlcmt.showCmd liefert jedoch je nach Lust und Laune 1 oder 3 und selbst wenn man
die Abfrage umgeht WndPlcmt.showCmd=SW_SHOWMAXIMIZED setzt, passiert absolut nichts.

Weiß jemand Rat?

Gruß elp

Modulcode:

Public Const SW_HIDE = 0 'Hide the window
Public Const SW_MAXIMIZE = 3 'Maximize the window
Public Const SW_MINIMIZE = 6 'Minimize the window
Public Const SW_RESTORE = 9 'Restore the window (not maximized nor minimized)
Public Const SW_SHOW = 5 'Show the window
Public Const SW_SHOWMAXIMIZED = 3 'Show the window maximized
Public Const SW_SHOWMINIMIZED = 2 'Show the window minimized
Public Const SW_SHOWMINNOACTIVE = 7 'Show the window minimized but do not activate it
Public Const SW_SHOWNA = 8 'Show the window in its current state but do not activate it
Public Const SW_SHOWNOACTIVATE = 4 'Show the window in its most recent size and position but do not activate it
Public Const SW_SHOWNORMAL = 1 'Show the window and activate it (as usual)

Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Declare Function SetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long

Public Type POINTAPI
x As Long
y As Long
End Type

Public Type WINDOWPLACEMENT
Length As Long
flags As Long
showCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type

Function ActivateWindow(xhWnd&) As Boolean
Dim Result&, WndPlcmt As WINDOWPLACEMENT

With WndPlcmt
.Length = Len(WndPlcmt)
Result = GetWindowPlacement(xhWnd&, WndPlcmt)
If Result Then
If .showCmd = SW_SHOWMINIMIZED Then '<=
.flags = 0
.showCmd = SW_SHOWMAXIMIZED
Result = SetWindowPlacement(xhWnd&, WndPlcmt) '<=
Else
Call SetForegroundWindow(xhWnd)
Result = BringWindowToTop(xhWnd&)
End If
If Result Then ActivateWindow = True
End If
End With
End Function
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
SetWindowPlacement5.742emersonlakeandp...25.10.11 11:30
Re: SetWindowPlacement2.993ModeratorMartoeng07.11.11 16:59
Re: SetWindowPlacement3.154emersonlakeandp...09.11.11 09:59
Re: SetWindowPlacement3.105ModeratorMartoeng18.12.11 14:47
Re: SetWindowPlacement2.869emersonlakeandp...18.12.11 17:51
Re: SetWindowPlacement2.939ModeratorMartoeng18.12.11 18:18
Re: SetWindowPlacement2.755alicerobert05.03.13 08:40

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel