It is currently Thu Sep 19, 2019 3:53 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: IVirtualDesktopManager (Windows 10)
PostPosted: Sat Aug 03, 2019 6:57 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Mar 11, 2009 4:06 pm
Posts: 130
Location: NL
Any way to use this interface from PB?

https://docs.microsoft.com/en-us/window ... topmanager

The IVirtualDesktopManager interface has these methods.

Method Description
IVirtualDesktopManager::GetWindowDesktopId Gets the identifier for the virtual desktop hosting the provided top-level window.
IVirtualDesktopManager::IsWindowOnCurrentVirtualDesktop Indicates whether the provided window is on the currently active virtual desktop.
IVirtualDesktopManager::MoveWindowToDesktop Moves a window to the specified virtual desktop.

The API is incomplete IMHO (missing enumeration for example). You wonder why MS started from scratch instead of improving the existing flat win32 virtual desktop API... but whatever.


Top
 Profile  
Reply with quote  
 Post subject: Re: IVirtualDesktopManager (Windows 10)
PostPosted: Sun Aug 18, 2019 8:09 pm 
Offline
New User
New User

Joined: Sun Aug 18, 2019 8:07 pm
Posts: 5
Rinzwind wrote:
Any way to use this interface from PB?

https://docs.microsoft.com/en-us/window ... topmanager

The IVirtualDesktopManager interface has these methods.

Method Description
IVirtualDesktopManager::GetWindowDesktopId Gets the identifier for the virtual desktop hosting the provided top-level window.
IVirtualDesktopManager::IsWindowOnCurrentVirtualDesktop Indicates whether the provided window is on the currently active virtual desktop.gimp freejobalert notepad++
IVirtualDesktopManager::MoveWindowToDesktop Moves a window to the specified virtual desktop.

The API is incomplete IMHO (missing enumeration for example). You wonder why MS started from scratch instead of improving the existing flat win32 virtual desktop API... but whatever.

I also have the same question. Help is appreciated.


Thanks and Regards,
Oliver


Last edited by OliverS on Thu Aug 22, 2019 6:17 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: IVirtualDesktopManager (Windows 10)
PostPosted: Sun Aug 18, 2019 9:02 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 514
I came up with this:
Code:
EnableExplicit

Interface IVirtualDesktopManager
  IsWindowOnCurrentVirtualDesktop.i(*topLevelWindow)
  GetWindowDesktopId.i(*topLevelWindow)
  MoveWindowToDesktop.i(*topLevelWindow,*desktopId)
EndInterface

Procedure.i GetIVirtualDesktopManager()
  Protected cid.CLSID
  Protected iid.CLSID
  Protected vtable.i
  If CoInitialize_(#Null) = #S_OK
    If CLSIDFromString_("{AA509086-5CA9-4C25-8F95-589D3C07B48A}",@cid) = #S_OK
      If IIDFromString_("{A5CD92FF-29BE-454C-8D04-D82879FB3F1B}",@iid) = #S_OK
        If CoCreateInstance_(@cid,#Null,#CLSCTX_INPROC_SERVER,@iid,@vtable) = #S_OK
          ProcedureReturn vtable 
        EndIf
      EndIf
    EndIf
    CoUninitialize_()
  EndIf
  ProcedureReturn #Null
EndProcedure

Global *VirtualDesktopManager.IVirtualDesktopManager

*VirtualDesktopManager = GetIVirtualDesktopManager()

If *VirtualDesktopManager
  Debug "Interface is ready!" 
Else
  Debug "Error!"
EndIf

End

Not sure if it works (i have no Windows 10 right now)


Top
 Profile  
Reply with quote  
 Post subject: Re: IVirtualDesktopManager (Windows 10)
PostPosted: Mon Aug 19, 2019 10:17 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 514
Ok now i was able to run it on Windows 10

The interface gets created but it may look different:
Code:
Interface IVirtualDesktopManager
  IsWindowOnCurrentVirtualDesktop.i(topLevelWindow.i,*onCurrentDesktop.b)
  GetWindowDesktopId.i(topLevelWindow.i,*desktopId)
  MoveWindowToDesktop.i(topLevelWindow.i,*desktopId)
EndInterface


Does this work?


Top
 Profile  
Reply with quote  
 Post subject: Re: IVirtualDesktopManager (Windows 10)
PostPosted: Fri Aug 23, 2019 3:32 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4502
Location: Lyon - France
In the two case the debugger say "Interface is ready!" with W10 X64 / v5.70 X86 :wink:

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye