Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
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.

38 lines
795 B

5 years ago
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: abstract system dependent functions
//
// $NoKeywords: $
//=============================================================================//
#include "sys.h"
#include <windows.h>
#include "tier1/strtools.h"
void Sys_CopyStringToClipboard( const char *pOut )
{
if ( !pOut || !OpenClipboard( NULL ) )
{
return;
}
// Remove the current Clipboard contents
if( !EmptyClipboard() )
{
return;
}
HGLOBAL clipbuffer;
char *buffer;
EmptyClipboard();
int len = Q_strlen(pOut)+1;
clipbuffer = GlobalAlloc(GMEM_DDESHARE, len );
buffer = (char*)GlobalLock( clipbuffer );
Q_strncpy( buffer, pOut, len );
GlobalUnlock( clipbuffer );
SetClipboardData( CF_TEXT,clipbuffer );
CloseClipboard();
}