Jump to content
Guest

get gdi render output of invisible form

Recommended Posts

Guest

Hello, I've been thinking about this topic for a long time, but I haven't found an entry point yet.

 

For my question, the primary platform is windows;

what do i want to do?

 

Capturing the form image of a Delphi program running on the desktop, whose windows are not visible and containing many objects in its forms, while it is visible, capturing changes (for example, button click), In short, taking the form render output of a form whose screen is not visible, and sending and executing mouse and keyboard inputs to this invisible form.

 

What will I try to do?

I will make it an open source. When you add the relevant input unit to uses, this unit will create a websocketserver, and will stream the screenshot of the registered form to the webbrowser with compression via websocket in each new session and it will be displayed.

 

How to capture a screenshot of a form that is not visible on the screen (without doing constantly, focus, visible hidden) and send mouse and keyboard inputs to these controls.

 

This application will run as a background process without a desktop visible form.

(It will create 100s of forms for each session and can create new forms within these forms, can define user session by running its own copy process again)

 

Should the way here be to run a process on different desktops with different user names in Windows?


Or is it possible to compile a Delphi form application with webassembler, Can the form view be displayed in the browser, just like previous activex applications?

 

I would appreciate it if you could share a sample code, functions like makescreenshot or bitblt printwindow do not work for invisible forms.

 

 

Edited by Guest

Share this post


Link to post
On 11/19/2023 at 12:02 PM, okoca said:

This application will run as a background process without a desktop visible form.

1. if its its not visible then why do you need to capture an image of it?
2. If you want an invisible app you can make a Console App. And send messages to it to do stuff you want to do.

 

It sounds like you want to do something sneaky, like steal Bitcoins or something.
 

Share this post


Link to post
On 11/19/2023 at 9:02 AM, okoca said:

How to capture a screenshot of a form that is not visible on the screen (without doing constantly, focus, visible hidden)

You can't.  If it's not on-screen, Windows doesn't physically render it.

On 11/19/2023 at 9:02 AM, okoca said:

and send mouse and keyboard inputs to these controls.

It makes no sense to send user input to an invisible window.

On 11/19/2023 at 9:02 AM, okoca said:

This application will run as a background process without a desktop visible form.

Then why are you bothering with creating UI elements that will never be shown on-screen?

On 11/19/2023 at 9:02 AM, okoca said:

is it possible to compile a Delphi form application with webassembler, Can the form view be displayed in the browser, just like previous activex applications?

No, FMX (or VCL) apps cannot be displayed inside a web browser.

On 11/19/2023 at 9:02 AM, okoca said:

functions like makescreenshot or bitblt printwindow do not work for invisible forms.

They don't work for good reason - there is nothing to capture.

Share this post


Link to post
Guest

Thank you for your answers, but you didn't understand what I said.

A live form stream over browser that already performs this event,
application is available, if you examine the socket traffic carefully,

you will see that there is a live stream like i said,  the active view of the form is synchronized
with the live broadcast regardless of the objects it contains, you see a Delphi application screen here, but if the form design is changed and the form title is removed, it can also be turned into an e-commerce site. it will have many uses.


https://www.cybelesoft.com/thinfinity/virtualui/livedemos/

Why don't I use this? It's paid, limited license, and high limits. It's not open source.
I expect help from people with advanced technical knowledge who have and can share, I am renewing my question again,
what kind of logic could a structure like this work with?

 

From a technical point of view, I can handle all the parts like javascript and ajax etc on the browser side, but on the delphi side it couldn't find the entry way. what I know; SDK is added to the main unit of the program.
This SDK creates 100s of its own copy processes on the server, but none of them have a visual form interface.

I think it uses an algorithm just like Windows' RDP to run the live stream protocol on different desktops on an application basis.

 

1.png

Edited by Guest

Share this post


Link to post
Guest
22 minutes ago, Pat Foley said:

Check this out https://blogs.embarcadero.com/evaluating-web-development-frameworks-for-delphi/

 

Learning how vpn and vnc work would give you a leg up. 

thanks for replayt, I know how its work, I have written a vnc clone that uses rle + lzma algorithm in the past, this suggestion has nothing to do with the subject,  Or please write more clearly what you mean, I might have missed it?

Share this post


Link to post

It was the one that had the apps running on the server side and sent out the screen shots. Who would run a program that served pix of local machine?     

Share this post


Link to post
Guest
9 minutes ago, Pat Foley said:

It was the one that had the apps running on the server side and sent out the screen shots. Who would run a program that served pix of local machine?     

It was the one that had the apps running on the server side and sent out the screen shots.

Who would run a program that served pix of local machine?

For the end user, it does not matter whether the visual objects in the webbrowser are developed using standards such as HTML and CSS,

In this case, a specific program must either rewrite the web interface (using techniques such as HTML and CSS) or use Delphi's limited component sets that provide visual output on the webbrowser (after a certain level, technical knowledge is needed due to reasons such as CSS, Javascript, restricted browser-side objects), another way is to You simply stream your application to the webbrowser with the logic I have exemplified, run it in-house, put a login screen at the entrance, save money on the web interface, this structure is currently run over RDP, and this is where the Windows RDP license comes into play.

The benefit of this varies from person to person, I answered this question because I thought you asked me.

And yes I want it, there were moments when I needed it.

Share this post


Link to post
On 11/19/2023 at 7:02 PM, okoca said:

I would appreciate it if you could share a sample code, functions like makescreenshot or bitblt printwindow do not work for invisible forms.

Are you sure BitBlt doesn't work, because if you did not create compatible DC you will not be able to get correct pixels.

from https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-bitblt

BitBlt returns an error if the source and destination device contexts represent different devices.
To transfer data between DCs for different devices, convert the memory bitmap to a DIB by calling GetDIBits.
To display the DIB to the second device, call SetDIBits or StretchDIBits.

though it does not always will fail it might be white or just black.

 

But have you tried this https://learn.microsoft.com/en-us/windows/win32/gdi/capturing-an-image

 

CreateCompatibleBitmap should solve most of your problem, i guess !

Share this post


Link to post
23 hours ago, okoca said:

I expect help from people with advanced technical knowledge who have and can share

Would you like a pony with that too?

 

Honestly, the entitlement of that statement!

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×