I'm forwarding a small project to your direct Email that should (FLW) compile and behave identically in Delphi 4 as it does in Delphi 2007 (which I'm currently using).
What SHOULD happen is the client area will turn Red when the mouse pointer is over the form client area, and turn back to its original color when the mouse pointer leaves the client area. It shouldn't matter whether the form has focus or is partially obscured by another window. LMK if you have any trouble getting it to compile and run. Stephen Posey stephenlpo...@earthlink.net -----Original Message----- >From: Peter Kapas <pka...@sbcglobal.net> >Sent: Oct 14, 2010 4:21 AM >To: Moderated List for the Discussion of Delphi Programming > excludingDatabase-related topics <delphi@elists.org> >Subject: Re: Recognition ov application window > >Stephan, > >Thanks. I tried it - nothing happened. Maybe something missing from the >code? > >If I do it in: TForm1 = Class(TForm) I see action only if I declare: >Application.OnActivate := ... >and Application.OnDeactivate in TForm1.FormCreate(Sender ...). But!!! it >happen only, if >I click on the Form, or outside of the Form. Nothing happen, if I only move >the mouse over the Windows / Desktop ... etc. >There are some Mouse.xxxx functions to get the point coordinates. The only >problem is: if the form covered >by the no-Delphi application window, that window is "transparent" for the >mouse - what I do not want. I want >to recognize my application's window only in case, if the cursor is over on >the visible part of the application's >window. > >Please, verify your code, maybe something is needed to be present to make >"sensitive" the mouse without >click-click-click .... :) > >Peter > > > >----- Original Message ----- >From: "Peter Kapas" <pka...@sbcglobal.net> >To: "Moderated List for the Discussion of Delphi >ProgrammingexcludingDatabase-related topics" <delphi@elists.org> >Sent: Tuesday, October 12, 2010 6:23 AM >Subject: Re: Recognition ov application window > > >> Stephen, >> >> Thanks. I have to try again, because I did it similarly and it was not >> that, what I expected. >> This is the reason, why I am asking for it again and again. I have older >> Delphi 4. Maybe >> something is wrong in this version? I updated it with patches found before >> on the >> Company's website. >> >> Peter >> >> >> ----- Original Message ----- >> From: "Stephen Posey" <stephenlpo...@earthlink.net> >> To: "Moderated List for the Discussion of Delphi Programming >> excludingDatabase-related topics" <delphi@elists.org> >> Sent: Monday, October 11, 2010 5:59 AM >> Subject: Re: Recognition ov application window >> >> >>> OnMouseEnter and OnMouseLeave don't have anything to do with clicking on >>> the window per se; they provide notification when the mouse enters or >>> leaves the window's client area; regardless of whether the window has >>> focus. >>> >>> Here's a simple test I tried: >>> >>> unit mouseOverU1; >>> >>> interface >>> >>> uses >>> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, >>> Forms, >>> Dialogs; >>> >>> type >>> TfrmTestMouseOver = class(TForm) >>> procedure FormMouseEnter(Sender: TObject); >>> procedure FormMouseLeave(Sender: TObject); >>> private >>> { Private declarations } >>> protected >>> public >>> { Public declarations } >>> end; >>> >>> var >>> frmTestMouseOver: TfrmTestMouseOver; >>> >>> implementation >>> >>> {$R *.dfm} >>> >>> { TfrmTestMouseOver } >>> >>> procedure TfrmTestMouseOver.FormMouseEnter(Sender: TObject); >>> begin >>> Self.Color := clRed; >>> end; >>> >>> procedure TfrmTestMouseOver.FormMouseLeave(Sender: TObject); >>> begin >>> Self.Color := clBtnFace; >>> end; >>> >>> end. >>> >>> The color change works whether or not the window has focus or is >>> partially obscured by other windows. >>> >>> You also get MouseMove events without the window having focus, try >>> something like this: >>> >>> procedure TfrmTestMouseOver.FormMouseMove(Sender: TObject; Shift: >>> TShiftState; X, Y: Integer); >>> begin >>> Self.Color := RGB(X mod 255, y mod 255, Random(255)); >>> end; >>> >>> >>> Does that help any? >>> >>> Stephen Posey >>> stephenlpo...@earthlink.net >>> >>> >>> -----Original Message----- >>>>From: Peter Kapas <pka...@sbcglobal.net> >>>>Sent: Oct 10, 2010 11:38 AM >>>>To: Moderated List for the Discussion of Delphi Programming >>>> excludingDatabase-related topics <delphi@elists.org> >>>>Subject: Re: Recognition ov application window >>>> >>>>Hi Stephen, >>>> >>>>Off course, it works if I click on the window. I want to solve the >>>>problem, >>>>when I move Mouse over the window. I am looking for an indicator, where >>>>I can take the info about the object under the moving cursor. >>>> >>>>Similar - what you advise - is the : Form1.Active, but not really that, >>>>what >>>>I >>>>am looking for. >>>> >>>>Peter >>>> >>>>----- Original Message ----- >>>>From: "Stephen Posey" <stephenlpo...@earthlink.net> >>>>To: "Moderated List for the Discussion of Delphi Programming >>>>excludingDatabase-related topics" <delphi@elists.org> >>>>Sent: Saturday, October 09, 2010 4:17 PM >>>>Subject: Re: Recognition ov application window >>>> >>>> >>>>> Have you tried the OnMouseEnter and OnMouseLeave events? >>>>> >>>>> Stephen Posey >>>>> stephenlpo...@earthlink.net >>>>> >>>>> >>>>> -----Original Message----- >>>>>>From: Peter Kapas <pka...@sbcglobal.net> >>>>>>Sent: Oct 9, 2010 10:16 AM >>>>>>To: Delphi@elists.org >>>>>>Subject: Re: Recognition ov application window >>>>>> >>>>>>Hi Francois, >>>>>> >>>>>>Thanks, I already tried it. There are a few standard mouse functions to >>>>>>simplify that, >>>>>>but the major problem is, when the application window is partly covered >>>>>>by >>>>>>the other >>>>>>Windows applications and I cannot mask the area to say "I do not see >>>>>>my application, set-up indicator to False, if for seeing that is True). >>>>>>--- >>>>>>Peter >>>>>>--------------------------- >>>>>>> I would like to find method how to recognize, the mouse is over my >>>>>>> application window. If that window is partly covered by other >>>>>>> application, >>>>>>> I want to recognize that situation, in other words, that time, I want >>>>>>> see >>>>>>> some indicator, which tells me, between mouse cursor and my >>>>>>> application >>>>>>> window is something. How to do it? (I am using Delphi 4). >>>>>> >>>>>>Just an idea, not tested. >>>>>>Install a mouse hook to get the mouse movements whatever application is >>>>>>above your's. Then knowing the area(s) where you application is, you >>>>>>can >>>>>>compute if the mouse is within or not, even if your app is behind >>>>>>another >>>>>>other one. >>>>>> >>>>>>_______________________________________________ >>>>>>Delphi mailing list >>>>>>Delphi@elists.org >>>>>>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi >>>>> >>>>> _______________________________________________ >>>>> Delphi mailing list >>>>> Delphi@elists.org >>>>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi >>>> >>>>_______________________________________________ >>>>Delphi mailing list >>>>Delphi@elists.org >>>>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi >>> >>> _______________________________________________ >>> Delphi mailing list >>> Delphi@elists.org >>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi >> >> _______________________________________________ >> Delphi mailing list >> Delphi@elists.org >> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi > >_______________________________________________ >Delphi mailing list >Delphi@elists.org >http://lists.elists.org/cgi-bin/mailman/listinfo/delphi _______________________________________________ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi