Idea got from " Mouse w/o Borders"

Idea got from " Mouse w/o Borders"

Postby Jimmy » Fri Feb 03, 2023 10:13 pm

hi,

there is a Microsoft "Garage" Tool called "Mouse w/o Borders" (http://www.aka.ms/mm)

you can "control" Mouse/Keyboard up to 4 PC in a local Network and transfer Data to/from Clipboard

more Information here
https://answers.microsoft.com/en-us/windows/forum/all/mouse-without-borders-setupuser-guide-tips-tricks/0523308d-3406-4273-b86e-bef28aa6b50d
---

what i like to have :

Send a Message to other Workstation -> "Mailslot" :?:
Sent or Get other Workstation Clipboard -> Net-Clipboard :?:

---

ask ChatGPT

can you tell me how to use Mailslot to send Message to other Workstation in lokal Network ?

1. Create a mailslot on the sending workstation:
CreateMailslot("\\.\mailslot\MyMailslot", 0, MAILSLOT_WAIT_FOREVER, NULL);

2. Create a mailslot on the receiving workstation:
CreateMailslot("\\.\mailslot\MyMailslot", 0, MAILSLOT_WAIT_FOREVER, NULL);

3. On the sending workstation, write the message to the mailslot:
WriteFile(hMailslot, lpBuffer, dwBytesToWrite, &dwBytesWritten, NULL);

4. On the receiving workstation, read the message from the mailslot:
ReadFile(hMailslot, lpBuffer, dwBytesToRead, &dwBytesRead, NULL);

5. Close the mailslot handles on both workstations:
CloseHandle(hMailslot);


can you tell me how Sent or Get other Workstation Clipboard

To send or get other workstation clipboard, you can use a clipboard sharing program. There are many programs available that allow you to share clipboard data between multiple computers. Some of the most popular programs include Synergy, ShareClipboard, and ClipboardFusion.


can you show me CODE how Sent or Get other Workstation Clipboard ?

//Sending clipboard data to another workstation

//Create a new Clipboard object
Clipboard clipboard = new Clipboard();

//Put the data you want to send into the clipboard
String data = "This is the data I want to send";
clipboard.setContents(data, null);

//Create a socket connection to the other workstation
Socket socket = new Socket("otherWorkstationIP", port);

//Create an output stream to the socket
OutputStream out = socket.getOutputStream();

//Write the clipboard data to the output stream
clipboard.writeToStream(out);

//Close the socket connection
socket.close();

//Receiving clipboard data from another workstation

//Create a socket connection to the other workstation
Socket socket = new Socket("otherWorkstationIP", port);

//Create an input stream from the socket
InputStream in = socket.getInputStream();

//Create a new Clipboard object
Clipboard clipboard = new Clipboard();

//Read the clipboard data from the input stream
clipboard.readFromStream(in);

//Close the socket connection
socket.close();

//Retrieve the data from the clipboard
String data = clipboard.getContents();


who can help me to make Fivewin CODE from those Answer :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Idea got from " Mouse w/o Borders"

Postby TimStone » Sat Feb 04, 2023 12:58 am

Ask the last question of chatGPT adding the phrase "using Harbour and FiveWin"

Lets see what it says.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Idea got from " Mouse w/o Borders"

Postby Jimmy » Sat Feb 04, 2023 7:00 am

hi Tim,
TimStone wrote:Ask the last question of chatGPT adding the phrase "using Harbour and FiveWin"
Lets see what it says.

i did modify Question and ask ChatGPT again and got this Answer

Here's an example of how you might send a message using Mailslots in Harbour and FiveWin:

Code: Select all  Expand view
#include "fivewin.ch"
FUNCTION Main()
   LOCAL cMessage := "This is a test message."
   LOCAL hMailslot

   hMailslot := FwlCreateMailslot( "\\.\mailslot\example", 0, 0, NIL )

   IF hMailslot == NIL
      MessageBox( "Error", "Could not create mailslot.", MB_OK + MB_ICONSTOP )
      RETURN NIL
   ENDIF

   IF ! FwlWriteMailslot( hMailslot, cMessage, LEN( cMessage ), NIL )
      MessageBox( "Error", "Could not write to mailslot.", MB_OK + MB_ICONSTOP )
      RETURN NIL
   ENDIF

   MessageBox( "Success", "Message sent successfully.", MB_OK + MB_ICONINFORMATION )

   FwlCloseMailslot( hMailslot )

RETURN NIL


And here's an example of how you might receive messages from a Mailslot in Harbour and FiveWin:

Code: Select all  Expand view
#include "fivewin.ch"
FUNCTION Main()

   LOCAL cMessage := SPACE( 100 )
   LOCAL hMailslot
   LOCAL nBytesRead

   hMailslot := FwlOpenMailslot( "\\.\mailslot\example" )

   IF hMailslot == NIL
      MessageBox( "Error", "Could not open mailslot.", MB_OK + MB_ICONSTOP )
      RETURN NIL
   ENDIF

   DO WHILE .T.
      nBytesRead := FwlReadMailslot( hMailslot, @cMessage, 100, NIL )

      IF nBytesRead == -1
         MessageBox( "Error", "Could not read from mailslot.", MB_OK + MB_ICONSTOP )
         RETURN NIL
      ELSEIF nBytesRead == 0
         EXIT
      ELSE
         MessageBox( "Message Received", cMessage, MB_OK + MB_ICONINFORMATION )
      ENDIF
   ENDDO

   FwlCloseMailslot( hMailslot )

RETURN NIL

i "wish" it would be true ...
CODE look "nice" but there are no fw Function using that Names :roll:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 65 guests