Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- void GetClipboardText ( char * buff )
- {
- if ( OpenClipboard ( NULL ) )
- {
- HANDLE hData = GetClipboardData ( CF_TEXT );
- char * chBuffer = ( char * ) GlobalLock ( hData );
- strcpy ( buff, chBuffer );
- GlobalUnlock ( hData );
- CloseClipboard ( );
- }
- }
- int main ( int argc, char *argv [ ] )
- {
- char buff[ 1024 ];
- GetClipboardText ( buff );
- printf ( "text in clipboard: %s\n\n", buff );
- while ( 1 )
- {
- char temp[ 1024 ];
- GetClipboardText ( temp );
- if ( strcmp ( buff, temp ) != 0 )
- {
- printf ( "new text in clipboard: %s\n\n", temp );
- wsprintf ( buff, "%s", temp );
- }
- Sleep ( 500 );
- }
- getchar ( );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement