N
N
nikitao2019-02-26 03:33:13
API
nikitao, 2019-02-26 03:33:13

How to send WM_LBUTTONDOWN without connected monitor?

Good afternoon!
There is some application. It does not have any API, and it was necessary to establish automatic work with it.
Therefore, another application is written that interacts with it through WinAPI.
Sends it messages of type WM_LBUTTONDOWN via PostMessage:
PostMessage(window, (uint)windowMessages.WM_LBUTTONDOWN, button, clickPos);
Everything works well and stable.
But there was a need to run this whole thing on a rented server. There is no monitor and, accordingly, the interaction is broken. As I understand it is normal. No monitor -> no window size \ no window focus -> sent coordinates/message is incorrect
But the question arises how to solve my problem? It is necessary either to solve the problem at the WinAPI level or to emulate a monitor.
As a crutch, I had to keep the RDP session open for the time being. Then everything works normally.
Is there any solution?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
CHolfield, 2019-02-26
@CHolfield

It's not about the monitor, but about the presence/absence of the user's session. No session - no GUI session, no application windows, nowhere to poke. It is necessary to register the automatic login of the desired user at the start of Windows:
www.windowsfaq.ru/content/view/895/120

R
rPman, 2019-02-26
@rPman

If you connect to the server via rdp, then after disconnecting the session is blocked and the GUI does not work.
You need to either keep the rdp session open or connect to the console, for example, vnc / teamviewer (providers will not give you this in the data center)
ps I solved the problem by running desktop windows in a virtual machine, at the same time it worked on linux but with a noticeable decrease in speed

N
nikitao, 2019-02-28
@nikitao

It turned out so far to solve the problem like this:
If I go through VNC (I use RealVNC Server \ Client), then after closing the VNC client, the user's Windows does not disconnect and everything continues to work.
In many cases this is sufficient.
But I need the work of several sessions at the same time. Therefore, on one account (which is accessed via VNC), RDP sessions are opened for those accounts from which real work is already underway.
That's such a horror, but it works and thanks for that))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question