Amazon Workspaces in Full screen – Switching back to host desktop

This specific content was written 6 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

Quick solution for the problem related to amazon workspaces in full-screen mode.
The only way to switch back to the host system, is to exit full screen – but this is a problem since all the application windows are resized and re positioned.

Unfortunately amazon does not have a fix for this from 2014 to 2018 – as far as  I know.

I usually have word open on my host machine, and since I didn’t want to install visual studio or make a java application.. I decided to make a VBA macro.
The following VBA macro creates for me an Always On Top dialog (even on top of the full-screen dual monitor amazon workspaces).

Clicking the on the dialog causes me host start-menu to pop up, and I can access any of my running host applications or run new ones.

And this works without having to disconnect or leave my full screen mode.

The code follows:

Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_TOPMOST = -1

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function SetWindowPos Lib "user32" (ByVal Hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As Long) As Long

Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" _
        (ByVal Hwnd As Long, _
         ByVal lpOperation As String, _
         ByVal lpFile As String, _
         ByVal lpParameters As String, _
         ByVal lpDirectory As String, _
         ByVal nShowCmd As Long) As Long

Sub showDesktopWindow()
' Insert Rows Below
    UserForm1.Show vbModeless
     AlwaysOnTop ("UserForm1")
End Sub

Public Sub AlwaysOnTop(caption As String)

    Dim ret As Long
    Dim Hwnd As Long
    Hwnd = FindWindow(vbNullString, caption)
    ret = SetWindowPos(Hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Sub

The main macro that I run via a quick-access button is: AlwaysOnTop (“UserForm1”)



Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts