关于SetClipboardData的使用的问题,哪位大哥用过请指教,给出源码最好。比如我要改变CF_TEXT中的值.

解决方案 »

  1.   

    How to place text on the clipboard CString source; 
    //put your text in source
    if(OpenClipboard())
    {
    HGLOBAL clipbuffer;
    char * buffer;
    EmptyClipboard();
    clipbuffer = GlobalAlloc(GMEM_DDESHARE, source.GetLength()+1);
    buffer = (char*)GlobalLock(clipbuffer);
    strcpy(buffer, LPCSTR(source));
    GlobalUnlock(clipbuffer);
    SetClipboardData(CF_TEXT,clipbuffer);
    CloseClipboard();
    }  
    How to get text off of the clipboard
    This is easy really but here it is for completeness  char * buffer;
    if(OpenClipboard())
    {

    buffer = (char*)GetClipboardData(CF_TEXT);
    //do something with buffer here 
    //before it goes out of scope

    } CloseClipboard(); refer to http://www.codeguru.com/clipboard/text_tofrom_clipboard.shtml
      

  2.   

    refer to <<Programming Windows>>
      

  3.   

    ohe,看来昨天写的是对的,我再查查其他地方的代码,谢谢2位。