Clipboard Question

This is a discussion on Clipboard Question within the C++ Programming forums, part of the General Programming Boards category; Is it possible to take data input for a program from the clipboard when someone copies it there?? If it ...

  1. #1
    Spanky devour89's Avatar
    Join Date
    Nov 2002
    Posts
    148

    Question Clipboard Question

    Is it possible to take data input for a program from the clipboard when someone copies it there??

    If it is can anyone explain to me how it would be done.

    I'm making a online game formatter which is supposed to take game data of the internet (Crl+A then Crl+C) and then the program takes it from there...
    Dev C++
    Win XP/2k/98

    I DO NOT TAKE CLASSES I DONT GET HOMEWORK THIS IS NOT A HOMEWORK QUESTION!!!

    He's lean he's keen... He's the spank machine!

  2. #2
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    anything copied to the clipboard can be pasted.

  3. #3
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Use the Windows API (User32.dll)

    OpenClipboard
    EmptyClipboard
    SetClipboardData
    GetClipboardData
    CloseClipboard

    I think it's something like this:
    Code:
    string data;
    
    if(OpenClipboard())
    {
       if((HWND GlobalHWnd = GetClipboardData(CF_RTF)) != 0)
       { 
          char* text = (char *)GlobalLock(GlobalHWnd);
          data = text;
          GlobalUnlock(GlobalHWnd);
       }
       CloseClipboard();
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. copying to clipboard
    By bballzone in forum Windows Programming
    Replies: 24
    Last Post: 09-30-2004, 04:24 PM
  2. Clipboard and Custom Types
    By McClamm in forum C# Programming
    Replies: 1
    Last Post: 09-16-2004, 05:43 PM
  3. Clipboard Modifier
    By Korhedron in forum Windows Programming
    Replies: 2
    Last Post: 01-03-2004, 02:32 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM

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