Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2006.04.09;
Скачать: [xml.tar.bz2];

Вниз

Как узнать момент копирования текста в буфер обмена ?   Найти похожие ветки 

 
HWND   (2006-01-17 22:02) [0]

Как узнать момент копирования текста в буфер обмена ?(хендел окна известен)

И ещё как получить выделенный текст в другом окне?


 
Rouse_ ©   (2006-01-17 22:09) [1]

SetClipboardViewer


 
HWND   (2006-01-18 02:21) [2]

Спасибо, это я сделал:


private
 NH:HWND;
 procedure WMCOPY(var Message: TMessage);message  WM_DRAWCLIPBOARD;

uses clipbrd;

procedure TForm1.WMCOPY(var Message: TMessage);
begin
 beep;
 if Clipboard.HasFormat(CF_TEXT) then Caption:= Clipboard.AsText
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 NH:=  SetClipboardViewer(Form1.Handle);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 ChangeClipboardChain(Form1.Handle,NH);
end;


А как получить выделенный текст из другого окна?


 
Fay ©   (2006-01-18 06:53) [3]

2 HWND   (18.01.06 2:21) [2]
А где обработка WM_CHANGECBCHAIN?


 
Rouse_ ©   (2006-01-18 15:01) [4]


> Спасибо, это я сделал:

Если уж делать, то хотябы вот так:

unit Unit1;

interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
 Dialogs;

type
 TForm1 = class(TForm)
   procedure FormCreate(Sender: TObject);
   procedure FormDestroy(Sender: TObject);
 private
   hwndNextViewer: THandle;
   procedure WMChangeCbChain(var Message: TWMChangeCBChain); message WM_CHANGECBCHAIN;
   procedure WMDrawClipboard(var Message: TMessage); message WM_DRAWCLIPBOARD;
 end;

var
 Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
 // Add the window to the clipboard viewer chain.
 hwndNextViewer := SetClipboardViewer(Handle);
end;

procedure TForm1.WMChangeCbChain(var Message: TWMChangeCBChain);
begin
 with Message do
 begin

   // If the next window is closing, repair the chain.
   if Remove = hwndNextViewer then
     hwndNextViewer := Next

   // Otherwise, pass the message to the next link.
   else
     if hwndNextViewer <> 0 then
       SendMessage(hwndNextViewer, Msg, Remove, Next);
 end;
end;

// clipboard contents changed.
procedure TForm1.WMDrawClipboard(var Message: TMessage);
begin
 // Pass the message to the next window in clipboard
 // viewer chain.
 with Message do
   SendMessage(hwndNextViewer, Msg, WParam, LParam);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 ChangeClipboardChain(Handle, hwndNextViewer);
end;

end.

> А как получить выделенный текст из другого окна?


Выделить буффер и послать ему WM_GETTEXT



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2006.04.09;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.015 c
2-1143463840
sofi
2006-03-27 16:50
2006.04.09
Разрешение экрана


2-1143110357
alles
2006-03-23 13:39
2006.04.09
Как удалить ссылку на Unit из проекта?


15-1142426932
ilya39
2006-03-15 15:48
2006.04.09
SharpDevelop


3-1139599601
Варяг
2006-02-10 22:26
2006.04.09
Проблем подключения VFoxPro через ADO


2-1143386444
AlexanderMS
2006-03-26 19:20
2006.04.09
Сочетание клавиш





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский