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

如何攔截游標閃爍訊息?

尚未結案
m0210
一般會員


發表:31
回覆:29
積分:17
註冊:2002-08-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-02-02 07:39:35 IP:211.22.xxx.xxx 未訂閱
在類似TEdit或TMemo的控件上,當其取得焦點時,會有個棒棒一閃一閃的,以提示使用者輸入文字,請問有人知道該閃爍訊息是如何產生的嗎?且要如何攔截它呢? 感覺上該訊息類似一個Timer一樣,因此小弟因為有特別需求,想要利用該訊息來取代專案理的一個Timer..請各位大大指點迷津...
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-02-22 20:47:12 IP:61.225.xxx.xxx 未訂閱
The 2 functions you'll need are: GetCursorPos SetSystemCursor (be very careful when working with this one). Both functions are documented in the Win32 SDK help file, available with Delphi sample: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Timer1: TTimer; Label1: TLabel; Label2: TLabel; Label3: TLabel; lbXPos: TLabel; lbYPos: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; lbXPosWin: TLabel; lbYPosWin: TLabel; Bevel1: TBevel; procedure Timer1Timer(Sender: TObject); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private NewArrow, NewHourGlass : HCursor; OldArrow, OldHourGlass : HCursor; { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Timer1Timer(Sender: TObject); var CPos : TPoint; begin // This will retrieve the current position of the cursor, // relative to the desktop. // since there are no messages that will provide this // information when the cursor is outside the current // window, we have to put it inside a TTimer or call // GetCursorPos whenever the information is wanted. GetCursorPos(CPos); lbXPos.caption := inttostr(CPos.x); lbYPos.caption := inttostr(CPos.y); end; procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin lbXPosWin.Caption := inttostr(x); lbYPosWin.Caption := inttostr(y); end; procedure TForm1.FormCreate(Sender: TObject); begin // Load the new cursor from file. // This could also be done if the cursors were stored // in a resource in the executable or another DLL, // but then we'd have to use LoadCursor instead. NewArrow := LoadCursorFromFile('3dsarro.cur'); NewHourGlass := LoadCursorFromFile('3dswait.cur'); // BAckup the existing cursors, since they'll be destroyed // once we call SetSystemCursor. Not doing this can cause // an unrecoverable system crash. OldArrow := LoadCursor(0, IDC_ARROW); OldHourGlass := LoadCursor(0, IDC_WAIT); // Replace the system cursors with the ones we loaded from // file. The new cursors will be valid as long as the // application is running. SetSystemCursor(NewArrow, OCR_NORMAL); SetSystemCursor(NewHourGlass, OCR_WAIT); end; procedure TForm1.FormDestroy(Sender: TObject); begin // Right before the application is destroyed, we have to // restore the backed-up cursors. The cursors we loaded // from file will be destroyed with the rest of the // application, so we need to set the cursors back to // whatever they were before. SetSystemCursor(OldArrow, OCR_NORMAL); SetSystemCursor(OldHourGlass, OCR_WAIT); end; end. 發表人 - flyup 於 2003/02/22 22:37:06
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-02-22 21:10:58 IP:192.168.xxx.xxx 未訂閱
flyup真厲害! 是您寫出來的還是找出來的? ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-02-22 21:15:16 IP:61.225.xxx.xxx 未訂閱
高人指點! 嘿嘿! 顧問團: 首腦:cmf sir  指揮官:jackkcg sir .. 等百員大將...     發表人 - flyup 於 2003/02/22 21:43:25
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-02-22 22:34:23 IP:192.168.xxx.xxx 未訂閱
引言: 高人指點! 嘿嘿! 顧問團: 首腦:cmf sir 指揮官:jackkcg sir .. 等百員大將... 發表人 - flyup 於 2003/02/22 21:43:25
原來的程式怎不見? ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-02-22 22:37:58 IP:61.216.xxx.xxx 未訂閱
可能是你的電腦問題喔!    
系統時間:2024-04-28 12:33:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!