我想监视剪帖板。但不知道为什么,有问题,总是说句柄无效。
下面是我的代码。就是调用SetClipboardViewer,我看别人也是这么写。
但我的代码就是不行,不知道问题出在哪
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,Clipbrd;
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
  public
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var
  NextViewHandle :THandle;
begin
  NextViewHandle := SetClipboardViewer(Handle);
  ShowMessage(SysErrorMessage(GetLastError));
end;
end.

解决方案 »

  1.   

    代碼不對, 參考下msdn怎麼用SetClipboardViewer的再說吧
      

  2.   

    就是这样的啊。
    没错的。只要一个参数就是HandleSyntaxHWND SetClipboardViewer(HWND hWndNewViewer);Parameters
      
    hWndNewViewer[in] Handle to the window to be added to the clipboard chain. Return ValueIf the function succeeds, the return value identifies the next window in the clipboard viewer chain. If an error occurs or there are no other windows in the clipboard viewer chain, the return value is NULL. To get extended error information, call GetLastError.