Link to home
Start Free TrialLog in
Avatar of Plasmax
Plasmax

asked on

clipboard.dcu not found

I have search for this and i am unable to get my code right.

it needs to copy the clipboard contents for

1. text and show in memo
2. picture and show in image

but clipboard is never allowed, even if I add it to the dam uses.


{
Place Timage and Tmemo  on the form.
Retrieve what is in the clipboard. If it is image, it will be placed in Image1, and if text - in Memo1.
}
 
uses Clipboard;
...
 
procedure TForm1.Button1Click(Sender: TObject);
var
  MyHandle: THandle;
begin
  Clipboard.Open;
  if Clipboard.HasFormat(CF_TEXT) then
  begin
    MyHandle:=Clipboard.GetAsHandle(CF_TEXT);
    Memo1.Lines.Add(StrPas(GlobalLock(MyHandle)));
    GlobalUnlock(MyHandle);
  end;
  if (Clipboard.HasFormat(CF_BITMAP)) or
    (Clipboard.HasFormat(CF_PICTURE)) then
    Image1.Picture.Assign(Clipboard);
  Clipboard.Close;
end;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Plasmax
Plasmax

ASKER

oh right, thanks for that, clipbrd instead of clipboard  damn..

a unit name and type name must be different in delphi