Hot Door CORE Forum
Clipboard Access - Managing Users Clipboard Data - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: General discussion (http://hotdoorcore.com/forum/forumdisplay.php?fid=3)
+--- Thread: Clipboard Access - Managing Users Clipboard Data (/showthread.php?tid=312)



Clipboard Access - Managing Users Clipboard Data - zero - 04-12-2022

Hi all,

things are going super well, i have a working plugin and am tracking selected items and colors on the document.

i wanted to see if anyone have any insight into reading data on the users clipboard ? i am trying to get a value from it to build different items, read from it and create new data that is formatted on their clipboard.

i have tried using the ClipboardData class on HDC but cannot seem to get it to work properly. not sure if you have a better example or maybe i am just missing something, but i cannot figure out how to get the string that is on the clipboard.

i think maybe its something to do with the class itself, or maybe i am just missing something.

thanks all !!


RE: Clipboard Access - Managing Users Clipboard Data - Rick Johnson - 04-12-2022

Here's how I get string data from the clipboard:


Code:
hdi::core::ClipboardData cbData;
std::string str;
if (hdi::core::clipboardData(cbData)
&& cbData.dataType() == hdi::core::ClipboardData::DataTypeString){
str = cbData.stringData();
}


To put string data onto the clipboard:

Code:
hdi::core::setClipboardData(str);

Maybe these techniques are not technically correct, but have been working well for me.


RE: Clipboard Access - Managing Users Clipboard Data - zero - 04-14-2022

(04-12-2022, 10:11 AM)Rick Johnson Wrote: Here's how I get string data from the clipboard:


Code:
hdi::core::ClipboardData cbData;
std::string str;
if (hdi::core::clipboardData(cbData)
&& cbData.dataType() == hdi::core::ClipboardData::DataTypeString){
str = cbData.stringData();
}


To put string data onto the clipboard:

Code:
hdi::core::setClipboardData(str);

Maybe these techniques are not technically correct, but have been working well for me.


Confirmed!! This is working well for me. I am able to set this data and then also with some other work i have been able to set the data, pull data off of the clipboard, modify it, and then reattach it back to the clipboard without losing the integrity of the data. 

Very happy and thanks for your help!!