-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken in 22621? #67
Comments
Hello @michalgregor, there is limited support for Insider versions. I'm researching this in my neighbor project in this issue MScholtes/PSVirtualDesktop#27. Since I guess that build 22631 will be the new Win 11 23H2 I do not support Insider 22621 which will die and in some releases work, in some not. Greetings Markus |
Thank you. For me, this came in through a cumulative update preview KB5029351 that I installed today. I rolled it back for now so hopefully it will keep working until I upgrade to 23H2 later this year. 🙂 |
have same problem on win11 22H8 update,today. |
Just out of curiosity – are these COM interfaces documented somewhere or how do you actually find the proper GUIDs and everything? |
Hello @michalgregor, the COM API is not documented and not supported and to illustrate this Microsoft changes the API including GUIDs every few months. There is a small group of OK, I have made two attempts to find out what changed in my campagnion project PSVirtualDesktop: The first attempt (attached VirtualDesktopV3.ps1) assumes that the API is the same from new Windows 11 build 22621 upwards. The second attempt (attached VirtualDesktopV4.ps1) assumes that the API from new build 22621 onwards is the same as the API from Windows Insider Beta before 8 March 2023 and that another API applies from Insider Dev onwards. Please remove the additional extension txt from the files and start Powershell in the directory of the scripts: . .\VirtualDesktopV3.ps1
Get-DesktopList exit Powershell now, start a new Powershell session and then . .\VirtualDesktopV4.ps1
Get-DesktopList Can you post what's happening? Greetings Markus |
Hi, today my systems also updates to KB5029351 and your tool did not work anymore (exception). I'm not taking place in the Windows Insider program. |
Hello, I can confirm this. After updating to 22621.2215, the script is running into an exception. I am not a member of the Windows Insider Program. |
This seems to work for the latest Windows versions: // Windows 11 23H2
MIDL_INTERFACE("3F07F4BE-B107-441A-AF0F-39D82529072C")
IVirtualDesktop1123H2 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE IsViewVisible(
IApplicationView * pView,
int* pfVisible) = 0;
virtual HRESULT STDMETHODCALLTYPE GetID(
GUID* pGuid) = 0;
};
// Windows 11 23H2
MIDL_INTERFACE("A3175F2D-239C-4BD2-8AA0-EEBA8B0B138E")
IVirtualDesktopManagerInternal1123H2 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetCount(
UINT * pCount) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveViewToDesktop(
IApplicationView* pView,
IVirtualDesktop1123H2* pDesktop) = 0;
// Since build 10240
virtual HRESULT STDMETHODCALLTYPE CanViewMoveDesktops(
IApplicationView* pView,
int* pfCanViewMoveDesktops) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentDesktop(
// HWND hWndOrMon,
IVirtualDesktop1123H2** desktop) = 0;
//// Since build 22H2
//virtual HRESULT STDMETHODCALLTYPE GetAllCurrentDesktops(
// IObjectArray** ppDesktops) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesktops(
// HWND hWndOrMon,
IObjectArray** ppDesktops) = 0;
virtual HRESULT STDMETHODCALLTYPE GetAdjacentDesktop(
IVirtualDesktop1123H2* pDesktopReference,
AdjacentDesktop uDirection,
IVirtualDesktop1123H2** ppAdjacentDesktop) = 0;
virtual HRESULT STDMETHODCALLTYPE SwitchDesktop(
// HWND hWndOrMon,
IVirtualDesktop1123H2* pDesktop) = 0;
// Since build 23H2
virtual HRESULT STDMETHODCALLTYPE SwitchDesktopAndMoveForegroundView(
IVirtualDesktop1123H2* pDesktop) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateDesktopW(
// HWND hWndOrMon,
IVirtualDesktop1123H2** ppNewDesktop) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveDesktop(
IVirtualDesktop1123H2* pDesktop,
// HWND hWndOrMon,
int index) = 0;
virtual HRESULT STDMETHODCALLTYPE RemoveDesktop(
IVirtualDesktop1123H2* pRemove,
IVirtualDesktop1123H2* pFallbackDesktop) = 0;
// Since build 10240
virtual HRESULT STDMETHODCALLTYPE FindDesktop(
GUID* desktopId,
IVirtualDesktop1123H2** ppDesktop) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesktopSwitchIncludeExcludeViews(
IVirtualDesktop1123H2 desktop,
IObjectArray** unknown1,
IObjectArray** unknown2) = 0;
virtual HRESULT STDMETHODCALLTYPE SetDesktopName(
IVirtualDesktop1123H2 desktop,
PCSTR name) = 0;
virtual HRESULT STDMETHODCALLTYPE SetDesktopWallpaper(IVirtualDesktop1123H2 desktop, PCSTR path) = 0;
virtual HRESULT STDMETHODCALLTYPE UpdateWallpaperPathForAllDesktops(PCSTR path) = 0;
virtual HRESULT STDMETHODCALLTYPE CopyDesktopState(IApplicationView pView0, IApplicationView pView1) = 0;
//virtual HRESULT STDMETHODCALLTYPE GetDesktopIsPerMonitor(int* pResult) = 0;
//virtual HRESULT STDMETHODCALLTYPE SetDesktopIsPerMonitor(bool state) = 0;
};
// Windows 11 23H2
MIDL_INTERFACE("B287FA1C-7771-471A-A2DF-9B6B21F0D675")
IVirtualDesktopNotification1123H2 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopCreated(
IObjectArray * p0,
IVirtualDesktop1123H2* pDesktop) = 0;
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopDestroyBegin(
IObjectArray* p0,
IVirtualDesktop1123H2* pDesktopDestroyed,
IVirtualDesktop1123H2* pDesktopFallback) = 0;
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopDestroyFailed(
IObjectArray* p0,
IVirtualDesktop1123H2* pDesktopDestroyed,
IVirtualDesktop1123H2* pDesktopFallback) = 0;
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopDestroyed(
IObjectArray* p0,
IVirtualDesktop1123H2* pDesktopDestroyed,
IVirtualDesktop1123H2* pDesktopFallback) = 0;
virtual HRESULT STDMETHODCALLTYPE Unknown1(
int nNumber) = 0;
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopMoved(
IObjectArray* p0,
IVirtualDesktop1123H2* pdesktop,
int nFromIndex, int nToIndex) = 0;
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopRenamed(
IVirtualDesktop1123H2* pdesktop,
PCSTR name) = 0;
virtual HRESULT STDMETHODCALLTYPE ViewVirtualDesktopChanged(
IApplicationView* pView) = 0;
virtual HRESULT STDMETHODCALLTYPE CurrentVirtualDesktopChanged(
IObjectArray* p0,
IVirtualDesktop1123H2* pDesktopOld,
IVirtualDesktop1123H2* pDesktopNew) = 0;
virtual HRESULT STDMETHODCALLTYPE VirtualDesktopWallpaperChanged(
IVirtualDesktop1123H2* pdesktop,
PCSTR path) = 0;
};
// https://gitter.im/glsorre/amethystwindows?at=5ffd913403529b296be5e65d
//HRESULT Proc3(/* Stack Offset: 8 */[In] IObjectArray* p0, /* Stack Offset: 16 */[In] IVirtualDesktop* p1);
//HRESULT Proc4(/* Stack Offset: 8 */[In] IObjectArray* p0, /* Stack Offset: 16 */[In] IVirtualDesktop* p1, /* Stack Offset: 24 */[In] IVirtualDesktop* p2);
//HRESULT Proc5(/* Stack Offset: 8 */[In] IObjectArray* p0, /* Stack Offset: 16 */[In] IVirtualDesktop* p1, /* Stack Offset: 24 */[In] IVirtualDesktop* p2);
//HRESULT Proc6(/* Stack Offset: 8 */[In] IObjectArray* p0, /* Stack Offset: 16 */[In] IVirtualDesktop* p1, /* Stack Offset: 24 */[In] IVirtualDesktop* p2);
//HRESULT Proc7(/* Stack Offset: 8 */[In] int p0);
//HRESULT Proc8(/* Stack Offset: 8 */[In] IObjectArray* p0, /* Stack Offset: 16 */[In] IVirtualDesktop* p1, /* Stack Offset: 24 */[In] int p2, /* Stack Offset: 32 */[In] int p3);
//HRESULT Proc9(/* Stack Offset: 8 */[In] IVirtualDesktop* p0, /* Stack Offset: 16 */[In] FC_USER_MARSHAL* p1);
//HRESULT Proc10(/* Stack Offset: 8 */[In] IApplicationView* p0);
//HRESULT Proc11(/* Stack Offset: 8 */[In] IObjectArray* p0, /* Stack Offset: 16 */[In] IVirtualDesktop* p1, /* Stack Offset: 24 */[In] IVirtualDesktop* p2);
//HRESULT Proc12(/* Stack Offset: 8 */[In] IVirtualDesktop* p0, /* Stack Offset: 16 */[In] FC_USER_MARSHAL* p1);
//}
// Windows 11 23H2
MIDL_INTERFACE("0CD45E71-D927-4F15-8B0A-8FEF525337BF") // W11: UNCHANGED?
IVirtualDesktopNotificationService1123H2 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Register(
IVirtualDesktopNotification1123H2* pNotification,
DWORD * pdwCookie) = 0;
virtual HRESULT STDMETHODCALLTYPE Unregister(
DWORD dwCookie) = 0;
}; However, there is still 1 problem: the CurrentVirtualDesktopChanged notification never happens! ViewVirtualDesktopChanged arrives correctly, but CurrentVirtualDesktopChanged does not. What could be the reason? Regards! |
It seems the "CurrentVirtualDesktopChanged" function was removed from "IVirtualDesktopNotification" interface - it is called when the wallpaper changes, which means the "next" function after "ViewVirtualDesktopChanged" is "VirtualDesktopWallpaperChanged" and not "CurrentVirtualDesktopChanged" like in previous versions... Strange - the function seems to be important to detect when the user changes the virtual desktop. Does anybody have more info on this? Regards! |
Hello @FCrane, cannot tell anything about virtual desktop notifications since this is not implemented in VirtualDesktop. Greetings Markus |
Released a new version of VirtualDesktop today. VirtualDesktop11-23H2.cs is intended to work with Windows 11 22H2 beginning with release 2215 and with the Insider versions of Windows 11. As I do not have a test environment, this is associated with certain uncertainties... Greetings Markus |
Current virtual desktop change is working, you have to remove the monitors parameter:
TO:
|
I reinstalled the update and tested, I can confirm that it works perfectly for my use case of moving windows to another desktop. Keeping this working seems like it must be a lot of work for you with the changing interfaces. Is there any way to support your work (buying an app, donating some money, etc.)? |
Hi! This is not working on my test systems for release 2215 and later... CurrentVirtualDesktopChanged is never called by the system, no matter which parameters are defined. Regards! |
@FCrane You need to remove all monitor parameters. I'm using Rust these days but you can see the IVirtualDesktopNotification definition here: https://github.com/Ciantic/VirtualDesktopAccessor/blob/051881f893d41655493668e76bba6c19c8b2ddca/src/interfaces.rs#L343 on line 343 forwards is equivalent Rust code. Notice I have removed all IObjectArray (the monitor parameters) from other methods as well like destroyed, moved,... you have to do the same. |
@Ciantic: Great, thanks!! |
Hello, I released a new bug fix version 1.15 today - tested only against Windows 11 22H2.2215. It corrects issues with creating, removing and naming desktops on Windows 11 22H2.2215 (reason for the error: SwitchDesktopAndMoveForegroundView is missing in 2215). I do not know, if this works on Insider versions build 22631 and up. It would be helpful if you try VirtualDesktop11-23H2.exe /New if you own an Insider version and post the result and the build number here. Greetings Markus |
Thank you very much for your offer but I'm (still) doing this for fun. |
Hey, Inspired by @NyaMisty's solution (GetVirtualDesktopAPI_DIA), I created a dumper that works with the latest versions of Windows 11: I set up some virtual machines and created dumps for all the current live releases (including the insider versions). You can find these dumps in the dumper's repository. I also tested your latest 23H2 release (v1.15), and it works great for all versions after A new |
Hello @slnz00, thank you for your very valuable information and the great script slnz00/VirtualDesktopDumper I will integrate the won informations soon. Greetings Markus |
Issue solved |
It seems that the tool is broken again in Win11 on 10.0.22621 Build 22621.
I am getting this error (with the VirtualDesktopInsider version, but I tried all, none works):
The text was updated successfully, but these errors were encountered: