Leaderboard
Popular Content
Showing content with the highest reputation on 09/06/2023 in all areas
-
While that can certainly be an important factor, even if you could, it still wouldn't make any difference as a threat for all the reasons I stated earlier.2 points
-
read and write xlsx files without Excel
funkey reacted to AspirinJunkie for a topic
This UDF provides 2 functions to read data directly from xlsx files or to output data as xlsx file. Only the cell contents are considered - no cell formatting and the like. It is therefore explicitly not a full replacement for the Excel UDF, since its scope goes well beyond that. But to quickly read in data or to work with xlsx files without having Excel installed, the UDF can be quite useful. There may also be specially formatted xlsx files which I have not yet encountered during testing and which may cause problems. In this case it is best to make a message about it here and upload the file. Note: xlsx files must be unpacked for reading. To make this as fast as possible it is recommended to put a >>7za.exe<< file into the script directory, otherwise a slow alternative will be used. Otherwise an example says more than 1000 words: >>sourcecode and download on github<< Changelog:1 point -
AutoIT and LEA Extended Input - sending TCP packet
Kn0xx reacted to argumentum for a topic
in "using (ICryptoTransform encryptor = AES.CreateEncryptor(AES.Key, IV))", I'd say they are using encryption and you are not. I don't know enough to guide you but the PDF don't say much and to get it working, you'll probably have to follow the sample code.1 point -
I use this technique in SSD to switch the Windows Sound dialog on the invisible secondary desktop with controlsend(). Here a dirty PoC, works fine for me. _WinAPI_CreateDesktop_Wrapper.zip1 point
-
Put the $BtnCombo on the same line as the $cCombo $sData = "|Local Temp|Win Temp|Windows Dir" $cCombo = GUICtrlCreateCombo("", 5, 5, 120, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE)) GUICtrlSetData(-1,$sData) $BtnCombo = GUICtrlCreateButton("Open Dir", 5, 50, 100, 25) ;it works very well Case $cCombo, $BtnCombo Switch GUICtrlRead($cCombo) Case "Local Temp" ShellExecute(@TempDir) Case "Win Temp" ShellExecute(@WindowsDir & "\Temp") Case "Windows" ShellExecute(@WindowsDir") EndSwitch1 point
-
Recently somebody asked how it could possible to manage the new feature of Virtual Desktop under Windows 10. With the incentive of @KaFu I started to get something together that could be useful. Since this code was never released under AutoIt, I felt it could serve as a good example. Let me know what you think. Version 2021-09-19 * Added support to IApplicationView and IVirtualDesktopPinnedApps interfaces (see example 2) Example 1. The documented interface of IVirtualDesktopManager offers a very limited list of methods. Someone may ask WTF is it useful for ? Well, I don't have an answer for that. #include <Constants.au3> #include <GUIConstants.au3> If @OSVersion <> "WIN_10" Then Exit MsgBox($MB_SYSTEMMODAL, "", "This script only runs on Win 10") ; VirtualDesktopManager object Local $CLSID_VirtualDesktopManager = "{aa509086-5ca9-4c25-8f95-589d3c07b48a}" Local $IID_IVirtualDesktopManager = "{a5cd92ff-29be-454c-8d04-d82879fb3f1b}" Local $tagIVirtualDesktopManager = _ "IsWindowOnCurrentVirtualDesktop hresult(hwnd;bool*);" & _ "GetWindowDesktopId hresult(hwnd;clsid*);" & _ "MoveWindowToDesktop hresult(hwnd;clsid);" ; object creation Local $oVDM = ObjCreateInterface($CLSID_VirtualDesktopManager, $IID_IVirtualDesktopManager, $tagIVirtualDesktopManager) ConsoleWrite(IsObj($oVDM) & @CRLF) ; create process owned window Local $hWnd = GUICreate("Test"), $bActive GUISetState() ; check if window is on current desktop (not mandatory to own the window) Local $iHresult = $oVDM.IsWindowOnCurrentVirtualDesktop($hWnd, $bActive) ConsoleWrite($iHresult & "/" & $bActive & @CRLF) ; returns the CLSID of the desktop where the window resides Local $sCLSID $iHresult = $oVDM.GetWindowDesktopId($hWnd, $sCLSID) ConsoleWrite($iHresult & "/" & $sCLSID & @CRLF) Local $hNote = WinGetHandle("[CLASS:Notepad]") $iHresult = $oVDM.GetWindowDesktopId($hNote, $sCLSID) ; (not mandatory to own the window) ConsoleWrite($iHresult & "/" & $sCLSID & @CRLF) ; moves the window to a specific desktop (mandatory to own the window) $iHresult = $oVDM.MoveWindowToDesktop($hWnd, $sCLSID) ConsoleWrite($iHresult & @CRLF) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd To perform this example you need to work a bit. Create a second Desktop, start Notepad, go back to the first, and run this script: the GUI window will be transferred from the first desktop to the second. Warning : you cannot use this method if you do not own the window (process-wise). Example 2 : The "undocumented" interface of IVirtualDesktopManagerInternal has a lot more methods and resolves all the requests someone could have using Virtual Desktops. #include <Constants.au3> Opt("MustDeclareVars", True) If @OSVersion <> "WIN_10" Then Exit MsgBox($MB_SYSTEMMODAL, "", "This script only runs on Win 10") ; Instanciation objects Local $CLSID_ImmersiveShell = "{c2f03a33-21f5-47fa-b4bb-156362a2f239}" Local $IID_IUnknown = "{00000000-0000-0000-c000-000000000046}" Local $IID_IServiceProvider = "{6D5140C1-7436-11CE-8034-00AA006009FA}" Local $tIID_IServiceProvider = __uuidof($IID_IServiceProvider) Local $tagIServiceProvider = _ "QueryService hresult(struct*;struct*;ptr*);" ; VirtualDesktopManagerInternal object Const Enum $eLeftDirection = 3, $eRightDirection Local $CLSID_VirtualDesktopManagerInternal = "{C5E0CDCA-7B6E-41B2-9FC4-D93975CC467B}" Local $tCLSID_VirtualDesktopManagerInternal = __uuidof($CLSID_VirtualDesktopManagerInternal) Local $IID_IVirtualDesktopManagerInternal = "{F31574D6-B682-4CDC-BD56-1827860ABEC6}" Local $tIID_IVirtualDesktopManagerInternal = __uuidof($IID_IVirtualDesktopManagerInternal) Local $tagIVirtualDesktopManagerInternal = _ "GetCount hresult(int*);" & _ "MoveViewToDesktop hresult(ptr;ptr);" & _ "CanViewMoveDesktops hresult(ptr;bool*);" & _ "GetCurrentDesktop hresult(ptr*);" & _ "GetDesktops hresult(ptr*);" & _ "GetAdjacentDesktop hresult(ptr;int;ptr*);" & _ "SwitchDesktop hresult(ptr);" & _ "CreateDesktopW hresult(int*);" & _ "RemoveDesktop hresult(ptr;ptr);" & _ "FindDesktop hresult(struct*;ptr*);" ; ApplicationViewCollection object Local $CLSID_IApplicationViewCollection = "{1841C6D7-4F9D-42C0-AF41-8747538F10E5}" Local $tCLSID_IApplicationViewCollection = __uuidof($CLSID_IApplicationViewCollection) Local $IID_IApplicationViewCollection = "{1841C6D7-4F9D-42C0-AF41-8747538F10E5}" Local $tIID_IApplicationViewCollection = __uuidof($IID_IApplicationViewCollection) Local $tagIApplicationViewCollection = _ "GetViews hresult(struct*);" & _ "GetViewsByZOrder hresult(struct*);" & _ "GetViewsByAppUserModelId hresult(wstr;struct*);" & _ "GetViewForHwnd hresult(hwnd;ptr*);" & _ "GetViewForApplication hresult(ptr;ptr*);" & _ "GetViewForAppUserModelId hresult(wstr;int*);" & _ "GetViewInFocus hresult(ptr*);" ; ApplicationView object Local $IID_IApplicationView = "{372E1D3B-38D3-42E4-A15B-8AB2B178F513}" Local $tagIApplicationView = _ "GetIids hresult(ulong*;ptr*);" & _ "GetRuntimeClassName hresult(str*);" & _ "GetTrustLevel hresult(int*);" & _ "SetFocus hresult();" & _ "SwitchTo hresult();" & _ "TryInvokeBack hresult(ptr);" & _ "GetThumbnailWindow hresult(hwnd*);" & _ "GetMonitor hresult(ptr*);" & _ "GetVisibility hresult(int*);" & _ "SetCloak hresult(int;int);" & _ "GetPosition hresult(clsid;ptr*);" & _ "SetPosition hresult(ptr);" & _ "InsertAfterWindow hresult(hwnd);" & _ "GetExtendedFramePosition hresult(struct*);" & _ "GetAppUserModelId hresult(wstr*);" & _ "SetAppUserModelId hresult(wstr);" & _ "IsEqualByAppUserModelId hresult(wstr;int*);" & _ "GetViewState hresult(uint*);" & _ "SetViewState hresult(uint);" & _ "GetNeediness hresult(int*);" ; VirtualDesktopPinnedApps object Local $CLSID_VirtualDesktopPinnedApps = "{b5a399e7-1c87-46b8-88e9-fc5747b171bd}" Local $tCLSID_VirtualDesktopPinnedApps = __uuidof($CLSID_VirtualDesktopPinnedApps) Local $IID_IVirtualDesktopPinnedApps = "{4ce81583-1e4c-4632-a621-07a53543148f}" Local $tIID_IVirtualDesktopPinnedApps = __uuidof($IID_IVirtualDesktopPinnedApps) Local $tagIVirtualDesktopPinnedApps = _ "IsAppIdPinned hresult(wstr;bool*);" & _ "PinAppID hresult(wstr);" & _ "UnpinAppID hresult(wstr);" & _ "IsViewPinned hresult(ptr;bool*);" & _ "PinView hresult(ptr);" & _ "UnpinView hresult(ptr);" ; Miscellaneous objects Local $IID_IObjectArray = "{92ca9dcd-5622-4bba-a805-5e9f541bd8c9}" Local $tagIObjectArray = _ "GetCount hresult(int*);" & _ "GetAt hresult(int;ptr;ptr*);" Local $IID_IVirtualDesktop = "{FF72FFDD-BE7E-43FC-9C03-AD81681E88E4}" Local $tIID_IVirtualDesktop = __uuidof($IID_IVirtualDesktop) Local $tagIVirtualDesktop = _ "IsViewVisible hresult(ptr;bool*);" & _ "GetId hresult(clsid*);" ; objects creation Local $pService Local $oImmersiveShell = ObjCreateInterface($CLSID_ImmersiveShell, $IID_IUnknown, "") ConsoleWrite("Immersive shell = " & IsObj($oImmersiveShell) & @CRLF) $oImmersiveShell.QueryInterface($tIID_IServiceProvider, $pService) ConsoleWrite("Service pointer = " & $pService & @CRLF) Local $oService = ObjCreateInterface($pService, $IID_IServiceProvider, $tagIServiceProvider) ConsoleWrite("Service = " & IsObj($oService) & @CRLF) Local $pApplicationViewCollection, $pVirtualDesktopManagerInternal, $pVirtualDesktopPinnedApps $oService.QueryService($tCLSID_IApplicationViewCollection, $tIID_IApplicationViewCollection, $pApplicationViewCollection) ConsoleWrite("View collection pointer = " & $pApplicationViewCollection & @CRLF) Local $oApplicationViewCollection = ObjCreateInterface($pApplicationViewCollection, $IID_IApplicationViewCollection, $tagIApplicationViewCollection) ConsoleWrite("View collection = " & IsObj($oApplicationViewCollection) & @CRLF) $oService.QueryService($tCLSID_VirtualDesktopManagerInternal, $tIID_IVirtualDesktopManagerInternal, $pVirtualDesktopManagerInternal) ConsoleWrite("Virtual Desktop pointer = " & $pVirtualDesktopManagerInternal & @CRLF) Local $oVirtualDesktopManagerInternal = ObjCreateInterface($pVirtualDesktopManagerInternal, $IID_IVirtualDesktopManagerInternal, $tagIVirtualDesktopManagerInternal) ConsoleWrite("Virtual Desktop = " & IsObj($oVirtualDesktopManagerInternal) & @CRLF) $oService.QueryService($tCLSID_VirtualDesktopPinnedApps, $tIID_IVirtualDesktopPinnedApps, $pVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & $pVirtualDesktopPinnedApps & @CRLF) Local $oVirtualDesktopPinnedApps = ObjCreateInterface($pVirtualDesktopPinnedApps, $IID_IVirtualDesktopPinnedApps, $tagIVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & IsObj($oVirtualDesktopPinnedApps) & @CRLF) Local $iCount, $pCurrent, $pLeft, $pNew, $iHresult, $hWnd, $pView, $pArray, $pDesktop, $oArray, $oView, $sView, $bValue ; gives the number of virtual desktops $iHresult = $oVirtualDesktopManagerInternal.GetCount($iCount) ConsoleWrite("Number of Desktop = " & $iCount & "/" & $iHresult & @CRLF) If $iCount > 1 Then Exit MsgBox($MB_SYSTEMMODAL, "", "Please close all additional Virtual Desktops") ; creates a new virtual desktop $iHresult = $oVirtualDesktopManagerInternal.CreateDesktopW($pNew) ConsoleWrite("Create = " & $pNew & "/" & $iHresult & @CRLF) $iHresult = $oVirtualDesktopManagerInternal.SwitchDesktop($pNew) ConsoleWrite("Switch = " & $iHresult & @CRLF) Run("Notepad.exe") WinWait("[CLASS:Notepad]") ; enumerates all desktops $iHresult = $oVirtualDesktopManagerInternal.GetDesktops($pArray) $oArray = ObjCreateInterface($pArray, $IID_IObjectArray, $tagIObjectArray) ConsoleWrite("Array = " & IsObj($oArray) & @CRLF) $oArray.GetCount($iCount) ConsoleWrite("Count = " & $iCount & @CRLF) $oArray.GetAt(0, DllStructGetPtr($tIID_IVirtualDesktop), $pDesktop) ConsoleWrite("Desktop 0 = " & $pDesktop & @CRLF) $oArray.GetAt(1, DllStructGetPtr($tIID_IVirtualDesktop), $pCurrent) ConsoleWrite("Desktop 1 = " & $pCurrent & @CRLF) ; gives the current desktop id $iHresult = $oVirtualDesktopManagerInternal.GetCurrentDesktop($pCurrent) ConsoleWrite("Current = " & $pCurrent & "/" & $iHresult & @CRLF) ; returns the adjacent desktop id $iHresult = $oVirtualDesktopManagerInternal.GetAdjacentDesktop($pCurrent, $eLeftDirection, $pLeft) ConsoleWrite("Get Left = " & $pLeft & "/" & $iHresult & @CRLF) ; switches to a specific desktop MsgBox ($MB_SYSTEMMODAL,"","Now it will return to previous desktop") Sleep(500) ; gives time for the msg box to close $iHresult = $oVirtualDesktopManagerInternal.SwitchDesktop($pLeft) ConsoleWrite("Switch = " & $iHresult & @CRLF) ; get pointer to a view based on hwnd and create an application view $hWnd = WinGetHandle("[CLASS:Notepad]") $iHresult = $oApplicationViewCollection.GetViewForHwnd($hWnd, $pView) ConsoleWrite("View from handle = " & $pView & "/" & $iHresult & @CRLF) $oView = ObjCreateInterface($pView, $IID_IApplicationView, $tagIApplicationView) ConsoleWrite("Application view = " & IsObj($oView) & @CRLF) $iHresult = $oView.GetAppUserModelId($sView) ConsoleWrite("Get App ID = " & $sView & "/" & $iHresult & @CRLF) ; verify if app is pinned with ptr and string $iHresult = $oVirtualDesktopPinnedApps.IsViewPinned($pView, $bValue) ConsoleWrite("Is View Pinned = " & $bValue & "/" & $iHresult & @CRLF) $iHresult = $oVirtualDesktopPinnedApps.IsAppIdPinned($sView, $bValue) ConsoleWrite("Is AppId Pinned = " & $bValue & "/" & $iHresult & @CRLF) ; move application to a specific desktop $iHresult = $oVirtualDesktopManagerInternal.MoveViewToDesktop($pView, $pDesktop) ConsoleWrite("Move = " & $iHresult & @CRLF) Sleep(2000) ; deletes an existing desktop $iHresult = $oVirtualDesktopManagerInternal.RemoveDesktop($pNew, $pDesktop) ConsoleWrite("Delete = " & $iHresult & @CRLF) Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Enjoy.1 point
-
Virtual Desktop Manager under Windows 10
mLipok reacted to OvisMaximus for a topic
Just started with AutoIt scripting to simplify my daily login routine. Move the windows to the appropriate desktop, correct monitor and resize them accordingly. To move the windows to an other desktop it needs the results of the discussion here. Sadly, the code is posted and scattered across this thread, so it took me some time to pull the threads together. Although I'm deeply convinced that I missed one or two things, one may find the result useful. https://github.com/OvisMaximus/WindowsDesktopAutomation/blob/main/VirtDsktLibrary.au31 point -
@ycomp I updated the script to work with Windows 11. @Nine I made the file compatible with both Windows 10 and Windows 11. Thanks for writing the script in the first place. Without the windows 10 version as a guide I would have been completely lost! Windows 11 Build >= 22489 VirtualDesktop11Insider.cs Windows 11 Build < 22489 VirtualDesktop11.cs UPDATE: they added another update to Windows 11 and added the GetAllCurrentDesktops method. Changes found in VirtualDesktop11Insider.cs Updated Code: #include <Constants.au3> ;https://github.com/MScholtes/VirtualDesktop/blob/master/VirtualDesktop11Insider.cs ;https://github.com/MScholtes/VirtualDesktop/blob/master/VirtualDesktop11.cs ;https://github.com/MScholtes/VirtualDesktop/blob/master/VirtualDesktop.cs Opt("MustDeclareVars", True) ; Windows 11 currently registers as Windows 10 in the registry. This script is compatible with both OS. This could break for Windows 11 in the future if Microsoft updates the registry for Windows 11 to reflect it's OS If @OSVersion <> "WIN_10" Then Exit MsgBox($MB_SYSTEMMODAL, "", "This script only runs on Win 10 and Win 11") Local $OSBuild = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentBuild") Local Enum $windows10 = 21999, $windows11 = 22000 ;GetOS() ;OS Specific Variables Local $IID_IVirtualDesktop, $IID_IVirtualDesktopManagerInternal, $tagIVirtualDesktopManagerInternal If $OSBuild >= $windows11 Then $IID_IVirtualDesktop = "{536D3495-B208-4CC9-AE26-DE8111275BF8}" $IID_IVirtualDesktopManagerInternal = "{B2F925B9-5A0F-4D2E-9F4D-2B1507593C10}" If $OSBuild >= 22489 Then $tagIVirtualDesktopManagerInternal = _ "GetCount hresult(ptr;int*);" & _ "MoveViewToDesktop hresult(ptr;ptr);" & _ "CanViewMoveDesktops hresult(ptr;bool*);" & _ "GetCurrentDesktop hresult(ptr;ptr*);" & _ "GetAllCurrentDesktops hresult();" & _ "GetDesktops hresult(ptr;ptr*);" & _ "GetAdjacentDesktop hresult(ptr;int;ptr*);" & _ "SwitchDesktop hresult(ptr;ptr);" & _ "CreateDesktopW hresult(ptr;int*);" & _ "MoveDesktop hresult(ptr;int*;int);" & _ "RemoveDesktop hresult(ptr;ptr);" & _ "FindDesktop hresult(struct*;ptr*);" Else $tagIVirtualDesktopManagerInternal = _ "GetCount hresult(ptr;int*);" & _ "MoveViewToDesktop hresult(ptr;ptr);" & _ "CanViewMoveDesktops hresult(ptr;bool*);" & _ "GetCurrentDesktop hresult(ptr;ptr*);" & _ "GetDesktops hresult(ptr;ptr*);" & _ "GetAdjacentDesktop hresult(ptr;int;ptr*);" & _ "SwitchDesktop hresult(ptr;ptr);" & _ "CreateDesktopW hresult(ptr;int*);" & _ "MoveDesktop hresult(ptr;int*;int);" & _ "RemoveDesktop hresult(ptr;ptr);" & _ "FindDesktop hresult(struct*;ptr*);" EndIf ElseIf $OSBuild < $windows11 Then $IID_IVirtualDesktop = "{FF72FFDD-BE7E-43FC-9C03-AD81681E88E4}" $IID_IVirtualDesktopManagerInternal = "{F31574D6-B682-4CDC-BD56-1827860ABEC6}" $tagIVirtualDesktopManagerInternal = _ "GetCount hresult(int*);" & _ "MoveViewToDesktop hresult(ptr;ptr);" & _ "CanViewMoveDesktops hresult(ptr;bool*);" & _ "GetCurrentDesktop hresult(ptr*);" & _ "GetDesktops hresult(ptr*);" & _ "GetAdjacentDesktop hresult(ptr;int;ptr*);" & _ "SwitchDesktop hresult(ptr);" & _ "CreateDesktopW hresult(int*);" & _ "RemoveDesktop hresult(ptr;ptr);" & _ "FindDesktop hresult(struct*;ptr*);" EndIf ; Instanciation objects Local $CLSID_ImmersiveShell = "{c2f03a33-21f5-47fa-b4bb-156362a2f239}" Local $IID_IUnknown = "{00000000-0000-0000-c000-000000000046}" Local $IID_IServiceProvider = "{6D5140C1-7436-11CE-8034-00AA006009FA}" Local $tIID_IServiceProvider = __uuidof($IID_IServiceProvider) Local $tagIServiceProvider = _ "QueryService hresult(struct*;struct*;ptr*);" ; VirtualDesktopManagerInternal object Const Enum $eLeftDirection = 3, $eRightDirection Local $CLSID_VirtualDesktopManagerInternal = "{C5E0CDCA-7B6E-41B2-9FC4-D93975CC467B}" Local $tCLSID_VirtualDesktopManagerInternal = __uuidof($CLSID_VirtualDesktopManagerInternal) Local $tIID_IVirtualDesktopManagerInternal = __uuidof($IID_IVirtualDesktopManagerInternal) ; ApplicationViewCollection object Local $CLSID_IApplicationViewCollection = "{1841C6D7-4F9D-42C0-AF41-8747538F10E5}" Local $tCLSID_IApplicationViewCollection = __uuidof($CLSID_IApplicationViewCollection) Local $IID_IApplicationViewCollection = "{1841C6D7-4F9D-42C0-AF41-8747538F10E5}" Local $tIID_IApplicationViewCollection = __uuidof($IID_IApplicationViewCollection) Local $tagIApplicationViewCollection = _ "GetViews hresult(struct*);" & _ "GetViewsByZOrder hresult(struct*);" & _ "GetViewsByAppUserModelId hresult(wstr;struct*);" & _ "GetViewForHwnd hresult(hwnd;ptr*);" & _ "GetViewForApplication hresult(ptr;ptr*);" & _ "GetViewForAppUserModelId hresult(wstr;int*);" & _ "GetViewInFocus hresult(ptr*);" ; ApplicationView object Local $IID_IApplicationView = "{372E1D3B-38D3-42E4-A15B-8AB2B178F513}" Local $tagIApplicationView = _ "GetIids hresult(ulong*;ptr*);" & _ "GetRuntimeClassName hresult(str*);" & _ "GetTrustLevel hresult(int*);" & _ "SetFocus hresult();" & _ "SwitchTo hresult();" & _ "TryInvokeBack hresult(ptr);" & _ "GetThumbnailWindow hresult(hwnd*);" & _ "GetMonitor hresult(ptr*);" & _ "GetVisibility hresult(int*);" & _ "SetCloak hresult(int;int);" & _ "GetPosition hresult(clsid;ptr*);" & _ "SetPosition hresult(ptr);" & _ "InsertAfterWindow hresult(hwnd);" & _ "GetExtendedFramePosition hresult(struct*);" & _ "GetAppUserModelId hresult(wstr*);" & _ "SetAppUserModelId hresult(wstr);" & _ "IsEqualByAppUserModelId hresult(wstr;int*);" & _ "GetViewState hresult(uint*);" & _ "SetViewState hresult(uint);" & _ "GetNeediness hresult(int*);" ; VirtualDesktopPinnedApps object Local $CLSID_VirtualDesktopPinnedApps = "{b5a399e7-1c87-46b8-88e9-fc5747b171bd}" Local $tCLSID_VirtualDesktopPinnedApps = __uuidof($CLSID_VirtualDesktopPinnedApps) Local $IID_IVirtualDesktopPinnedApps = "{4ce81583-1e4c-4632-a621-07a53543148f}" Local $tIID_IVirtualDesktopPinnedApps = __uuidof($IID_IVirtualDesktopPinnedApps) Local $tagIVirtualDesktopPinnedApps = _ "IsAppIdPinned hresult(wstr;bool*);" & _ "PinAppID hresult(wstr);" & _ "UnpinAppID hresult(wstr);" & _ "IsViewPinned hresult(ptr;bool*);" & _ "PinView hresult(ptr);" & _ "UnpinView hresult(ptr);" ; Miscellaneous objects Local $IID_IObjectArray = "{92ca9dcd-5622-4bba-a805-5e9f541bd8c9}" Local $tagIObjectArray = _ "GetCount hresult(int*);" & _ "GetAt hresult(int;ptr;ptr*);" Local $tIID_IVirtualDesktop = __uuidof($IID_IVirtualDesktop) ; Windows OS Specific Variable Local $tagIVirtualDesktop = _ "IsViewVisible hresult(ptr;bool*);" & _ "GetId hresult(clsid*);" ; objects creation Local $pService Local $oImmersiveShell = ObjCreateInterface($CLSID_ImmersiveShell, $IID_IUnknown, "") ConsoleWrite("Immersive shell = " & IsObj($oImmersiveShell) & @CRLF) $oImmersiveShell.QueryInterface($tIID_IServiceProvider, $pService) ConsoleWrite("Service pointer = " & $pService & @CRLF) Local $oService = ObjCreateInterface($pService, $IID_IServiceProvider, $tagIServiceProvider) ConsoleWrite("Service = " & IsObj($oService) & @CRLF) Local $pApplicationViewCollection, $pVirtualDesktopManagerInternal, $pVirtualDesktopPinnedApps $oService.QueryService($tCLSID_IApplicationViewCollection, $tIID_IApplicationViewCollection, $pApplicationViewCollection) ConsoleWrite("View collection pointer = " & $pApplicationViewCollection & @CRLF) Local $oApplicationViewCollection = ObjCreateInterface($pApplicationViewCollection, $IID_IApplicationViewCollection, $tagIApplicationViewCollection) ConsoleWrite("View collection = " & IsObj($oApplicationViewCollection) & @CRLF) $oService.QueryService($tCLSID_VirtualDesktopManagerInternal, $tIID_IVirtualDesktopManagerInternal, $pVirtualDesktopManagerInternal) ConsoleWrite("Virtual Desktop pointer = " & $pVirtualDesktopManagerInternal & @CRLF) Local $oVirtualDesktopManagerInternal = ObjCreateInterface($pVirtualDesktopManagerInternal, $IID_IVirtualDesktopManagerInternal, $tagIVirtualDesktopManagerInternal) ConsoleWrite("Virtual Desktop = " & IsObj($oVirtualDesktopManagerInternal) & @CRLF) $oService.QueryService($tCLSID_VirtualDesktopPinnedApps, $tIID_IVirtualDesktopPinnedApps, $pVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & $pVirtualDesktopPinnedApps & @CRLF) Local $oVirtualDesktopPinnedApps = ObjCreateInterface($pVirtualDesktopPinnedApps, $IID_IVirtualDesktopPinnedApps, $tagIVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & IsObj($oVirtualDesktopPinnedApps) & @CRLF) Local $iCount, $pCurrent, $pLeft, $pNew, $iHresult, $hWnd, $pView, $pArray, $pDesktop, $oArray, $oView, $sView, $bValue ; gives the number of virtual desktops ;$iHresult = ($OSBuild >= $windows11) ? $oVirtualDesktopManagerInternal.GetCount(0, $iCount) : $oVirtualDesktopManagerInternal.GetCount($iCount) $iCount = 1 ConsoleWrite("Number of Desktop = " & $iCount & "/" & $iHresult & @CRLF) ;If $iCount > 1 Then Exit MsgBox($MB_SYSTEMMODAL, "", "Please close all additional Virtual Desktops") ; creates a new virtual desktop $iHresult = ($OSBuild >= $windows11) ? $oVirtualDesktopManagerInternal.CreateDesktopW(0, $pNew) : $oVirtualDesktopManagerInternal.CreateDesktopW($pNew) ConsoleWrite("Create = " & $pNew & "/" & $iHresult & @CRLF) $iHresult = ($OSBuild >= $windows11) ? $oVirtualDesktopManagerInternal.SwitchDesktop(0, $pNew) : $oVirtualDesktopManagerInternal.SwitchDesktop($pNew) ConsoleWrite("Switch = " & $iHresult & @CRLF) Run("Notepad.exe") WinWait("[CLASS:Notepad]") ; enumerates all desktops $iHresult = ($OSBuild >= $windows11) ? $oVirtualDesktopManagerInternal.GetDesktops(0, $pArray) : $oVirtualDesktopManagerInternal.GetDesktops($pArray) $oArray = ObjCreateInterface($pArray, $IID_IObjectArray, $tagIObjectArray) ConsoleWrite("Array = " & IsObj($oArray) & @CRLF) $oArray.GetCount($iCount) ConsoleWrite("Count = " & $iCount & @CRLF) $oArray.GetAt(0, DllStructGetPtr($tIID_IVirtualDesktop), $pDesktop) ConsoleWrite("Desktop 0 = " & $pDesktop & @CRLF) $oArray.GetAt(1, DllStructGetPtr($tIID_IVirtualDesktop), $pCurrent) ConsoleWrite("Desktop 1 = " & $pCurrent & @CRLF) ; gives the current desktop id $iHresult = ($OSBuild >= $windows11) ? $oVirtualDesktopManagerInternal.GetCurrentDesktop(0, $pCurrent) : $oVirtualDesktopManagerInternal.GetCurrentDesktop($pCurrent) ConsoleWrite("Current = " & $pCurrent & "/" & $iHresult & @CRLF) ; returns the adjacent desktop id $iHresult = $oVirtualDesktopManagerInternal.GetAdjacentDesktop($pCurrent, $eLeftDirection, $pLeft) ConsoleWrite("Get Left = " & $pLeft & "/" & $iHresult & @CRLF) ; switches to a specific desktop MsgBox ($MB_SYSTEMMODAL,"","Now it will return to previous desktop") Sleep(500) ; gives time for the msg box to close $iHresult = ($OSBuild >= $windows11) ? $oVirtualDesktopManagerInternal.SwitchDesktop(0, $pLeft) : $oVirtualDesktopManagerInternal.SwitchDesktop($pLeft) ConsoleWrite("Switch = " & $iHresult & @CRLF) ; get pointer to a view based on hwnd and create an application view $hWnd = WinGetHandle("[CLASS:Notepad]") $iHresult = $oApplicationViewCollection.GetViewForHwnd($hWnd, $pView) ConsoleWrite("View from handle = " & $pView & "/" & $iHresult & @CRLF) $oView = ObjCreateInterface($pView, $IID_IApplicationView, $tagIApplicationView) ConsoleWrite("Application view = " & IsObj($oView) & @CRLF) $iHresult = $oView.GetAppUserModelId($sView) ConsoleWrite("Get App ID = " & $sView & "/" & $iHresult & @CRLF) ; verify if app is pinned with ptr and string $iHresult = $oVirtualDesktopPinnedApps.IsViewPinned($pView, $bValue) ConsoleWrite("Is View Pinned = " & $bValue & "/" & $iHresult & @CRLF) $iHresult = $oVirtualDesktopPinnedApps.IsAppIdPinned($sView, $bValue) ConsoleWrite("Is AppId Pinned = " & $bValue & "/" & $iHresult & @CRLF) ; move application to a specific desktop $iHresult = $oVirtualDesktopManagerInternal.MoveViewToDesktop($pView, $pDesktop) ConsoleWrite("Move = " & $iHresult & @CRLF) Sleep(2000) ; deletes an existing desktop $iHresult = $oVirtualDesktopManagerInternal.RemoveDesktop($pNew, $pDesktop) ConsoleWrite("Delete = " & $iHresult & @CRLF) Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof1 point
-
ListView Flicker, and failing to DeleteAll.
CYCho reacted to kurtykurtyboy for a topic
@RichardL Try adding the $LVS_EX_DOUBLEBUFFER extended style. This eliminated all flickering for me. $cLV = GUICtrlCreateListView("Column 0|Colourable|Column 2|Column 3|C4|C5", 10, 10, $iGW - 20, $iGH - 20, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER))1 point -
Why AutoIt, and not another language like C# or Python?
DaveScotese reacted to iamtheky for a topic
1) From idea on the shitter --> proof of concept is rarely measured in anything other than minutes. 2) The helpfile is gd amazing (which often facilitates #1). 3) people who have to maintain your uncommented code in the future get the luxury of 1 and 2.1 point