sensing when the clip board has changed

In VB 6 there was a way to sense the event when the clipboard was performing a copy ( outside of the application )
the text could then be assigned to a text field without the need to do a manual paste.

Does Xojo have this capability ?
It there a plugin that will handle this ??

Please advise.

I quit using VB6 many years ago, after discovering Xojo (or rather its predecessors). So I don’t remember exactly what you are referring to here, or what action you are really looking to perform. I only recall there being a way to put something into the clipboard, or retrieving the contents of the clipboard.

You can accomplish those things easily in Xojo too. See the Clipboard class:

There is example code at the above class description for programatically placing text onto the clipboard. I just checked, and in the Examples shipped with Xojo under Text there is both a ClipBoard and DragText sample project. You may want to look at those projects as well.

Please move this question to the Windows channel as it’s apparently specific to Windows (I had an answer for Mac)

It isn’t clear to me the OP is looking for a Windows specific solution. I interpreted it as a request to perform an action similar to what the OP did in VB6, but that does not necessarily mean the capability is not now desired cross platform. What is even less clear to me is exactly what action is desired here. I must not remember VB6 well enough now.

On macOS you need to use a timer and check yourself if the content has changed as there is no notification sent out when the clipboard changes.

I see no such event here

It should be pretty simple to monitor the clipboard in a timer, say 500ms period, and look for its content.

Monitoring picture, pictureAvailable, Text or TextAvailable and RawDataAvailable changes, and the value of the clipboard, I see no major hurdle here.

David : to move this discussion to Windows, click on Controls and select “Change Channel”.

Oh, I evidently misinterpreted this part of the OP question:

I was thinking the OP meant to assign the text to a field outside the application, similar to asking about dragging listbox rows out of the application. If it is the reverse, detecting when the clipboard has new contents you want to auto-paste in the application, then I agree a timer is the way to go. One scenario where I can see that being potentially useful is a license dialog. If the clipboard text changes and is a valid format for your license scheme, auto pasting it into an open license dialog is marginally convenient.

this could work on any platform, not only on macos ?

Yes, of course polling will work on any platform.

You could event-check if the clipboard has changed each time the application or window is brought to the foreground.

I haven’t used this functionality myself, but I am using MBS plug-in to listen to other WM messages sent in the system.

Apparently that is the older way to monitor the clipboard… Microsoft recommends using some newer commands… The following code is just something off the top of my head as I’m on a MacBook right now so can’t test Windows declares…

GetClipboardSequenceNumber function

Declare Function GetClipboardSequenceNumber Lib "user32.dll" () As Int32

The system keeps a serial number for the clipboard for each window station. This number is incremented whenever the contents of the clipboard change or the clipboard is emptied. You can track this value to determine whether the clipboard contents have changed

AddClipboardFormatListener function

Declare Function AddClipboardFormatListener Lib "user32.dll" (HWND As Integer) As Boolean

Places the given window in the system-maintained clipboard format listener list.
Returns TRUE if successful, FALSE otherwise.
When a window has been added to the clipboard format listener list, it is posted a WM_CLIPBOARDUPDATE message whenever the contents of the clipboard have changed.

RemoveClipboardFormatListener function

Declare Function RemoveClipboardFormatListener Lib "user32.dll" (HWND As Integer) As Boolean

Removes the given window from the system-maintained clipboard format listener list.
Returns TRUE if successful, FALSE otherwise.
When a window has been removed from the clipboard format listener list, it will no longer receive WM_CLIPBOARDUPDATE messages.

I am Developing primarily for MAC OS and have a should i still move this to a windows discussion?

If indeed you develop cross platform that is fine as it is. Maybe next time, it would be worthwhile to mention in your original post the cross-platform nature of your development, so specialists of both platforms can help.