C++ Builder,复制到剪贴板

问题描述 投票:0回答:1

尝试复制到剪贴板,如我在 Delphi 示例中找到的那样,但出现错误

[bcc32c 错误] Unit1.cpp(40):使用未声明的标识符“Clipboard”

我连接了库Vcl.Clipbrd

#include <vcl.h>
#pragma hdrstop
#pragma Vcl.Clipbrd
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

.....................

void __fastcall TForm1::Button3Click(TObject *Sender)
{
Clipboard()->AsText=DBLookupListBox12->DataField;
}
c++builder
1个回答
0
投票

您需要

#include <Clipbrd.hpp>
,根据 文档示例

#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <Clipbrd.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

.....................

void __fastcall TForm1::Button3Click(TObject *Sender)
{
  Clipboard()->AsText=DBLookupListBox12->DataField;
}
© www.soinside.com 2019 - 2024. All rights reserved.