winapi - Copy embedded structure to clipboard and retrieve it in win32 -


i trying implement clipboard operation (cut/copy/paste) on win32 window. window has bunch of gdi objects drawn on it, , window can have child controls inserted in well.

i have searched allot on win32 clipboard api, , every have explained how handle single type of data, e.g. can write text onto clipboard specifying appropriate clipboard format , etc.

what need place data on clipboard used reconstruct original window after paste operation. not want use com suggested msdn embedded data structures.

can carried out using basic clipboard api? can point me in right direction , steps need take bring about? newbie in win32 , don't know allot doing.

use registerclipboardformat() register custom clipboard format id. serialize data needed, using whatever serialization format meaningful data, , store on clipboard using setclipboarddata(). @ later time, can use getcliipboarddata() retrieve data , de-serialize needed.

update: example:

struct smydata {     int value1;     int value2;     float value3;     float value4; };  uint umydatafmtid = registerclipboardformat(text("mydata"));  ...  handle hmydata = globalalloc(ghnd, sizeof(smydata)); smydata *pmydata = (smydata*) globallock(hmydata); // fill in pmydata needed... globalunlock(hmydata); setclipboarddata(umydatafmtid, hmydata);  ...  handle hmydata = getclipboarddata(umydatafmtid); smydata *pmydata = (smydata*) globallock(hmydata); // use pmydata needed... globalunlock(hmydata); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -