473,883 Members | 2,143 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 6319
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
4357
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 that? I saw a lot of examples they are just copy and paste text.
4
32301
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 was plain html-text.
11
2231
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 access dumps the copy buffer.
5
21050
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
5598
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 fact is I would like to copy the WHOLE data with a function.
7
11655
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 OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
3
3727
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 ClipBoard Object
17
5151
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 the clipboard are "text" contents that have been cut/copied from one of the textboxes on the form. ...
6
1271
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
4217
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 transform it into a file, stream, string, or anything that gives me the internal contents of that txt...
0
9945
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9798
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7978
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7136
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5807
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4622
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
2
4230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.