What #include for WindowsPlatformMisc::ClipboardCopy();

Edit: Problem Solved:

I was not including the F in FWindowsPlatformMisc::, oops :slight_smile:

Here’s a code sample for anyone who wants to use it:

//Copy
FString TextToCopy = "Victory!!!!!!";
FWindowsPlatformMisc::ClipboardCopy(*TextToCopy);
ClientMessage("Joyful Text Copied to ClipBoard!");
		
//Paste
FString TextToPaste;
FWindowsPlatformMisc::ClipboardPaste(TextToPaste);
ClientMessage(TextToPaste);

Dear Friends at Epic,

What #include do I need to use so I can utilize the WindowsPlatformMisc::ClipboardCopy(); Function?

or is there a global var like GEngine, something like GPlatform to enable use of these functions?

Thanks!

:slight_smile:

Rama

for your reference I mean these functions:

// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.

/*=============================================================================================
	WindowsPlatformMisc.h: Windows platform misc functions
==============================================================================================*/

#pragma once

/**
* Windows implementation of the misc OS functions
**/
struct CORE_API FWindowsPlatformMisc : public FGenericPlatformMisc
{
	static void PlatformPreInit();
	static void PlatformInit();
	static void PlatformPostInit();
	static class GenericApplication* CreateApplication();
	static void SetConsoleInterruptHandler();
	static void GetEnvironmentVariable(const TCHAR* VariableName, TCHAR* Result, int32 ResultLength);
	static TArray GetMacAddress();
	static void SubmitErrorReport( const TCHAR* InErrorHist, EErrorReportMode::Type InMode );

#if !UE_BUILD_SHIPPING
	FORCEINLINE static bool IsDebuggerPresent()
	{
		return !!::IsDebuggerPresent(); 
	}
	FORCEINLINE static void DebugBreak()
	{
		if (IsDebuggerPresent())
		{
			::DebugBreak();
		}
	}
#endif

	static void PumpMessages(bool bFromMainLoop);
	static uint32 GetKeyMap( uint16* KeyCodes, FString* KeyNames, uint32 MaxMappings );
	static void LocalPrint(const TCHAR *Message);
	static void RequestExit(bool Force);
	static const TCHAR* GetSystemErrorMessage(TCHAR* OutBuffer, int32 BufferCount, int32 Error);
	static void ClipboardCopy(const TCHAR* Str);
	static void ClipboardPaste(class FString& Dest);
1 Like

I was not including the F in FWindowsPlatformMisc::, oops :slight_smile:

Here’s a code sample for anyone who wants to use it:

//Copy
FString TextToCopy = "Victory!!!!!!";
FWindowsPlatformMisc::ClipboardCopy(*TextToCopy);
ClientMessage("Joyful Text Copied to ClipBoard!");
		
//Paste
FString TextToPaste;
FWindowsPlatformMisc::ClipboardPaste(TextToPaste);
ClientMessage(TextToPaste);

Hey Nathan,

It should be the standard include of your project in the .cpp file. So if your project is ‘MyProject1’ You would include ‘MyProject1.h’ at the top of the .cpp file

If you get an error of some sort let us know.

Best Regards,
Ryan

Thanks for answering Ryan!

The standard includes are not enough with current rocket build it seems, feel free to try this on your end:

FString TextToCopy = "Victory!!!!!!";
WindowsPlatformMisc::ClipboardCopy(*TextToCopy);

I get the compile error that

1>E:\RocketVictory\VictoryGame\Source\VictoryGame\Private\VictoryGamePlayerController.cpp(2030): error C2653: 'WindowsPlatformMisc' : is not a class or namespace name

1>E:\RocketVictory\VictoryGame\Source\VictoryGame\Private\VictoryGamePlayerController.cpp(2030): error C3861: 'ClipboardCopy': identifier not found

So if any of you Awesome Epic folks can tell me the #include I should use please do!

I would really like clipboard copy and paste feature in my game :slight_smile:

:heart: :heart: :heart:

:slight_smile: :slight_smile:

Rama