Geht das irgendwie?
Konkret m├Âchte ich die Leiste auf den anderen Bildschirm bringen, nachdem ich automatisiert den prim├ñren Monitor getauscht habe.
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Taskleiste verschieben?
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Taskleiste verschieben?
Google mal nach "SHAppBarMessage". Damit m├╝sste sich was machen lassen.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: Taskleiste verschieben?
auslesen ist kein Ding, aber verschieben lassen will sich das Ding nicht.
Code: Select all
import wx
import ctypes
import ctypes.wintypes
import win32gui
import eg
ABM_NEW = 0x0
ABM_REMOVE = 0x1
ABM_QUERYPOS = 0x2
ABM_SETPOS = 0x3
ABM_GETSTATE = 0x4
ABM_GETTASKBARPOS = 0x5
ABM_ACTIVATE = 0x6
ABM_GETAUTOHIDEBAR = 0x7
ABM_SETAUTOHIDEBAR = 0x8
ABM_WINDOWPOSCHANGED = 0x9
class APPBARDATA(ctypes.Structure):
_fields_ = [
("cbSize",ctypes.wintypes.DWORD),
("hWnd",ctypes.wintypes.HWND),
("uCallbackMessage", ctypes.c_ulong),
("uEdge", ctypes.c_ulong),
("rc", ctypes.wintypes.RECT),
("lParam",ctypes.wintypes.LPARAM),
]
def __repr__(self):
return """%s { %s }"""%(
self.__class__.__name__,
", ".join(
[ "%s=%r"%(field[0],getattr(self,field[0]))
for field in self._fields_
]
),
)
__str__ = __repr__
try:
hwnd = win32gui.FindWindow("Shell_TrayWnd", None)
except:
eg.PrintError("taskbar not found")
if hwnd:
bardata = APPBARDATA()
bardata.cbSize = ctypes.sizeof(bardata)
bardata.hWnd = hwnd
ctypes.windll.shell32.SHAppBarMessage(ABM_GETTASKBARPOS, ctypes.byref(bardata))
print bardata.rc.left, bardata.rc.top, bardata.rc.right, bardata.rc.bottom
if bardata.rc.top < 0:
bardata.rc.top = 1172
bardata.rc.bottom = 1202
print "moving to bottom"
else:
bardata.rc.top = -2
bardata.rc.bottom = 28
print "moving to top"
#win32gui.MoveWindow(hwnd, bardata.rc.left, bardata.rc.top, bardata.rc.right - bardata.rc.left, bardata.rc.bottom - bardata.rc.top, 1)
ctypes.windll.shell32.SHAppBarMessage(ABM_SETPOS, ctypes.byref(bardata))
ctypes.windll.shell32.SHAppBarMessage(ABM_GETTASKBARPOS, ctypes.byref(bardata))
print bardata.rc.left, bardata.rc.top, bardata.rc.right, bardata.rc.bottom
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Taskleiste verschieben?
Nach dem Link muss auch noch ein MoveWindow ausgef├╝hrt werden: http://www.thescripts.com/forum/thread247701.html
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: Taskleiste verschieben?
Ist ja auskommentiert auch noch im Code. Geht es bei dir? Evtl die Zahlen anpassen, falls dein Monitor nicht 1200 Zeilen hat.Bitmonster wrote:Nach dem Link muss auch noch ein MoveWindow ausgef├╝hrt werden: http://www.thescripts.com/forum/thread247701.html
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Taskleiste verschieben?
Geht bei mir auch nicht. Selbst mit dem ABM_QUERYPOS Trick nicht.
Auf MSDN hab ich diese Aussage eines Moderators gefunden:
Auf MSDN hab ich diese Aussage eines Moderators gefunden:
Scheint also so nicht machbar zu sein. Eine Notl├Âsung w├ñre es noch die Mausbewegung zu emulieren.Hello Offbeatmammal.
After doing some thorough research, I am afraid that there does not seem to be a way to programatically change the location of the taskbar. The taskbar is a user set control. As such, good user experience dictates that a user-set control, well, stay where the user leaves it and in the same state.
There is some detection about the taskbar that you can do and have your application react to whether the computer is orientated to landscape or portrait and where the taskbar is located. You have already very kindly mentioned the article I wrote about screen detection. In addition, there is the SHAppBarMessage[1] function, which specifically deals with the taskbar.
Sorry to dash your hopes.
Sincerely,
Eliot - MSFT
[1]http://msdn2.microsoft.com/en-us/library/ms647647.aspx
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!