kompajlira ga ali ne registruje nista..evo kod pa ako mozes da skontas u cemu je stvar?
Code:
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Clipbrd,ShellApi, StdCtrls;
type
TAllocWndTest = class(TObject)
private
FWndHandle : HWND;
procedure WndProc(var Msg: TMessage);
public
constructor Create;
destructor Destroy; override;
property WindowHandle: HWND read FWndHandle;
end;
var
fNextViewer,hWndNext, Handler: HWND;
FOnChange : TNotifyEvent;
FAllocWin : TAllocWndTest;
constructor TAllocWndTest.Create;
begin
FWndHandle := AllocateHWnd(WndProc);
end;
destructor TAllocWndTest.Destroy;
begin
DeAllocateHWnd(FWndHandle);
inherited Destroy;
end;
procedure TAllocWndTest.WndProc(var Msg: TMessage);
begin
Msg.Result := DefWindowProc(FWndHandle, Msg.Msg, Msg.wParam, Msg.lParam);
end;
function GetAsHandle(Format: Word): THandle;
begin
Clipboard.Open;
try
Result := GetClipboardData(Format);
finally
ClipBoard.Close;
end;
end;
procedure WMChangeCBChain(var Msg: TMessage);
begin
if HWND(Msg.WParam) = fNextViewer then
fNextViewer := HWND(Msg.LParam)
else if fNextViewer <> 0 then
SendMessage(fNextViewer, WM_CHANGECBCHAIN,
Msg.WParam, Msg.LParam);
end;
procedure WMDrawClipboard(var Msg: TMessage);
var
f: THandle;
buffer: Array [0..MAX_PATH] of Char;
i, numFiles: Integer;
begin
begin
if ClipBoard.HasFormat(CF_TEXT) then
begin
ShowMessage(Clipboard.AsText);
end;
if fNextViewer <> 0 then
SendMessage(fNextViewer, WM_DRAWCLIPBOARD,
Msg.WParam, Msg.LParam);
end;
end;
procedure RunClip; stdcall;
begin
FAllocWin := TAllocWndTest.Create;
fNextViewer := SetClipboardViewer(FAllocWin.WindowHandle);
end;
procedure StopClip; stdcall;
begin
ChangeClipboardChain(FAllocWin.WindowHandle, fNextViewer);
FreeAndNil(FAllocWin);
end;
exports
RunClip, StopClip;
end.