Autor Beitrag
Cyberbob
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Di 02.07.02 20:59 
HI ihr,

ich möchte in mein Programm einen Befehl einfügen um den gesamten Text im Memofeld in die Zwischenablage zu kopieren, doch wie lautet der? Danke

Nic :roll: las
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Di 02.07.02 21:09 
Hallo,

die Online-Hilfe währe mal wieder schneller gewesen. Versuche mal:
ausblenden Quelltext
1:
2:
  Memo1.SelectAll;
  Memo1.CopyToClipboard;


Gruß
Klabautermann
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Di 02.07.02 22:14 
Klabautermann hat folgendes geschrieben:

Das ist wieder einmal eine typische Erleichterung von Delphi.
So sieht das etwa mit API-Funktionen aus.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure CopyToClipboard(s : String);
var
  hMem      : cardinal;
  sCopyData : string;
  pMem      : PChar;
begin
  if not OpenClipboard(0) then exit;
  try
    if not EmptyClipboard then exit;
    sCopyData := s;    // s = Memo1.Text;
    hMem := GlobalAlloc(GMEM_MOVEABLE,Length(sCopyData) + 1);
    if hMem = 0 then exit;
    pMem := GlobalLock(hMem);
    try
      CopyMemory(pMem,PChar(sCopyData),Length(sCopyData) + 1);
    finally
      GlobalUnlock(hMem);
    end;
    SetClipboardData(CF_TEXT,hMem);
  finally
    CloseClipboard;
  end;
end;
:lol:
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Di 02.07.02 22:19 
Genau deshalb verwende ich Delphi.
Wen nich API-Programmieren wollte täte ich das in C(++).

Gruß
Klabautermann