Second parameter of SetClipboardData()

This is a discussion on Second parameter of SetClipboardData() within the Windows Programming forums, part of the Platform Specific Boards category; Can anyone explain to me what the second parameter is? MSDN didn't explain it too well.. err, it went over ...

  1. #1
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802

    Second parameter of SetClipboardData()

    Can anyone explain to me what the second parameter is? MSDN didn't explain it too well.. err, it went over my head.

    Say I want to take text from one of my text boxes and click a button "Copy to Clipboard"

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    25
    why that's a handle....

    just kidding...

    it works something like this... if this does not work email me tomorrow at fzamora@vvm.com

    I will send you a sample that works...

    if( OpenClipboard( myhwnd ) ){


    HGLOBAL hgb = GlobalAlloc(
    GMEM_MOVEABLE, // allocation attributes
    100 // number of bytes to allocate
    );


    char* pdata;

    pdata = (char*) GlobalLock(hgb);

    strcpy(pdata, "my text");

    SetClipboardData( CF_TEXT, hgb);

    GlobalUnlock(hgb);

    }
    inZane
    --true programmer's don't comment--
    --programmer wannabes complain about it--

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    223
    Code:
    	if( OpenClipboard() )
    	{
    
    		HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, sFxName.GetLength() + 1);
    
    
    		if( hGlobal )
    		{
    			char *psz = (char *)GlobalLock( hGlobal );
    
    			strcpy(psz, sFxName.GetBuffer( sFxName.GetLength() ) );
    
    			sFxName.ReleaseBuffer();
    
    			
    			SetClipboardData(CF_TEXT, hGlobal);
    
    		}
    
    		CloseClipboard();
    	}
    zMan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. my error is storage class specified for parameter
    By meli in forum C Programming
    Replies: 5
    Last Post: 03-27-2009, 01:06 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. cannot start a parameter declaration
    By Dark Nemesis in forum C++ Programming
    Replies: 6
    Last Post: 09-23-2005, 03:09 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21