473,545 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy Clipboard in file


Hi

it's possible with language C, (Mingw or Djgpp)
copying the clipboard of WinXp into file.txt?

which function must be use.

Thanks

Oct 3 '08 #1
23 6249
Over wrote:
Hi

it's possible with language C, (Mingw or Djgpp)
copying the clipboard of WinXp into file.txt?
Probably, but here or a number of the other groups you have multi-posted
(don't do that!) to is not the place to ask.

Ask on a windows group.

--
Ian Collins.
Oct 3 '08 #2
On 3 Oct 2008 at 22:18, Over wrote:
it's possible with language C, (Mingw or Djgpp)
copying the clipboard of WinXp into file.txt?

which function must be use.
Lots of people here can answer your question, but none of them will.
Wait and see the responses you get if you don't believe me.

(Jacob Navia is the only one able and willing to answer Windows
questions, and he seems to be taking a break from the feverish idiocy of
clc at the moment.)

However, the first result in this search looks like it will lead quickly
to the answer:
<http://www.google.com/search?q=site%3 Amsdn.microsoft .com+windows+ap i+clipboard>

Oct 3 '08 #3

ok, many thanks
Regards
Oct 3 '08 #4

"Over" <ov**@nospam.ov erwrote in message
news:48******** *************** @reader3.news.t in.it...
>
Hi

it's possible with language C, (Mingw or Djgpp)
copying the clipboard of WinXp into file.txt?

which function must be use.
Try something like this:

#include <stdio.h>
#include <windows.h>

char* pastetext(void) {
HWND hwnd=0;
HWND htext;
char *p, *q;
int size;

if (OpenClipboard( hwnd)==0) return NULL;

htext=GetClipbo ardData(CF_TEXT );

if (htext==0) return NULL;

size=GlobalSize (htext);

q=malloc(size);
if (q==NULL) return NULL;

p=GlobalLock(ht ext);
memcpy(q,p,size );
GlobalUnlock(ht ext);

CloseClipboard( );
return q;
}

int main(void) {
char *text;

text=pastetext( );

if (text!=NULL) {
printf("Clipboa rd text = <%s>\n",text) ;
free(text);
}

}

Notes: windows.h means this is not portable C. But if you're using Winxp
anyway... And I don't know if GlobalLock etc are still needed these days;
better check at MSDN or in gdi32 newsgroup.

--
Bartc

Oct 4 '08 #5
Bartc wrote:
"Over" <ov**@nospam.ov erwrote in message
>it's possible with language C, (Mingw or Djgpp)
copying the clipboard of WinXp into file.txt?

which function must be use.

Try something like this:

#include <stdio.h>
#include <windows.h>
<windows.hdoe s not exist in standard C systems. Thus this is
non-portable and off-topic here.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
Oct 4 '08 #6
On Sat, 04 Oct 2008 03:16:32 -0400, CBFalconer wrote:
Bartc wrote:
>"Over" <ov**@nospam.ov erwrote in message
>>it's possible with language C, (Mingw or Djgpp) copying the clipboard
of WinXp into file.txt?

which function must be use.

Try something like this:

#include <stdio.h>
#include <windows.h>

<windows.hdoe s not exist in standard C systems.
<windows.hdoe s exist in some standard C systems.

Yes, it's off-topic, but off-topic doesn't mean it only exists in other
people's dream worlds. It's real.
Oct 4 '08 #7
Over wrote:
Hi

it's possible with language C, (Mingw or Djgpp)
copying the clipboard of WinXp into file.txt?

which function must be use.

Thanks
The clipboard supports several formats. You can retrieve images, text,
or many other types of data. Let’s see how to retrieve the most simple
one: text.
// This function will retrieve the text from the clipboard
// if available. Returns the retrieved text or NULL if an
// error occurs.
// The user should free the text with the free() function when it is
// done with it.
char *ImportClipboar d(HWND hwnd)
{
HANDLE hClipData;
char *str = NULL;
char * result = NULL;
result = 0;
if (IsClipboardFor matAvailable(CF _TEXT)) {
if (OpenClipboard( hwnd)) {
hClipData = GetClipboardDat a(CF_TEXT);
if (hClipData) {
str = GlobalLock(hCli pData);
result = strdup(str);
GlobalUnlock(hC lipData);
}
}
CloseClipboard( );
}
return (result);
}

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 4 '08 #8
many thanks

Regards
Oct 4 '08 #9
Antoninus Twink wrote:
(Jacob Navia is the only one able and willing to answer Windows
questions, and he seems to be taking a break from the feverish idiocy of
clc at the moment.)
Yes, I am getting tired of this group. But I answered the OP, see
my reply in this thread.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 4 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4317
by: tabonni | last post by:
Hello All I am creating an ASP page. There are a list of filename and checkbox next to it. When user checked all the documents they want and click ADD TO CLIPBOARD button. All filepaths will be copied into clipboard and then they can right-click -> paste into MS Outlook as attachments. How can I use clipboardData.setData function to do...
4
32203
by: Risto Heinonen | last post by:
Hi. I have a web page that has images and text. I can carefully select one image and the on the right of the image and then copy & paste to Word. Is it possible to make javascript do the same: select the same area (divided by <div> tag) and copy to clipboard? So far I succeeded to make the script to copy the area inside <div> but it...
11
2200
by: Danny J. Lesandrini | last post by:
Has anyone else noticed this? I searched group archives and found nothing, but it's really starting to irritate me big time. Here's the steps to reproduce the problem: Copy something to the clipboard (eg code from a web page) Open Microsoft Access MDB file Open any module Press Ctl-V to insert text Voilia, the text is gone. Opening...
5
21006
by: DraguVaso | last post by:
Hi, I'm looking for a way to Copy and Paste Files to the clipboard. I found a lot of articles to copy pieces of text and bitmaps etc, but nog whole files. Whay I need is like you have in windows explorer: when you do a right-click on a file and choose Copy, and than paste it somewhere in my application and vice versa.
2
5577
by: Xavier Valdés | last post by:
Hi all, I would like to copy FILES from the clipboard to a desired folder from VB.NET. I was able to copy files (with filedrop data format) to the clipboard but I don't know how to catch this data (the entire data) and leave it (copy it) to a folder. It doen't matter if the data I want to copy is a folder, a file or a group of them. The...
7
11606
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an...
3
3713
by: SAL | last post by:
I have the following VB.net Class/Function that I call from an ASP.net page: Public Class MyTestClass Public Function embedHyperlink(ByVal fileID As Integer, ByVal fileName As String) As String 'Create a New Instance of the HyperLink Control Dim createHyperLink As New System.Web.UI.WebControls.HyperLink 'Create an Instance of the...
17
5086
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have about 20 textboxes on the form). Also to ensure that the button can't get used if the cursor isn't in a textbox field. And to ensure the contents of...
6
1254
by: Fred | last post by:
I retreive files from the clipboard as below. Dim DObj As IDataObject = Clipboard.GetDataObject If DObj.GetDataPresent(DataFormats.FileDrop) Then Dim files As String() = _ CType(DObj.GetData(DataFormats.FileDrop), String()) This work fine but now I need to know if the user selected cut or copy when putting the file(s) on the clipboard.
1
4184
by: Ludwig Wittgenstein | last post by:
Hi, all. Here's the scenario: I embedd a .txt file in Word as OLE object, then I copy it (manually), so now it's on the clipboard. How do I programatically (in C#) get that OLE object file from the clipboard and dump it into an actual text file on the file system? All I would like to know is how to grab the OLE from the clipboard and...
0
7468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.