Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
808 B

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: abstract system dependent functions
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "sys.h"
  8. #include <windows.h>
  9. #include "tier1/strtools.h"
  10. void Sys_CopyStringToClipboard( const char *pOut )
  11. {
  12. if ( !pOut || !OpenClipboard( NULL ) )
  13. {
  14. return;
  15. }
  16. // Remove the current Clipboard contents
  17. if( !EmptyClipboard() )
  18. {
  19. return;
  20. }
  21. HGLOBAL clipbuffer;
  22. char *buffer;
  23. EmptyClipboard();
  24. int len = Q_strlen(pOut)+1;
  25. clipbuffer = GlobalAlloc(GMEM_DDESHARE, len );
  26. buffer = (char*)GlobalLock( clipbuffer );
  27. Q_strncpy( buffer, pOut, len );
  28. GlobalUnlock( clipbuffer );
  29. SetClipboardData( CF_TEXT,clipbuffer );
  30. CloseClipboard();
  31. }