Re: copy and paste in program

2011-09-12 Thread Joel Christensen
I mean, I can't copy text from my program to the clipboard. - Joelcnz On 12-Sep-11 3:50 PM, Joel Christensen wrote: Thanks Jimmy. Your example worked. Or though I haven't managed to get the other way to work. [code] import std.stdio; //import core.stdc.string; import std.c.string; import

Re: copy and paste in program

2011-09-12 Thread Jimmy Cao
The other way is a bit more complicated. Try this: import std.stdio; import core.stdc.string; import std.string; extern(Windows) { bool OpenClipboard(void*); void* GetClipboardData(uint); void* SetClipboardData(uint, void*); bool EmptyClipboard(); bool CloseClipboard(); void*

Re: copy and paste in program

2011-09-12 Thread Joel Christensen
Thanks so much Jimmy. You put in a bit of effort. :-) I just added this code to my general library: extern(Windows) { bool OpenClipboard(void*); void* GetClipboardData(uint); void* SetClipboardData(uint, void*); bool EmptyClipboard(); bool CloseClipboard(); void*

copy and paste in program

2011-09-11 Thread Joel Christensen
Hi, I've got a text program I'm working on. It has game like print. But I want to be able to copy to the clip board and paste from it in my program etc. I'm using Windows 7. I have used a bit of Ubuntu in the past. - Joelcnz

Re: copy and paste in program

2011-09-11 Thread Joel Christensen
Thanks for the reply Jimmy. I was thinking more like SDL (has SDL_GetClipboardText, SDL_SetClipboardText, http://wiki.libsdl.org/moin.cgi/CategoryClipboard). I'm not sure I would be able to get Windows CE Clipboard stuff working for me. - Joelcnz On 12-Sep-11 1:23 PM, Jimmy Cao wrote:

Re: copy and paste in program

2011-09-11 Thread Joel Christensen
So how would I got about doing it in D? On 12-Sep-11 1:52 PM, Vladimir Panteleev wrote: On Mon, 12 Sep 2011 04:39:52 +0300, Joel Christensen joel...@gmail.com wrote: I'm not sure I would be able to get Windows CE Clipboard stuff working for me. Search engines often return Windows CE results

Re: copy and paste in program

2011-09-11 Thread Jimmy Cao
Here's an example I've quickly put together for you: import std.stdio; import core.stdc.string; extern(Windows) { void* GetClipboardData(uint); bool OpenClipboard(void*); } void main() { if (OpenClipboard(null)) { auto cstr = cast(char*)GetClipboardData(1); if (cstr)

Re: copy and paste in program

2011-09-11 Thread Joel Christensen
Thanks Jimmy. Your example worked. Or though I haven't managed to get the other way to work. [code] import std.stdio; //import core.stdc.string; import std.c.string; import std.string; import std.conv; extern(Windows) { bool OpenClipboard(void*); void* GetClipboardData(uint); void*