Solved

help with WM_MOUSEHOVER use

Posted on 2007-03-30
12
1,336 Views
Last Modified: 2012-06-21
I have two static windows that are created with the API call createwindowex and each contain a bitmap of a button - but what i would like to do is get notified when the user hovers over each of the static windows so i can then change the bitmap to show a depressed bitmap button.

I found the WM_MOUSEHOVER message that i guess is where i need to do the work but i am unable to get any information on using it with delphi in an API created program.

Can anyone help?
0
Comment
Question by:patera2
12 Comments
 
LVL 21

Expert Comment

by:ziolko
Comment Utility
when you create window with CreateWindowEx you have to pass pointer to WndProc and that's where you handle messages for this window

ziolko.
0
 

Author Comment

by:patera2
Comment Utility
hanling the messages via the WndProc is no problem - it is getting a message when the mouse is hovering over the button so i can swap out the bitmaps is the problem. checking for the WM_MOUSEHOVER messages doesn't work.
0
 
LVL 21

Expert Comment

by:ziolko
Comment Utility
what you mean by: checking for the WM_MOUSEHOVER messages doesn't work.
you dont recive this message or message is recived by window not button?

note that if button is bitmap it will not recive any messages, you can handle
mouse messages in window and then calculate mouse position to determine
if it's on button, make sure you want WM_MOUSEHOVER not WM_MOUSEMOVE

ziolko.
0
 

Author Comment

by:patera2
Comment Utility
I don't get anything when i check for the WM_MOUSEHOVER, WM_MOUSEMOVE or WM_MOUSELEAVE message in the WndProc - although maybe i am doing something wrong.

what i have is two static windows each has a bitmap, when the user moves mouse over any of the static windows i want to swap the bitmap out to show a change then go back to original button bitmap when user moves mouse off the static window.

i have trie checking the iparm for the name of the static window under the different mouse messages but get nothing when i move over each window.
0
 
LVL 21

Expert Comment

by:ziolko
Comment Utility
ok, show some code how you create those static windows

ziolko.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:patera2
Comment Utility
hbtn1 := CreateWindowEx (0, Pchar('Static'), '', WS_TABSTOP or WS_VISIBLE or
                               WS_CHILD or SS_BITMAP, 10,
                               10, 40, 25, hWindow, 0, hClass.hInstance, nil);

      If hbtn1 <> 0 then
       begin
            hBitmap1:= LoadImage(hClass.hInstance, 'image1', IMAGE_BITMAP, 25, 40, 0);
            SendMessage(hbtn1, STM_SETIMAGE, IMAGE_BITMAP, hBitmap1);

       end;

hbtn2 := CreateWindowEx (0, Pchar('Static'), '', WS_TABSTOP or WS_VISIBLE or
                               WS_CHILD or SS_BITMAP, 10,
                               70, 40, 25, hWindow, 0, hClass.hInstance, nil);


      If hbtn2 <> 0 then
       begin
            hBitmap2:= LoadImage(hClass.hInstance, 'image1', IMAGE_BITMAP, 25, 40, 0);
            SendMessage(hbtn2, STM_SETIMAGE, IMAGE_BITMAP, hBitmap2);

       end;
0
 
LVL 21

Expert Comment

by:ziolko
Comment Utility
do you catch any messages in WndProc?
how you set WndProc for newly created windows?

ziolko.
0
 

Author Comment

by:patera2
Comment Utility
yes, i catch WM_SYSCOMMAND, WM_PAINT, etc in the winproc of the main window (hwindow)  - when i create a window for an actual  button i check the WM_SYSCOMMAND for it in the IParm and that all works perfectly - it is the static window i cannot get.

i tried looking for the WM_MOUSEHOVER in the wndproc of the main window and then check the Iparam for the static window (hbtn1 for example) but it doesn;t seem to do anything
0
 
LVL 10

Accepted Solution

by:
dinilud earned 250 total points
Comment Utility
0
 

Expert Comment

by:dciambrone
Comment Utility
0
 

Author Comment

by:patera2
Comment Utility
sorry, had forgotten to close the question.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now