There's a catch... Of course virtual, not manual and it has to work in Linux and MacOS.
Okay, so in Windows we can use a WinAPI trick to min/restore a Window, which will "Activate" the window. Activate means it is not just in focus, it is also ready to use. With QB64, we can do a _SCREENCLICK to virtually activate it, just as if we clicked it! Oops, problem here is _SCREENCLICK, and other keywords like _SCREENPRINT, etc., are not supported in LInux and MacOC.
So the challenge is to replace the _SCREENCLICK line with something else (number of lines doesn't matter) that will have the same effect to activate the window.
So to try, you need to...
1) Copy and run the first and then the second snippet, in that order. They'll use the CLIPBOARD to message between the two windows.
2) Adjust the windows on your desktop so they don't overlap.
3) Click the first program window to initially activate it.
4) Input a test message (Type and press Enter).
5) Notice the second window "Self-Activates" and displays the message received.
6) Input a reply.
7) The first window self-activates, displays the reply, and you are ready to input another message. It's like a ping-pong effect!
So the challenge is to sub out _SCREENCLICK with any line of code or sub-routine that will work in Linux / Mac OS to do the same effect, "activate" the window so we don't have to click on it.
This challenge is based on a much more polished chat app / messenger in this thread: https://qb64phoenix.com/forum/showthread...n=lastpost
If you solve it, you be the hero of the Linux/Mac community, literally billions upon billions of brain cells will thank you.
Program one, the host...
Program 2, the client...
Okay, so in Windows we can use a WinAPI trick to min/restore a Window, which will "Activate" the window. Activate means it is not just in focus, it is also ready to use. With QB64, we can do a _SCREENCLICK to virtually activate it, just as if we clicked it! Oops, problem here is _SCREENCLICK, and other keywords like _SCREENPRINT, etc., are not supported in LInux and MacOC.
So the challenge is to replace the _SCREENCLICK line with something else (number of lines doesn't matter) that will have the same effect to activate the window.
So to try, you need to...
1) Copy and run the first and then the second snippet, in that order. They'll use the CLIPBOARD to message between the two windows.
2) Adjust the windows on your desktop so they don't overlap.
3) Click the first program window to initially activate it.
4) Input a test message (Type and press Enter).
5) Notice the second window "Self-Activates" and displays the message received.
6) Input a reply.
7) The first window self-activates, displays the reply, and you are ready to input another message. It's like a ping-pong effect!
So the challenge is to sub out _SCREENCLICK with any line of code or sub-routine that will work in Linux / Mac OS to do the same effect, "activate" the window so we don't have to click on it.
This challenge is based on a much more polished chat app / messenger in this thread: https://qb64phoenix.com/forum/showthread...n=lastpost
If you solve it, you be the hero of the Linux/Mac community, literally billions upon billions of brain cells will thank you.
Program one, the host...
Code: (Select All)
WIDTH 50, 25
DO
_CLIPBOARD$ = ""
LINE INPUT "Message: "; msg$: PRINT
_CLIPBOARD$ = msg$: msg$ = ""
_DELAY 2
DO
_LIMIT 5
LOOP UNTIL LEN(_CLIPBOARD$)
'----------------------------------------------------------------------------------------------------
' Challenge: Replace line below with something that Linux/Mac can use to activate the window."
_SCREENCLICK _SCREENX + 60, _SCREENY + 10
'----------------------------------------------------------------------------------------------------
msg$ = _CLIPBOARD$
PRINT "Reply: "; msg$: PRINT
_DELAY 1
LOOP
Program 2, the client...
Code: (Select All)
WIDTH 50, 25
DO
DO
_LIMIT 5
LOOP UNTIL LEN(_CLIPBOARD$)
'----------------------------------------------------------------------------------------------------
' Challenge: Replace line below with something that Linux/Mac can use to activate the window."
_SCREENCLICK _SCREENX + 60, _SCREENY + 10
'----------------------------------------------------------------------------------------------------
msg$ = _CLIPBOARD$
PRINT "Reply: "; msg$: PRINT
_CLIPBOARD$ = ""
LINE INPUT "Message: "; msg$
_CLIPBOARD$ = msg$
_DELAY 2
_CLIPBOARD$ = "": msg$ = ""
LOOP