blob: aa7510fbb5c68bcfa604b7a9b38b3c20dd2e7f6a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
//========= 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();
}
|