mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
ACE clipboard extension to bypass clipboard limit of arma. Close #991
This commit is contained in:
parent
7678919e8d
commit
433bb21ccc
BIN
ace_clipboard.dll
Normal file
BIN
ace_clipboard.dll
Normal file
Binary file not shown.
@ -56,6 +56,7 @@ set(GLOBAL_SOURCES ${GLOBAL_RC})
|
||||
# Add extensions to build here
|
||||
add_subdirectory(fcs)
|
||||
add_subdirectory(break_line)
|
||||
add_subdirectory(clipboard)
|
||||
add_subdirectory(advanced_ballistics)
|
||||
|
||||
message("Build Type: ${CMAKE_BUILD_TYPE}")
|
12
extensions/clipboard/CMakeLists.txt
Normal file
12
extensions/clipboard/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
set(ACE_EXTENSION_NAME "ace_clipboard")
|
||||
|
||||
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES})
|
||||
target_link_libraries(${ACE_EXTENSION_NAME} ace_common)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||
endif()
|
57
extensions/clipboard/ace_clipboard.cpp
Normal file
57
extensions/clipboard/ace_clipboard.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* ace_clipboard.cpp
|
||||
*
|
||||
* Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit.
|
||||
*
|
||||
* Takes:
|
||||
* Localized string as string
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*/
|
||||
#include "ace_common.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
|
||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
std::string input(function);
|
||||
std::string result;
|
||||
|
||||
if (input.length() < 1)
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
HGLOBAL glob = GlobalAlloc(GMEM_FIXED, input.length()+1);
|
||||
|
||||
memcpy(glob, input.c_str(), input.length());
|
||||
((char *)glob)[input.length() + 1] = 0x00;
|
||||
|
||||
if (!OpenClipboard(NULL)) {
|
||||
result = "OpenClipboard() failed, GetLastError=" + GetLastError();
|
||||
} else {
|
||||
if (!EmptyClipboard()) {
|
||||
result = "OpenClipboard() failed, GetLastError=" + GetLastError();
|
||||
} else {
|
||||
if (!SetClipboardData(CF_TEXT, glob)) {
|
||||
result = "SetClipboardData() failed, GetLastError=" + GetLastError();
|
||||
} else {
|
||||
if (!CloseClipboard()) {
|
||||
result = "CloseClipboard() failed, GetLastError=" + GetLastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
memcpy(output, result.c_str(), result.length()+1);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user