全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1659
推到 Plurk!
推到 Facebook!

像flashget的那種圖片要怎麼做?

 
jck1
一般會員


發表:53
回覆:67
積分:24
註冊:2002-05-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-07-05 11:52:50 IP:211.22.xxx.xxx 未訂閱
flashget的圖片會一直呆在桌面 如有程式蓋過他時 也會跑出來 這個是怎麼用的呢 謝謝!!
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-07-05 13:20:18 IP:211.22.xxx.xxx 未訂閱
參考:
unit DropBin;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ExtCtrls, ActiveX, ComObj;    type
  TfrmDropBin = class(TForm, IDropTarget)
  private
    procedure WMNCHitTest(var Msg:TWMNCHitTest); message WM_NCHITTEST;
  protected
    procedure CreateParams(var Params: TCreateParams); override;
    procedure CreateWnd; override;
    procedure DestroyWnd; override;
    procedure DoClose(var Action: TCloseAction); override;
    // DragDrop 支持
    function DragEnter(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;
    function IDropTarget_DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;
    function IDropTarget.DragOver = IDropTarget_DragOver;  // 解決 IDropTarget.DragOver 與 TForm.DragOver 衝突問題
    function DragLeave: HResult; stdcall;
    function Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;
  public
    constructor Create(AOwner: TComponent); override;
  end;    var
  frmDropBin: TfrmDropBin;    procedure ShowDropBin(Sender: TMenuItem);    implementation    {$R *.dfm}    type
  // 雖然 Delphi 的 Windows 單元定義了 SetLayeredWindowAttributes(); ( external 'User32.dll' )
  // 為了兼容 Win9X, 不能直接調用
  TSetLayeredWindowAttributes = function (Hwnd: THandle; crKey: COLORREF; bAlpha: Byte; dwFlags: DWORD): Boolean; stdcall;    var
  User32ModH: HMODULE;
  SetLayeredWindowAttributes: TSetLayeredWindowAttributes = nil;    procedure ShowDropBin(Sender: TMenuItem);
begin
  if Assigned(frmDropBin) then frmDropBin.Close
  else begin
    frmDropBin := TfrmDropBin.CreateParented(GetDesktopWindow);
  end;
end;    constructor TfrmDropBin.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Width := 32;
  Height := 32;
end;    procedure TfrmDropBin.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do begin
    Style := WS_POPUP or WS_CLIPSIBLINGS {or WS_BORDER}; 
    ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST;
  end;
end;    procedure TfrmDropBin.CreateWnd;
begin
  inherited CreateWnd;
  Visible := True;
  // 為 2000/XP 創建半透明, 穿透效果
  if Assigned(SetLayeredWindowAttributes) then begin
    SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
    SetLayeredWindowAttributes(Handle, clWhite, 128, LWA_ALPHA or LWA_COLORKEY);
  end;
  // 設置為接受拖曳
  OleCheck(RegisterDragDrop(Handle, Self));
end;    procedure TfrmDropBin.DestroyWnd;
begin
  if HandleAllocated then RevokeDragDrop(Handle);
  inherited DestroyWnd;
end;    function TfrmDropBin.DragEnter(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;
begin
  // 也可以在此判斷是否接受拖曳, 修改 dwEffect 可以得到不同效果
  dwEffect := DROPEFFECT_COPY;
  Result := S_OK;
end;    function TfrmDropBin.IDropTarget_DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;
begin
  dwEffect := DROPEFFECT_COPY;
  Result := S_OK;
end;    function TfrmDropBin.DragLeave: HResult; stdcall;
begin
  Result := S_OK;
end;    function TfrmDropBin.Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; stdcall;
begin
  // 處理 dataObj 中包含的拖曳內容
  dwEffect := DROPEFFECT_NONE;
  Result := S_OK;
end;    procedure TfrmDropBin.DoClose(var Action: TCloseAction);
begin
  Action := caFree;
  frmDropBin := nil;
end;    procedure TfrmDropBin.WMNCHitTest(var Msg:TWMNCHitTest);
begin
  // 通過 Client 區拖動窗口
  DefaultHandler(Msg);
  if Msg.Result = HTCLIENT then
  Msg.Result:= HTCAPTION;
end;    initialization
  OleInitialize(nil);
  // 為了兼容 Win9x
  User32ModH := GetModuleHandle('User32.dll');
  if User32ModH <> 0 then @SetLayeredWindowAttributes := GetProcAddress(User32ModH, 'SetLayeredWindowAttributes');    finalization
  OleUninitialize;
  
end.
作者首頁: http://oopsware.delphibbs.com/ 發表人 - hagar 於 2002/07/05 13:26:02
系統時間:2024-11-22 17:15:26
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!