i was given this example to paste from the clipboard and it works fine.
Code:#include <stdio.h>
#include <windows.h>
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <cstdio>
#include <conio.h>
int GetClipboardSize()
{
OpenClipboard(NULL) ; // Obtain clipboard
HGLOBAL handle = GetClipboardData (CF_TEXT) ; // get handle to data
CloseClipboard() ; // Close clipboard
return GlobalSize( handle ) ; // return size of data
}
void GetClipboardText( TCHAR * buffer )
{
OpenClipboard(NULL) ; // Obtain clipboard
HGLOBAL handle = GetClipboardData (CF_TEXT) ; // get handle to data
char* szClipboard = (char*)GlobalLock(handle); // lock data
lstrcpy( buffer, szClipboard ) ; // copy clipboard text
GlobalUnlock (handle) ; // unlock data
CloseClipboard () ; // close data
}
int main()
{
// Allocate enough memory to save text in clipboard.
char * szClipboardText = new char[ GetClipboardSize() + 1 ] ;
// Get the clipboard text.
GetClipboardText( szClipboardText ) ;
// Print clipboard text.
printf( "Clipboard Text: \"%s\"", szClipboardText );
cout << endl;
// Delete the memory.
delete[] szClipboardText ;
getchar();
}
is there similar code that will copy to the clipboard? i would like to use these two together.