Add GetClipboardString()
This commit is contained in:
parent
402358e5a0
commit
e08a078588
|
@ -382,6 +382,22 @@ bool SetClipboardString(const char *string) {
|
|||
return ok;
|
||||
}
|
||||
|
||||
std::string GetClipboardString() {
|
||||
std::string rv;
|
||||
if (OpenClipboard(NULL)) {
|
||||
HANDLE hData = GetClipboardData(CF_TEXT);
|
||||
if (hData != NULL) {
|
||||
char *pszText = static_cast<char*>(GlobalLock(hData));
|
||||
if (pszText != NULL)
|
||||
rv = pszText;
|
||||
GlobalUnlock(hData);
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
RECT GetParentRect(HWND wnd) {
|
||||
RECT btrect;
|
||||
GetClientRect(wnd, &btrect);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Copyright (C) 2018 Ludvig Strigeus <info@tunsafe.com>. All Rights Reserved.
|
||||
#include "tunsafe_types.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#pragma once
|
||||
const char *FindFilenameComponent(const char *s);
|
||||
|
@ -54,6 +55,7 @@ bool EnsureValidConfigPath(const char *path);
|
|||
bool RunProcessAsAdminWithArgs(const char *args, bool wait_for_exit);
|
||||
bool RestartProcessAsAdministrator();
|
||||
bool SetClipboardString(const char *string);
|
||||
std::string GetClipboardString();
|
||||
RECT GetParentRect(HWND wnd);
|
||||
RECT MakeRect(int l, int t, int r, int b);
|
||||
struct GuidAndDevName {
|
||||
|
@ -61,3 +63,4 @@ struct GuidAndDevName {
|
|||
char name[64];
|
||||
};
|
||||
void GetTapAdapterInfo(std::vector<GuidAndDevName> *result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue