// Copy the data to the clipboard
Bool copytoclipboard (const char * pszdata, const int ndatalen)
{
If (: openclipboard (null ))
{
: Emptyclipboard ();
Hglobal clipbuffer;
Char * buffer;
Clipbuffer =: globalalloc (gmem_ddeshare, ndatalen + 1 );
Buffer = (char *): globallock (clipbuffer );
Strcpy (buffer, pszdata );
: Globalunlock (clipbuffer );
: Setclipboarddata (cf_text, clipbuffer );
: Closeclipboard ();
Return true;
}
Return false;
}
// Obtain data from the clipboard
Bool gettextfromclipboard ()
{
If (: openclipboard (null ))
{
// Obtain the Clipboard data
Hglobal hmem = getclipboarddata (cf_text );
If (null! = Hmem)
{
Char * lpstr = (char *): globallock (hmem );
If (null! = Lpstr)
{
// MessageBox (0, lpstr, "", 0 );
: Globalunlock (hmem );
}
}
: Closeclipboard ();
Return true;
}
Return false;
}
//////////////////////////////////////// //////////////////////////
Simulate Ctrl + V
Keybd_event (vk_control, 0, 0 );
Keybd_event ('V', 0, 0 );
Keybd_event ('V', 0, keyeventf_keyup, 0 );
Keybd_event (vk_control, 0, keyeventf_keyup, 0 );