From: "Steve Davidson" <sdpixel@wolfenet.com>
All descendants of TComponent send a CM_MOUSEENTER and CM_MOUSELEAVE message when the mouse enters and leaves the bounds of the component. You will need to write a message handler for the respective messages if you wish to respond to them.
procedure CMMouseEnter(var msg:TMessage); message CM_MOUSEENTER; procedure CMMouseLeave(var msg: TMessage); message CM_MOUSELEAVE; .. .. .. procedure MyComponent.CMMouseEnter(var msg:TMessage); begin inherited; {respond to mouse enter} end; procedure MyComponent.CMMouseLeave(var msg: TMessage); begin inherited; {respond to mouse leave} end;
From: "John F. Goyvaerts" <johnfg@tornado.be>
Hi.I was told there have been some questions in this newsgroup about animated cursors. I don't know if this was the real issue, but using animated cursors in your applications is very easy.
Here's an example:
(mycursor.ani is an animated cursor file. You can create those with Microsoft's aniedit.exe)
const crMyCursor = 1; procedure TForm1.FormCreate(Sender: TObject); begin // Load the cursor. Needs to be done only once Screen.Cursors[crMyCursor] := LoadCursorFromFile('c:\mystuff\mycursor.ani'); // Use the cursor with this form Cursor := crMyCursor; end;
I hope I've helped out someone with this information.
From: David Ullrich <ullrich@math.okstate.edu>
library Hookdemo; uses Beeper in '\DELDEMOS\HOOKDEMO\BEEPER.PAS'; exports SetHook index 1, UnHookHook index 2, HookProc index 3; begin HookedAlready:=False; end.
, where beeper.pas is like so:
unit Beeper; interface uses Wintypes,Winprocs,Messages; function SetHook:Boolean;export; function UnHookHook:Boolean;export; function HookProc(Code:integer; wParam: Word; lParam: Longint): Longint;export; var HookedAlready:Boolean; implementation var ourHook:HHook; function SetHook:Boolean; begin if HookedAlready then exit; ourHook:=SetWindowsHookEx(WH_MOUSE,HookProc,HInstance,0); HookedAlready:=True; end; function UnHookHook:Boolean; begin UnHookWindowsHookEx(ourHook); HookedAlready:=False; end; function HookProc(Code:integer; wParam: Word; lParam: Longint): Longint; begin if (wParam=WM_LBUTTONDOWN) then MessageBeep(0); result:=CallNextHookEx(ourHook,Code,wParam,lParam); end; end.
Now if you call the SetHook function from an application there's a beep everytime you press the left mouse button - this continues until you call the UnHookHook function. In an actual application you're supposed to call CallNextHookEx immediately and do nothing else if code < 0 .
var myjoy: tjoyinfo; begin joygetpos(joystickid1,@myjoy); trackbar1.position := myjoy.wypos; trackbar2.position := myjoy.wxpos; radiobutton1.checked := (myjoy.wbuttons and joy_button1)>0; radiobutton2.checked := (myjoy.wbuttons and joy_button2)>0; end;Make sure to include MMSYSTEM in your USES clause.