🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4435

Re: MouseHover

#4435
From: mf
Date: Tue, 24 Jan 2006 00:37
82 lines
3038 bytes
> Please show a more complete code snippet that actually compiles.
>
OK, I've changed a few things to be more explicit.
I've tried this on both XP Pro (home computer,  AMD Athelon, 512M Mem) and
Win 2000 Pro(Dell laptop, Intel Mobile, 512M Mem)


I have created a button to "hover" over.  This is done after creating the
main window in WinMain.
Here is the button creation as well as the TrackMouseEvent call.  This is
all in WinMain.


  hBtn3 = CreateWindow("BUTTON","3",WS_VISIBLE | WS_CHILD |
BS_DEFPUSHBUTTON,
                          210, 40, 50, 50, ghwnd, (HMENU)ID_BTN3, ghInst,
NULL);
  if (hBtn3 == NULL)
  {
    sprintf(tempstr, "Button Create Error = %d", GetLastError());
    MessageBox(ghwnd, tempstr, "Btn Fault", MB_OK);
  }
  tme.cbSize      = sizeof(TRACKMOUSEEVENT);
  tme.dwFlags     = TME_HOVER;
  tme.hwndTrack   = hBtn3;
  tme.dwHoverTime = 600;
  retbool = TrackMouseEvent(&tme);
  if (retbool == FALSE)
  {
    sprintf(tempstr, "Tracking Error = %d", GetLastError());
    MessageBox(ghwnd, tempstr, "Fault", MB_OK);
  }

The button creation returns the handle to hBtn3.
retbool returns TRUE

-----------------------------------------------
then in WndProc

switch (msg)
{
    case WM_MOUSEHOVER:
      GetLocalTime(&tm);
    break;
  .
  .
  .

I've also tried

switch(msg)
{
  case WM_COMMAND:
      switch (LOWORD(wParam))
      {
        case IDC_COMBO:
          if (HIWORD(wParam) != CBN_DBLCLK)
            break;
        break;
        case ID_BTN3:
          GetLocalTime(&tm);
        break;
        case WM_MOUSEHOVER:
          GetLocalTime(&tm);
        break;
      }


I've set break points on the ID_BTN3 to verify the button works.
result :   works
GetLocalTime(&tm) to see if the WM_MOUSEHOVER is generated.
result :  nothing

I have my window and hBtn3 button on the screen
I click on the button and the breakpoint for ID_BTN3 works
I move the mouse over the button and wait.  Nothing happens.

I hope this is clearer.
I have checked MSDN and many other resources.  I seem to need more explicit
examples on some of these things.

Thanks for your replys!!!!
Technical Details
Message-ID: <43d57616$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news2.volia.net!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43d3967d$1@newsgroups.borland.com> <43d489a0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c2088a628df25e81
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "mf" <xxx.yyy@xyxy.xy>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43d3967d$1@newsgroups.borland.com> <43d489a0$1@newsgroups.borland.com>
Subject: Re: MouseHover
Date: Mon, 23 Jan 2006 19:37:29 -0500
Lines: 86
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 68.51.120.54
Message-ID: <43d57616$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1138062870 68.51.120.54 (23 Jan 2006 16:34:30 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news2.volia.net!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail