Home All Groups Group Topic Archive Search About
Author
24 Sep 2005 12:16 AM
MP
Hi
I've seen a couple net samples for making tool tips.
They give the ability to show a tool tip over a control on the form in your
own app.
I'm wondering if there's a way to show a tool tip when cursor is over
another app,
with which my app is connected and interacting, maybe somehow by creating an
invisible window which could then get a hwnd which could then receive the
tooltip???

I don't know enough about creating windows via api to know if this is
possible or not.
I would need to somehow track the cursor's movement, detect when it fell
over certain objects in the external app, (autocad window), and then
depending on the object, show a tool tip with whatever message.

Thanks for any ideas
Mark

Author
24 Sep 2005 1:06 AM
MikeD
Show quote Hide quote
"MP" <Nomospam@Thanks.com> wrote in message
news:43349ad5$0$4862$8b463f8a@news.nationwide.net...
> Hi
> I've seen a couple net samples for making tool tips.
> They give the ability to show a tool tip over a control on the form in
> your
> own app.
> I'm wondering if there's a way to show a tool tip when cursor is over
> another app,
> with which my app is connected and interacting, maybe somehow by creating
> an
> invisible window which could then get a hwnd which could then receive the
> tooltip???
>
> I don't know enough about creating windows via api to know if this is
> possible or not.
> I would need to somehow track the cursor's movement, detect when it fell
> over certain objects in the external app, (autocad window), and then
> depending on the object, show a tool tip with whatever message.


Let me get this straight.  You want YOUR application to show a tooltip when
the mouse is hovered over something in another app? That boggles my mind. I
really don't know if I could think of something that could possibly be more
confusing to a user.  But maybe I'm not understanding what you're asking.
Can you elaborate a bit?

--
Mike
Microsoft MVP Visual Basic
Author
24 Sep 2005 3:51 AM
MP
Show quote Hide quote
"MikeD" <nob***@nowhere.edu> wrote in message
news:%23nRK3QKwFHA.3236@TK2MSFTNGP14.phx.gbl...
>
> "MP" <Nomospam@Thanks.com> wrote in message
> news:43349ad5$0$4862$8b463f8a@news.nationwide.net...
> > I'm wondering if there's a way to show a tool tip when cursor is over
> > another app,
> > with which my app is connected and interacting,
snip

>
> Let me get this straight.  You want YOUR application to show a tooltip
when
> the mouse is hovered over something in another app? That boggles my mind.
I
> really don't know if I could think of something that could possibly be
more
> confusing to a user.  But maybe I'm not understanding what you're asking.
> Can you elaborate a bit?
>
> --
> Mike
> Microsoft MVP Visual Basic
>

Hi Mike,
Thanks for responding.
I think I boggle a lot of peoples minds :-)
I may have been designed for another planet and just got misfiled on birth
:-)

Yes, I'm working away in another app, (autocad)
I enter a command which calls my app ("DisplayInfo" for examples sake)
My app then creates a tool tip that shows certain info when cursor hovers
above certain objects in the "parent app" (acad)
Am I confusing you even more yet?
:-)
Thanks for your time and thoughts
Mark
Author
24 Sep 2005 10:40 AM
J French
On Fri, 23 Sep 2005 22:51:49 -0500, "MP" <Nomospam@Thanks.com> wrote:

<snip>

>Yes, I'm working away in another app, (autocad)
>I enter a command which calls my app ("DisplayInfo" for examples sake)
>My app then creates a tool tip that shows certain info when cursor hovers
>above certain objects in the "parent app" (acad)
>Am I confusing you even more yet?

Sounds reasonable

Set up a Timer
Use the GetCursorPos to get .. the CursorPos

Heck - here is a crude Snooper

Then you can have a borderless Form that you make look like a Tooltip
and move that into position

Incidentally you'll probably need RegisterHotKey
- there is an example in the downloadable API Guide at :

http://www.mentalis.org/agnet/ 

Code follows :-

Option Explicit

' Add one Timer

Private Type POINTAPI
        X As Long
        Y As Long
End Type
Private Declare Function GetCursorPos _
        Lib "user32" _
        (lpPoint As POINTAPI) As Long

Private Declare Function WindowFromPoint _
        Lib "user32" _
        (ByVal xPoint As Long, _
         ByVal yPoint As Long) As Long

Private Declare Function GetClassName _
        Lib "user32" _
        Alias "GetClassNameA" _
        (ByVal hwnd As Long, _
          ByVal lpClassName As String, _
          ByVal nMaxCount As Long) As Long

Private Declare Function SendMessage _
        Lib "user32" Alias "SendMessageA" _
        (ByVal hwnd As Long, _
         ByVal wMsg As Long, _
         ByVal wParam As Long, _
         lParam As Any) As Long

Private Const WM_GETTEXT = &HD


Private Sub Form_Load()
    Timer1.Enabled = True
    Timer1.Interval = 500
End Sub

Private Function WindowInf() As String
    Dim Hnd As Long, Buff$, Q&
    Dim PT As POINTAPI

    GetCursorPos PT
    Hnd = WindowFromPoint(PT.X, PT.Y)

    WindowInf = Str$(Hnd)
    ' ---
    Buff$ = Space$(255)
    Q& = GetClassName(Hnd, Buff$, Len(Buff$))
    WindowInf = WindowInf + ":" + Left$(Buff$, Q)
    ' ---
    Q& = SendMessage(Hnd, WM_GETTEXT, Len(Buff$), ByVal Buff$)
    WindowInf = WindowInf + ":" + Left$(Buff$, Q)
    Text1.Text = Left$(Buff$, 10)

End Function


Private Sub Timer1_Timer()
    Me.Caption = WindowInf
End Sub
Author
26 Sep 2005 3:35 PM
MP
Show quote Hide quote
"J French" <erew***@nowhere.uk> wrote in message
news:43352bb3.180515882@news.btopenworld.com...
> On Fri, 23 Sep 2005 22:51:49 -0500, "MP" <Nomospam@Thanks.com> wrote:
>
> <snip>
>
> >Yes, I'm working away in another app, (autocad)
> >I enter a command which calls my app ("DisplayInfo" for examples sake)
> >My app then creates a tool tip that shows certain info when cursor hovers
> >above certain objects in the "parent app" (acad)
> >Am I confusing you even more yet?
>
> Sounds reasonable
>
> Set up a Timer
> Use the GetCursorPos to get .. the CursorPos
>
> Heck - here is a crude Snooper
>
> Then you can have a borderless Form that you make look like a Tooltip
> and move that into position
>
> Incidentally you'll probably need RegisterHotKey
> - there is an example in the downloadable API Guide at :

> snip>
>


Thanks for that idea
I'll check into that
Thanks,
Mark