Logging Windows operations? Moving application to virtual desktop?
Logging Windows operations? Moving application to virtual desktop?
Which plugin should I use to log Windows operations? I am trying to optimize my system startup process by opening some applications on a second virtual desktop instead of my main desktop, but have no idea how to do it. But if I can figure out how to log Windows operations, I figure it should help me figure out a number of other things I want to do as well as this. Then I just need to figure out what action to use to recreate the behavior from a batch file upon system startup, or using the autostart option in EventGhost (since it runs at Windows startup).
System info:
Windows 10 Enterprise v. 1803
EventGhost v. 0.4.1r1722
System info:
Windows 10 Enterprise v. 1803
EventGhost v. 0.4.1r1722
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
OK I am going to hit you with a few things.
1. You may want to upgrade your EG version to the latest release candidate of 0.5. Microsoft was kind enough to make some changes that can cause issues with EG 0.4.
2. EG does not start when Windows starts up. it starts when a user logs in. I wanted to make sure you are aware of that.
I am trying to understand what you are trying to do exactly. it seems like you want to run a virtual desktop to handle something with startup applications. and you have used the term optimization. running a virtual desktop is not going to optimize it is actually going to cause things to run slower. If you have a need to optimize you need to evaluate what you do and do not use or what you want to have pre loaded and what you are willing to wait for. the latter not really being a necessity any more with the advent of the SSD hard drive. back in the day when programs were being written at a pace faster then hardware developers could keep up with there were very long startup times for programs. so they came up with the whole TSR (Terminate and Stay Resident) setup. where the portion of the program that takes the longest to load would only load a single time, when the computer booted. since system resources are abundant these days and the programs really do not max out the hardware there is no need to have a program running all of the time if it is not service a specific purpose. One of the best performance gains you can give your system is shutting off the system restore the next is turning off the Microsoft Antimalware. Both of these things are available through options that do not run all of the time. I personally have never had any luck with System Restore actually working properly maybe others have. Intelligence is better then the system restore. what I mean is. Educate yourself before making a questionable "hack" type of modification. then there is typically no reason why you should have to use it.
Here is a link to a forum topic i wrote up. It does into detail on other mechanisms that are built into windows to restore your system. It also lists off all of the windows services what they do and what settings can/should be made to them from disabling or maybe tweaking when it gets started.
I also provide some information on some utilities that can be used to collect and modify parts of your system that most don't know even exists.
viewtopic.php?f=16&p=53258#p53258
Make sure you spend the time to educate and read the entire post. This is extremely important. the information on those pages is informational and you ultimately are the person that is going to decide on what you do and do not want to do. The information provided should also be checked against other sources I am not the only person that has spent the time collecting and compiling it. be sure to still do a search on google and if you find conflicting information open dialog in that forum topic and ask away. If I have the answer or I can provide an explanation on something will be more then happy to. If it is something that i am not 100% familiar with I will go and do some investigating and then provide the information I have found.
I know this Forum is for EG help. But with what you are trying to do I think this would be something better handled at the OS level. I will still help you in any way that I can I have a pretty decent working knowledge of Windows, not 10 specifically but the core of windows has not changed much since NT 3.51.
1. You may want to upgrade your EG version to the latest release candidate of 0.5. Microsoft was kind enough to make some changes that can cause issues with EG 0.4.
2. EG does not start when Windows starts up. it starts when a user logs in. I wanted to make sure you are aware of that.
I am trying to understand what you are trying to do exactly. it seems like you want to run a virtual desktop to handle something with startup applications. and you have used the term optimization. running a virtual desktop is not going to optimize it is actually going to cause things to run slower. If you have a need to optimize you need to evaluate what you do and do not use or what you want to have pre loaded and what you are willing to wait for. the latter not really being a necessity any more with the advent of the SSD hard drive. back in the day when programs were being written at a pace faster then hardware developers could keep up with there were very long startup times for programs. so they came up with the whole TSR (Terminate and Stay Resident) setup. where the portion of the program that takes the longest to load would only load a single time, when the computer booted. since system resources are abundant these days and the programs really do not max out the hardware there is no need to have a program running all of the time if it is not service a specific purpose. One of the best performance gains you can give your system is shutting off the system restore the next is turning off the Microsoft Antimalware. Both of these things are available through options that do not run all of the time. I personally have never had any luck with System Restore actually working properly maybe others have. Intelligence is better then the system restore. what I mean is. Educate yourself before making a questionable "hack" type of modification. then there is typically no reason why you should have to use it.
Here is a link to a forum topic i wrote up. It does into detail on other mechanisms that are built into windows to restore your system. It also lists off all of the windows services what they do and what settings can/should be made to them from disabling or maybe tweaking when it gets started.
I also provide some information on some utilities that can be used to collect and modify parts of your system that most don't know even exists.
viewtopic.php?f=16&p=53258#p53258
Make sure you spend the time to educate and read the entire post. This is extremely important. the information on those pages is informational and you ultimately are the person that is going to decide on what you do and do not want to do. The information provided should also be checked against other sources I am not the only person that has spent the time collecting and compiling it. be sure to still do a search on google and if you find conflicting information open dialog in that forum topic and ask away. If I have the answer or I can provide an explanation on something will be more then happy to. If it is something that i am not 100% familiar with I will go and do some investigating and then provide the information I have found.
I know this Forum is for EG help. But with what you are trying to do I think this would be something better handled at the OS level. I will still help you in any way that I can I have a pretty decent working knowledge of Windows, not 10 specifically but the core of windows has not changed much since NT 3.51.
Re: Logging Windows operations? Moving application to virtual desktop?
Actually, I didn't use the term "optimization". And I'm not running a virtual desktop. I'm just trying to figure out how to automate opening certain apps using the new Windows 10 feature that allows you to move applications to a secondary desktop view from the task view (win+tab).
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
maybe I am not understanding what you want then.I am trying to optimize my system startup process by opening some applications on a second virtual desktop
Re: Logging Windows operations? Moving application to virtual desktop?
Yeah, sorry, I guess it is a bit confusing. The "virtual desktop" is really just a built in feature of Windows 10, like spaces on the Mac. And by optimize I just mean it would speed up my startup process if I could figure out how to automatically move apps to a separate desktop space using EventGhost.
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
well that is going to be a specialty thing.
let me see what i can dig up on the windows API for accessing the multiple desktops.
let me see what i can dig up on the windows API for accessing the multiple desktops.
Re: Logging Windows operations? Moving application to virtual desktop?
Cool. Definitely let me know if you find something that will work. Thanks!
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
here you go.. This is going to be a series of tests for the moment. This code is an undocumented portion of the Windows API. and it is not even in the latest Windown SDK.
This should enumerate all of the virtual desktops that are running. so be sure to have a few of them going before running this test. what we are looking for is the guid of each of the desktops to be printed out. This is the only way to be able to identify them.these id's are persistent between reboots, but not persistent between removal and creation.
If this works correctly I should be able to provide you with the ability to do the following.
I am not sure what they mean by View. I am going to guess that it has to be if the desktop is veing viewed.
IsViewVisible = checks if a desktop is visible or not
IsWindowOnCurrentVirtualDesktop = we will be able to use the Find Window action with this one and it will tell us if he window is on the current desktop or not.
GetWindowDesktopId = use with Find Windows action to return the id of the desktop the window is on
MoveWindowToDesktop = Use with Find Window to move a window to a specific desktop
MoveViewToDesktop = I am not 100% sure on this I have to do more reading on it.
CanViewMoveDesktops = I am not 100% sure on this I have to do more reading on it.
GetCurrentDesktop = Gets the currently selected desktop
GetDesktops = enumerates all desktops
GetAdjacentDesktop = get the desktop either to the left or the right of the one that is currently selected
SwitchDesktop = switch to a desktop
CreateDesktopW = creates a new desktop
RemoveDesktop = removes a desktop
FindDesktop = finds a desktop
events for
VirtualDesktopCreated
VirtualDesktopDestroyBegin
VirtualDesktopDestroyFailed
VirtualDesktopDestroyed
ViewVirtualDesktopChanged
CurrentVirtualDesktopChanged
***EDITED***
Updated code
This should enumerate all of the virtual desktops that are running. so be sure to have a few of them going before running this test. what we are looking for is the guid of each of the desktops to be printed out. This is the only way to be able to identify them.these id's are persistent between reboots, but not persistent between removal and creation.
Code: Select all
from ctypes.wintypes import HRESULT, HWND, BOOL, POINTER, DWORD, INT, UINT, LPVOID, ULONG
import comtypes
import ctypes
from comtypes import helpstring, COMMETHOD
from comtypes.GUID import GUID
REFGUID = POINTER(GUID)
REFIID = REFGUID
ENUM = INT
IID = GUID
INT32 = ctypes.c_int32
INT64 = ctypes.c_int64
CLSID_ImmersiveShell = GUID(
'{C2F03A33-21F5-47FA-B4BB-156362A2F239}'
)
CLSID_IVirtualNotificationService = GUID(
'{A501FDEC-4A09-464C-AE4E-1B9C21B84918}'
)
class HSTRING__(ctypes.Structure):
_fields_ = [
('unused', INT),
]
HSTRING = POINTER(HSTRING__)
class EventRegistrationToken(ctypes.Structure):
_fields_ = [
('value', INT64)
]
class AdjacentDesktop(ENUM):
LeftDirection = 3
RightDirection = 4
class ApplicationViewOrientation(ENUM):
ApplicationViewOrientation_Landscape = 0
ApplicationViewOrientation_Portrait = 1
class TrustLevel(ENUM):
BaseTrust = 0
PartialTrust = BaseTrust + 1
FullTrust = PartialTrust + 1
IID_IInspectable = GUID(
'{AF86E2E0-B12D-4C6A-9C5A-D7AA65101E90}'
)
class IInspectable(comtypes.IUnknown):
_case_insensitive_ = True
_idlflags_ = []
_iid_ = IID_IInspectable
_methods_ = [
COMMETHOD(
[helpstring('Method GetIids')],
HRESULT,
'GetIids',
(['out'], POINTER(ULONG), 'iidCount'),
(['out'], POINTER(POINTER(IID)), 'iids'),
),
COMMETHOD(
[helpstring('Method GetRuntimeClassName')],
HRESULT,
'GetRuntimeClassName',
(['out'], POINTER(HSTRING), 'className'),
),
COMMETHOD(
[helpstring('Method GetTrustLevel')],
HRESULT,
'GetTrustLevel',
(['out'], POINTER(TrustLevel), 'trustLevel'),
),
]
IID_IApplicationViewConsolidatedEventArgs = GUID(
'{514449EC-7EA2-4DE7-A6A6-7DFBAAEBB6FB}'
)
class IApplicationViewConsolidatedEventArgs(IInspectable):
_case_insensitive_ = True
_iid_ = IID_IApplicationViewConsolidatedEventArgs
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method get_IsUserInitiated')],
HRESULT,
'get_IsUserInitiated',
(['retval', 'out'], POINTER(BOOL), 'value'),
),
]
IID_IApplicationView = GUID(
'{D222D519-4361-451E-96C4-60F4F9742DB0}'
)
class IApplicationView(IInspectable):
_case_insensitive_ = True
_iid_ = IID_IApplicationView
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method get_Orientation')],
HRESULT,
'get_Orientation',
(['retval', 'out'], POINTER(ApplicationViewOrientation), 'value'),
),
COMMETHOD(
[helpstring('Method get_AdjacentToLeftDisplayEdge')],
HRESULT,
'get_AdjacentToLeftDisplayEdge',
(['retval', 'out'], POINTER(BOOL), 'value'),
),
COMMETHOD(
[helpstring('Method get_AdjacentToRightDisplayEdge')],
HRESULT,
'get_AdjacentToRightDisplayEdge',
(['retval', 'out'], POINTER(BOOL), 'value'),
),
COMMETHOD(
[helpstring('Method get_IsFullScreen')],
HRESULT,
'get_IsFullScreen',
(['retval', 'out'], POINTER(BOOL), 'value'),
),
COMMETHOD(
[helpstring('Method get_IsOnLockScreen')],
HRESULT,
'get_IsOnLockScreen',
(['retval', 'out'], POINTER(BOOL), 'value'),
),
COMMETHOD(
[helpstring('Method get_IsScreenCaptureEnabled')],
HRESULT,
'get_IsScreenCaptureEnabled',
(['retval', 'out'], POINTER(BOOL), 'value'),
),
COMMETHOD(
[helpstring('Method put_IsScreenCaptureEnabled')],
HRESULT,
'put_IsScreenCaptureEnabled',
(['in'], BOOL, 'value'),
),
COMMETHOD(
[helpstring('Method put_Title')],
HRESULT,
'put_Title',
(['in'], HSTRING, 'value'),
),
COMMETHOD(
[helpstring('Method get_Title')],
HRESULT,
'get_Title',
(['retval', 'out'], POINTER(HSTRING), 'value'),
),
COMMETHOD(
[helpstring('Method get_Id')],
HRESULT,
'get_Id',
(['retval', 'out'], POINTER(INT32), 'value'),
),
COMMETHOD(
[helpstring('Method add_Consolidated')],
HRESULT,
'add_Consolidated',
(['in'], POINTER(IApplicationViewConsolidatedEventArgs), 'handler'),
(['retval', 'out'], POINTER(EventRegistrationToken), 'token'),
),
COMMETHOD(
[helpstring('Method remove_Consolidated')],
HRESULT,
'remove_Consolidated',
(['in',], EventRegistrationToken, 'EventRegistrationToken'),
),
]
IID_IServiceProvider = GUID(
'{6D5140C1-7436-11CE-8034-00AA006009FA}'
)
class IServiceProvider(comtypes.IUnknown):
_case_insensitive_ = True
_idlflags_ = []
_iid_ = IID_IServiceProvider
_methods_ = [
COMMETHOD(
[helpstring('Method QueryService'), 'local', 'in'],
HRESULT,
'QueryService',
(['in'], REFGUID, 'guidService'),
(['in'], REFIID, 'riid'),
(['out'], POINTER(LPVOID), 'ppvObject'),
),
]
IID_IObjectArray = GUID(
"{92CA9DCD-5622-4BBA-A805-5E9F541BD8C9}"
)
class IObjectArray(comtypes.IUnknown):
"""
Unknown Object Array
"""
_case_insensitive_ = True
_idlflags_ = []
_iid_ = None
_methods_ = [
COMMETHOD(
[helpstring('Method GetCount')],
HRESULT,
'GetCount',
(['out'], POINTER(UINT), 'pcObjects'),
),
COMMETHOD(
[helpstring('Method GetAt')],
HRESULT,
'GetAt',
(['in'], UINT, 'uiIndex'),
(['in'], REFIID, 'riid'),
(['out', 'iid_is'], POINTER(LPVOID), 'ppv'),
),
]
IID_IVirtualDesktop = GUID(
'{FF72FFDD-BE7E-43FC-9C03-AD81681E88E4}'
)
class IVirtualDesktop(comtypes.IUnknown):
_case_insensitive_ = True
_iid_ = IID_IVirtualDesktop
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method IsViewVisible')],
HRESULT,
'IsViewVisible',
(['out'], POINTER(IApplicationView), 'pView'),
(['out'], POINTER(INT), 'pfVisible'),
),
COMMETHOD(
[helpstring('Method GetID')],
HRESULT,
'GetID',
(['out'], POINTER(GUID), 'pGuid'),
)
]
IID_IVirtualDesktopManager = GUID(
'{A5CD92FF-29BE-454C-8D04-D82879FB3F1B}'
)
class IVirtualDesktopManager(comtypes.IUnknown):
_case_insensitive_ = True
_iid_ = IID_IVirtualDesktopManager
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method IsWindowOnCurrentVirtualDesktop')],
HRESULT,
'IsWindowOnCurrentVirtualDesktop',
(['in'], HWND, 'topLevelWindow'),
(['out'], POINTER(BOOL), 'onCurrentDesktop'),
),
COMMETHOD(
[helpstring('Method GetWindowDesktopId')],
HRESULT,
'GetWindowDesktopId',
(['in'], HWND, 'topLevelWindow'),
(['out'], POINTER(GUID), 'desktopId'),
),
COMMETHOD(
[helpstring('Method MoveWindowToDesktop')],
HRESULT,
'MoveWindowToDesktop',
(['in'], HWND, 'topLevelWindow'),
(['in'], REFGUID, 'desktopId'),
),
]
CLSID_VirtualDesktopManagerInternal = GUID(
'{C5E0CDCA-7B6E-41B2-9FC4-D93975CC467B}'
)
IID_IVirtualDesktopManagerInternal = GUID(
'{F31574D6-B682-4CDC-BD56-1827860ABEC6}'
)
# IID_IVirtualDesktopManagerInternal = GUID(
# '{AF8DA486-95BB-4460-B3B7-6E7A6B2962B5}'
# )
# IID_IVirtualDesktopManagerInternal = GUID(
# '{EF9F1A6C-D3CC-4358-B712-F84B635BEBE7}'
# )
class IVirtualDesktopManagerInternal(comtypes.IUnknown):
_case_insensitive_ = True
_iid_ = IID_IVirtualDesktopManagerInternal
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method GetCount')],
HRESULT,
'GetCount',
(['out'], POINTER(UINT), 'pCount'),
),
COMMETHOD(
[helpstring('Method MoveViewToDesktop')],
HRESULT,
'MoveViewToDesktop',
(['out'], POINTER(IApplicationView), 'pView'),
(['out'], POINTER(IVirtualDesktop), 'pDesktop'),
),
COMMETHOD(
[helpstring('Method CanViewMoveDesktops')],
HRESULT,
'CanViewMoveDesktops',
(['out'], POINTER(IApplicationView), 'pView'),
(['out'], POINTER(INT), 'pfCanViewMoveDesktops'),
),
COMMETHOD(
[helpstring('Method GetCurrentDesktop')],
HRESULT,
'GetCurrentDesktop',
(['out'], POINTER(POINTER(IVirtualDesktop)), 'desktop'),
),
COMMETHOD(
[helpstring('Method GetDesktops')],
HRESULT,
'GetDesktops',
(['out'], POINTER(POINTER(IObjectArray)), 'ppDesktops'),
),
COMMETHOD(
[helpstring('Method GetAdjacentDesktop')],
HRESULT,
'GetAdjacentDesktop',
(['out'], POINTER(IVirtualDesktop), 'pDesktopReference'),
(['in'], AdjacentDesktop, 'uDirection'),
(['out'], POINTER(POINTER(IVirtualDesktop)), 'ppAdjacentDesktop'),
),
COMMETHOD(
[helpstring('Method SwitchDesktop')],
HRESULT,
'SwitchDesktop',
(['in'], POINTER(IVirtualDesktop), 'pDesktop'),
),
COMMETHOD(
[helpstring('Method CreateDesktopW')],
HRESULT,
'CreateDesktopW',
(['out'], POINTER(POINTER(IVirtualDesktop)), 'ppNewDesktop'),
),
COMMETHOD(
[helpstring('Method RemoveDesktop')],
HRESULT,
'RemoveDesktop',
(['in'], POINTER(IVirtualDesktop), 'pRemove'),
(['in'], POINTER(IVirtualDesktop), 'pFallbackDesktop'),
),
COMMETHOD(
[helpstring('Method FindDesktop')],
HRESULT,
'FindDesktop',
(['in'], POINTER(GUID), 'desktopId'),
(['out'], POINTER(POINTER(IVirtualDesktop)), 'ppDesktop'),
),
]
IID_IVirtualDesktopNotification = GUID(
'{C179334C-4295-40D3-BEA1-C654D965605A}'
)
class IVirtualDesktopNotification(comtypes.IUnknown):
_case_insensitive_ = True
_iid_ = IID_IVirtualDesktopNotification
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method VirtualDesktopCreated')],
HRESULT,
'VirtualDesktopCreated',
(['in'], POINTER(IVirtualDesktop), 'pDesktop'),
),
COMMETHOD(
[helpstring('Method VirtualDesktopDestroyBegin')],
HRESULT,
'VirtualDesktopDestroyBegin',
(['in'], POINTER(IVirtualDesktop), 'pDesktopDestroyed'),
(['in'], POINTER(IVirtualDesktop), 'pDesktopFallback'),
),
COMMETHOD(
[helpstring('Method VirtualDesktopDestroyFailed')],
HRESULT,
'VirtualDesktopDestroyFailed',
(['in'], POINTER(IVirtualDesktop), 'pDesktopDestroyed'),
(['in'], POINTER(IVirtualDesktop), 'pDesktopFallback'),
),
COMMETHOD(
[helpstring('Method VirtualDesktopDestroyed')],
HRESULT,
'VirtualDesktopDestroyed',
(['in'], POINTER(IVirtualDesktop), 'pDesktopDestroyed'),
(['in'], POINTER(IVirtualDesktop), 'pDesktopFallback'),
),
COMMETHOD(
[helpstring('Method ViewVirtualDesktopChanged')],
HRESULT,
'ViewVirtualDesktopChanged',
(['in'], POINTER(IApplicationView), 'pView'),
),
COMMETHOD(
[helpstring('Method CurrentVirtualDesktopChanged')],
HRESULT,
'CurrentVirtualDesktopChanged',
(['in'], POINTER(IVirtualDesktop), 'pDesktopOld'),
(['in'], POINTER(IVirtualDesktop), 'pDesktopNew'),
),
]
IID_IVirtualDesktopNotificationService = GUID('{0CD45E71-D927-4F15-8B0A-8FEF525337BF}')
class IVirtualDesktopNotificationService(comtypes.IUnknown):
_case_insensitive_ = True
_iid_ = IID_IVirtualDesktopNotificationService
_idlflags_ = []
_methods_ = [
COMMETHOD(
[helpstring('Method Register')],
HRESULT,
'Register',
(['in'], POINTER(IVirtualDesktopNotification), 'pNotification'),
(['out'], POINTER(DWORD), 'pdwCookie'),
),
COMMETHOD(
[helpstring('Method Unregister')],
HRESULT,
'Unregister',
(['in'], DWORD, 'dwCookie'),
),
]
comtypes.CoInitialize()
pServiceProvider = comtypes.CoCreateInstance(
CLSID_ImmersiveShell,
IServiceProvider,
comtypes.CLSCTX_LOCAL_SERVER,
)
pDesktopManagerInternal = comtypes.cast(
pServiceProvider.QueryService(
CLSID_VirtualDesktopManagerInternal,
IID_IVirtualDesktopManagerInternal
),
ctypes.POINTER(IVirtualDesktopManagerInternal)
)
pObjectArray = POINTER(IObjectArray)()
pDesktopManagerInternal.GetDesktops(ctypes.byref(pObjectArray))
count = UINT()
pObjectArray.GetCount(ctypes.byref(count))
for i in range(count):
pDesktop = POINTER(IVirtualDesktop)()
pObjectArray.GetAt(i, IID_IVirtualDesktop, ctypes.byref(pDesktop))
id = GUID()
pDesktop.GetID(ctypes.byref(id))
print(id)
If this works correctly I should be able to provide you with the ability to do the following.
I am not sure what they mean by View. I am going to guess that it has to be if the desktop is veing viewed.
IsViewVisible = checks if a desktop is visible or not
IsWindowOnCurrentVirtualDesktop = we will be able to use the Find Window action with this one and it will tell us if he window is on the current desktop or not.
GetWindowDesktopId = use with Find Windows action to return the id of the desktop the window is on
MoveWindowToDesktop = Use with Find Window to move a window to a specific desktop
MoveViewToDesktop = I am not 100% sure on this I have to do more reading on it.
CanViewMoveDesktops = I am not 100% sure on this I have to do more reading on it.
GetCurrentDesktop = Gets the currently selected desktop
GetDesktops = enumerates all desktops
GetAdjacentDesktop = get the desktop either to the left or the right of the one that is currently selected
SwitchDesktop = switch to a desktop
CreateDesktopW = creates a new desktop
RemoveDesktop = removes a desktop
FindDesktop = finds a desktop
events for
VirtualDesktopCreated
VirtualDesktopDestroyBegin
VirtualDesktopDestroyFailed
VirtualDesktopDestroyed
ViewVirtualDesktopChanged
CurrentVirtualDesktopChanged
***EDITED***
Updated code
Re: Logging Windows operations? Moving application to virtual desktop?
KG, I'm just curious about if you pulled these API calls from windows 7 or windows 10. Win 7 actually almost had a multi desktop feature and part of that may have been used to create the virtual desktops in win 10. I believe the win 7 virtual desktops might have been a part of sysinternals or something similar.
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
This is for Windows 10 only.
Re: Logging Windows operations? Moving application to virtual desktop?
I'm getting this error when I run that as a python script on EG 5 RC 4
Traceback (most recent call last):
Python script "1", line 479, in <module>
ctypes.byref(pDesktopManagerInternal)
ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_GUID instance instead of pointer to POINTER(IVirtualDesktopManagerInternal)
Traceback (most recent call last):
Python script "1", line 479, in <module>
ctypes.byref(pDesktopManagerInternal)
ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_GUID instance instead of pointer to POINTER(IVirtualDesktopManagerInternal)
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
I updated the code in that previous post. give it a try and see what happens.
Re: Logging Windows operations? Moving application to virtual desktop?
I tried out the updated script and get this error
Code: Select all
Traceback (most recent call last):
Python script "1", line 478, in <module>
ctypes.byref(pDesktopManagerInternal)
TypeError: byref() argument must be a ctypes instance, not 'IVirtualDesktopManagerInternal'
- kgschlosser
- Site Admin
- Posts: 5003
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Logging Windows operations? Moving application to virtual desktop?
I upated the script again. give it a go.
Re: Logging Windows operations? Moving application to virtual desktop?
Here is the next error message
Code: Select all
Traceback (most recent call last):
Python script "1", line 476, in <module>
IID_IVirtualDesktopManagerInternal
COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None))