A window has A button, the mouse on the button, the button will shine,
Could you tell me how to achieve this effect using sendmessage to send wm_mousemove, there is a premise that real mouse is still doing its own thing,
My idea is to use A timer thread per 30 ms to send wm_mousemove within A window handle button,
But the mouse is still doing other things, this 30 ms sendmessage a wm_mousemove with real really move the button of the mouse did not move, what's the difference? In the event, for example?
CodePudding user response:
What is called a shinyCodePudding user response:
Delphi 2006 and above version, controls have onm ousehover (the cursor is hovering in the control area), the onm ouseenter (into the control area),Onmouseleave (away from the control area), if there is no these events using the delphi7, need oneself to control extension with these events,
Join these events is also very simple, but if the mouse quickly across the control area, that would not be too light, a few events to be precise control through trackmouseevent at this moment,
Var
Tme: ttrackmouseevent;//define a global variable, or a member of the form
,,,,,,
//in form1 oncreate initialization tme: ttrackmouseevent structure
Procedure tform1. Formcreate (sender: tobject);
The begin
Tme. CbSize:=sizeof (ttrackmouseevent);
Tme. DwFlags:=tme_leave + tme_hover;//to ask leave and hover the two news
Tme. HwndTrack:=form1. Handle;//associated window handle
Tme. DwHoverTime:=100;//key here, associated with the mouse movement speed, the unit milliseconds
//that is hovering on the control of more than 100 milliseconds wm_mousehover message sent, says hovering
end;
WndProc//your own window next process, process hovering and leave messages inside
Procedure tform1. Wndproc (var m: tmessage);
The begin
With m do
The begin
Case MSG of
//mouse message
Wm_mousemove:
The begin
The trackmouseevent (tme);
end;
//mouse suspended in the form
Wm_mousehover:
The begin
//do you here the so-called "glow" processing
end;
//mouse leave form
Wm_mouseleave:
The begin
//here to return to "glow" state of the size of
end;
end;
Inherited wndproc (m);
end;
CodePudding user response:
Forget, is dealing with button,Then the corresponding to tme. HwndTrack specifies the window handle of the button
Wndproc convert form1. Windowproc
The form1. Windowproc refers to the windowproc button, there to do the same process can
What time, did not write, LZ lu decide it yourself
CodePudding user response:
Thank you very much sololie,Sorry, I didn't express my question,
We open the web page, when the mouse moves to the hyperlink, the hyperlink text below will appear a line,
If I don't have a mouse, but with the software constantly send wm_mousemove position to handle the web page links, also can appear below the line,
My question is this: even if no real mouse moved to the hyperlinks, in addition to constantly send wm_mousemove if there is any other way,
CodePudding user response:
Change the font, change the font to underlined, or draw a line themselvesCodePudding user response:
I want to achieve with Sendmessage send wm_mousemove to achieve and the effect on real mouse move to something,CodePudding user response:
You under the Delphi, inherit TButton write an own control, in which then catch all messages sent to their controls,1. To collect a total of how many messages;
2. Tell what message, in any case, what results,
Use this under the Delphi tests repeatedly,
Finally in the environment you want see to achieve the results you want,
CodePudding user response:
Calculate the position of the button, assemble WM_MOUSEMOVE message, sent