Aug 27, 2010 at 1:18am Aug 27, 2010 at 1:18am UTC
Hi everyone, I am trying to retrieve clipboard data and after looking online I came up with the following:
1 2 3 4 5 6 7 8 9 10 11
//get data
HANDLE clip;
string clip_text = "" ;
if (OpenClipboard(NULL))
{
clip = GetClipboardData(CF_TEXT);
clip_text = (char *)clip;
cout << "Text: " <<clip_text<<endl<<endl;
CloseClipboard();
}
this results in the error message:
203 C:\Users\Chazz & Bill\Documents\prog\input\main.cpp `HANDLE' undeclared (first use this function)
althuogh this is the variable type it tells me to use online. Am i missing an include file?
So far I have:
1 2 3 4 5 6 7
#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream> //file handling
#include <algorithm>
using namespace std;
If it helps I am using Dev-C.
Any ideas?
Thank you for any help you can provide :)
Last edited on Aug 27, 2010 at 1:26am Aug 27, 2010 at 1:26am UTC
Aug 27, 2010 at 1:26am Aug 27, 2010 at 1:26am UTC
SOLVED!!!
I forgot to use:
#include <windows.h>
Aug 27, 2010 at 2:09am Aug 27, 2010 at 2:09am UTC
Maybe it takes a c string, try f_text.c_str()
intead.
Aug 27, 2010 at 2:13am Aug 27, 2010 at 2:13am UTC
:D it works thank you very much but can you explain why this works and using regular strings and constants don't please?