How to get the Clipboard data using OLE
- New
- How-to
- Christopher Craft
- PowerBuilder
- Wednesday, 22 January 2025 07:18 PM UTC
PB 2022
I am trying (still) to find out how our PowerBuilder application can support Copy/Paste across a Remote Desktop session (The Windows API GetClipboardData doesn't work across a Remote Desktop session). I came across some posts that mentioned the OLEGetClipboard call will work but I have been unable to figure out how to process the IDataObject that it returns. Has anyone ever done this before?
Following is a snippet of my code but I also attached a test window which has all the declarations.
Thank you for any input on this.
Chris Craft
Code Snippet:
// Declare variables
long ll_result
long ll_clipboardData
// Call OleGetClipboard to get the clipboard data
ll_result = OleGetClipboard(ll_clipboardData)
IF ll_result = 0 THEN
OleObject lo_dataObject
lo_dataObject = CREATE OleObject
// How do we get the Clipboard data from IDataObject!?!?!
//IF lo_dataObject.ConnectToNewObject("IDataObject", ll_clipboardData) = 0 THEN
IF lo_dataObject.ConnectToNewObject("IDataObject") = 0 THEN
MessageBox("Success", "IDataObject connected successfully!")
ELSE
MessageBox("Error", "Failed to connect to IDataObject.")
RETURN
END IF
END IF
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.