Menu

Sending the content of a control to Notepad

2002-12-11
2012-09-26
  • Nobody/Anonymous

    Hey everybody :) Im trying to copy the full content of a listbox to the clipboard and then open a notepad window with this content when the user press a button...
    Can anyone help me at this?

    Im trying something like this, how does it look so far?

    case ID_COPYBUTTON:
       int i;
       char lbbuffer;  
       char tempbuffer;          
       int itens=SendMessage(hwndListBox01, LB_GETCOUNT, 0, 0);
       for (i=0; i<=itens; i++) {
       SendMessage(hwndListBox01, LB_GETTEXT, i, tempbuffer);
       strcat(lbbuffer, tempbuffer);
       }
       //something here to send lbbuffer to windows clipboard          
       //something here to open a notepad window displaying lbbuffer
       return 0;                                

     
    • Nobody/Anonymous

       
      • Nobody/Anonymous

        That probably means that what i wrote on the first post is categorized as a beautiful example of pure crap...

         
    • Anonymous

      Anonymous - 2002-12-13

      i don't think that's his intention ;)_

      i think it's just that it's quite a bit more complicated than CopyTextToClipboard(buffer)...

      for a quicker solution than waiting for mail-order, you might wanna try getting the win32api devpack for devcpp (which is just one big win32api reference help file), and use the help file's find tab to search for "clipboard" - it's beyond my current experience, but judging by your code snip, you appear to know your stuff; i'd suggest just looking through the reference info for OpenClipboard() and SetClipboardData() (as well as all the other functions and data types listed with those, and those listed when you click the Group button within either of those listings) as a place to start and go from there...

      forewarning though, it mentions some weird juju involving memory allocation and locked handles and other such black (at least to me) arts... but if that's familiar territory, the rest should be cake.

      good luck... and if you get some working code, would you mind posting it up here for posterity?  i wouldn't mind seeing it in action myself... ;)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.