copy and paste in program

Joel Christensen joelcnz at gmail.com
Sun Sep 11 20:50:23 PDT 2011


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* SetClipboardData(uint, void*);
}

void main() {
     if (OpenClipboard(null)) {
         auto cstr = cast(char*)GetClipboardData( 1 );
         if (cstr)
             writeln(to!string(cast(char*)cstr[0..strlen(cstr)]));

		SetClipboardData( 1, cast(char*)toStringz( "data set" ) );
     }
}
[/code]


More information about the Digitalmars-d-learn mailing list