How to make a software overlay desktop and fullscreen games?

Asked

Viewed 1,312 times

0

Hello, I would like to know the name of this technique where we let the software show something superimposing desktop and fullscreen programs and etc...

Example: I created a program that displays the current time, and I want the time to be shown while I play or access the internet, even with the software in the background.

How do I do this in python? It is possible?

1 answer

1


This can be complicated depending on the display mode of the game, if the game is in full screen mode unique means that it has priority over the screen and no other application will be able to display anything other than it, already in other modes like window or full screen window can-overlap in a very easy way.

Apps like Discord for example do this overlay "Overlay name of the technique" directly in DirectX, however if you are going to do this in online games with anti-hack protection very likely you will be detected since this to modify the game graphic in unauthorized mode.

As I said if the game is not in full screen mode you can use a API Windows to override your window inside the game, ie your window will become daughter of the game window as one if it is modal.

Example and C#:

    // API Windows
    [DllImport("user32.dll", SetLastError = true)]
    static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

    // Pega o processo - Jogo CS GO
    Process hostProcess = Process.GetProcessesByName("csgo")[0];
    // Pega o identificador da minha janela overlay janela Handle
    IntPtr hostHandle = new WindowInteropHelper(this).Handle;
    // Pega o identificador da janela do CS GO
    IntPtr guestHandle = hostProcess.MainWindowHandle;

    // Seta a janela filho......
    SetParent(hostHandle, guestHandle);

I don’t use Python but the API can be used with it normally, the parameters for it are the Handles windows, to learn more -> https://www.pinvoke.net/default.aspx/user32.setparent.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.