I want to get all of children handle of Windows that its run in Virtual Box .
I want send a key from Host Windows(Main Windows) to notepad of Guest Windows.
I know that we can find child window by using EnumChildWindows in delphi but Virtual Box only retrieve QWidget class name.
can anyone help me access to all of handle of Guest Windows(its run in Virtual Box) from main windows using delphi ?
thank you.
I want to get all of children handle of Windows that its run in Virtual Box .
Sorry, but you cannot do that. Like AlexK said in comments, windows running within the guest OS simply do not exist within the host OS, so they cannot be accessed or enumerated by apps running in the host OS. The VM is running a completely separate guest OS and is simply rendering the display output of that OS on its own window running on the host OS.
I want send a key from Host Windows(Main Windows) to notepad of Guest Windows.
There is no way to do that directly.
When a user types a key on the physical keyboard or an on-screen keyboard within the host OS, the key is put into the input queue of the host OS and gets routed to the current focused window within the host OS. If that window happens to be the VM, then the VM places the key in the input queue of the guest OS and it gets routed to the current focused window within the guest OS.
An app running on the host OS can use SendInput() to simulate keyboard input in the host OS, and let it get routed accordingly.
If you need more control, you will have to run a separate app within the guest OS that is connected to your main app running on the host OS. The host app can then communicate with the guest app, and the guest app can act on guest windows as needed.
For example, the host app could ask the guest app to enumerate the guest windows and send that list back to the host app. The host app could detect the presence of Notepad and send the desired key(s) to the guest app, which could then send the key(s) to the Notepad window.
I know that we can find child window by using EnumChildWindows in delphi
Only for windows that are running in the same OS that the enumerating app is running in.
but Virtual Box only retrieve QWidget class name.
Because that is the window that is running within the host OS.
Related
I understand that desktop/GUI apps are not supported in Windows containers. They do run but there's no built-in way to interact with them. I had the following idea - maybe I could use the Desktop Sharing API (https://learn.microsoft.com/en-us/windows/win32/api/_rdp/) for this purpose, the idea is to run a desktop app, then run a sharing program that uses the Desktop Sharing API, and connect to it using a Desktop Sharing API viewing program from the host.
I had to do some recap about window stations and desktops, and I noticed that when starting the container with cmd in interactive mode, I'm logged with ContainerAdministrator as a service (logon type 5). I tried running some WinAPI functions that deal with desktops and winstation and got some access denied results, so I switched to running cmd as system.
The window station of the cmd process (and other child processes) is not the interactive WinSta0, but instead some other service window station, which makes sense since I'm logged on as a service, and I figured that I can't use this window station, so I used a little program I wrote to run notepad in Winsta0 in the Default desktop. Afterwards I ran another program that enumerates the windows on WinSta0\Default, and the notepad window does get enumerated and I also get it's title, so it's running somewhere.
So now I tried running the desktop sharing API program (also on WinSta0\Default). It runs and I can connect from the host, but I only get a black screen without anything on it. I also tried running a program that takes a screenshot of the windows but I get an empty bitmap.
So I thought maybe the Default desktop is not the active desktop, and by using the OpenInputDesktop function I could confirm it - the current desktop was the Winlogon desktop, so I used the SwitchDesktop function to switch to the Default desktop (I used OpenInputDesktop again to verify that it actually worked).
Unfortunately, this didn't change anything, I still get an empty screen and empty bitmaps.
I know that containers are built for micro services and are not supposed to run GUI apps and so, but still - is there a way to make this work? Or any ideas of what else I can check? Alternatively, if you know that it can't work - I would also be happy to hear a good technical explanation of why it doesn't work.
I have a Mac with Virtual Box, on which I'm running Windows 8.
I have set up a Shared Folder in the Virtual Box settings. When I boot up Windows8 through Virtual Box, I can see the Mac as one of the options - screenshot: http://i.imgur.com/mzMbDh3.png (WINDOWSMAC is the name of the VM. MACINTOSH I'm guessing would then be the host).
I am thinking I need to access MACINTOSH to get to the shared folder. The problem is - when I click on MACINTOSH I am presented with a popup to enter my username and password: http://i.imgur.com/u3HwLYm.png
Is this a username password to my Mac Host or to the Windows Guest? It seems neither will work.
Am I missing some step in creating/accessing the shared folder? Any help will be greatly appreciated
You have to install the VM guest additions. Mount your guest and click the menu item Devices > Insert Guest Additions CD image. Now you can install it on your guest. Possibly you have to reboot your guest.
Afterwards your shared folder should live under \\vboxsrv.
you share files or folder between host and guest system in a simple way:from the devices menu, chose drag and droop ,the default selection is disabled, other option available are either drag and drop in on direction host-> guest or vice versa or in both direction
I am using the below JAVA code to capture the desktop of a remote machine
Robot robot = new Robot();
BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ByteArrayOutputStream imageBytes = new ByteArrayOutputStream();
ImageIO.write(screenShot, "PNG", imageBytes);
return imageBytes.toByteArray();
However the captured image is blank, when the terminal session to the remote machine is either minimized or disconnected. I appreciate your help in resolving the issue, at the very least the minimized scenario.
Configuration:
I have the same issues with a physical machine running windows 7 and a virtual machine running windows server 2008 R2.
More insights from MSDN:
Why you get black screen when you disconnect from RDP ?
http://msdn.microsoft.com/en-us/library/aa383015%28VS.85%29.aspx
Here is my attempt to make things work, but none of the following did the trick:
How to get data when RDP window minimized ?
You can force the RDP display driver to send data when minized, try these steps and let me know how it goes:
1) Add the following key
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\ Created a new DWORD value and named it RemoteDesktop_SuppressWhenMinimized. Specified 2 as the value data.
Note: Also tried adding the registry key to HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client\
2) Disable bitmap caching (http://technet.microsoft.com/en-us/library/cc737325(WS.10).aspx)
In the Remote Desktop Connection window, click Options.
On the Experience tab, verify that the Bitmap caching check box is selected. Or, to disable bitmap caching, clear theBitmap caching check box
If you minimize the Remote Desktop window, Windows switches the remote session to the GUI-less mode and does not display windows and controls. As a result, TestComplete (or TestExecute) will be unable to interact with the tested application’s GUI, as it does not exist and your automated GUI test will fail.
To work around the issue, you can change the Remote Desktop’s registry settings on your local computer (where you launch the Remote Desktop):
On your local computer, close all open Remote Desktop sessions.
Launch the Registry editor (regedit.exe).
Navigate to one of the following Registry keys, depending on whether you wish to modify the Remote Desktop settings only for the current user or for all users on the computer:
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.
Or you can do it programmatically by following steps:
Transparent the window
Restore the Window
Capture
Minimize it again
Remove transparency
We had similar problem in our project last year...we could find any stable and permanent solution....however here is how a work around worked for us...
We had to run on 5 remote desktops (which will take screens capture as well during failure) ..however as you have figured already if we disconnect session or minimise the RDC Window blank screenshot is captured. Therefore we had added one more VM to connect those other five test boxes. The task for that VM is to keep session active and resized to other 5 boxes...this worked for us.
If you connect a remote desktop to the test machine, make sure to reboot the machine when you are done, otherwise the desktop will remain locked and screen captures will not work.
I don't believe there is any other way around the issue.
I just configured the clients to auto logon, disabled the screen saver and installed a VNC server on each client.
Basically, make sure the screen is always on, and don't RDP into them.
This worked on both physical PCs and on virtual machines hosted on a Hyper-V server.
I even wrote a small .NET desktop client that ran multiple VNC clients inside a single window, so we could see what was happening on all the clients. We had an old PC running this with it's monitor on top of a cupboard to (a) let the developers see if any client had hung, had hundreds of browser windows open, etc. and (b) to look impressive for any non-developers walking past.
A simpler alternative to the above answers to to transmute the terminal session (RDP) into the console session. The session will then display to the physical screen (Switching the user of anyone currently logged into the physical machine). The following command does this:
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (tscon.exe %%s /dest:console)
I'm running a VirtualPC 2007 VM with Windows2003 as the OS. Inside of this I am using a web based VPN to connect to my client's network. I cannot use this VPN from my host machine because it does not work with Vista (still!). Inside the VM I'm connecting to a Terminal Server at the client site which I'm logging into using their domain.
I need to change my password. Obviously what you would normally do is hit ctrl-alt-del and click change password. However since I'm inside of a TS inside of a VM this is not an option. When logging in to the VM I have to press alt-(left arrow)-del and then type in my password. I also know that usually when using remote desktop, in order to simulate a ctrl-alt-del inside there you would press ctrl-alt-end. With this knowledge, I've tried every possible combination of these keys that I can think of, but none of them bring up the Windows Security Dialog Box.
What I'm looking for is either
A way to open the Windows Security Dialog Box (or simply the change password form from there) without pressing ctrl-alt-del (is there a command line I can use?)
A different way to change my domain password without using the aforementioned box
I am using VirtualPc 2007 more and more, the one annoyance is "Alt-Tab".
What I want is to be able to use alt-tab to iterate through all of the applications in the host pc and virtual(s) as if they were one long list. Is there a setting or program to do this?
No. If the VPC is in full screen mode, alt+tab works only within the context of the VPC. If the VPC Screen is not focused, you will get the collection of applications that are in the Host (including the instance of VPC)
Sadly, no. This is possible in Parallels on the Mac, in what they call "Coherence" mode. But Virtual PC does not support that kind of integration.
No. If the VPC is in full screen mode, alt+tab works only within the context of the VPC. However, you may find the "Host key+DOWN ARROW" shortcut useful. This minimizes the virtual machine and allows you to alt-tab on the host again.