Hi after i take a look inside w32.inc ,im very happy to have now nice flat buttons *bg* (sorry,im new to asm and think first i can only make textbuttons) now i like to make some kind of mouse over effect with the buttons ,like: if the mouse is over a button,the textcolor should move from black to white or so. after searching some time,i found sources showing me how to set background color for all editfields or static text,but not for buttontext. where can i find a small example or a desription about what kinds of buttons i can make ? thanks ;)
If you get any answer on your mail I would be glad if you could inform me about it too, because i am searching for something like this, too. thx. sign CyBerian
Hey, theres a little trick to this... Everytime a button goes to repaint itself, its sends a WM_CTLCOLORBTN message to its parent window. Look it up, but there are certain tricks to using this message which i dont know, (ie its easy to screw up the painting of your button), cause ive never used this message before. Also, ive always wondered, whats the easyist way to tell when the mouse is over a window, cause i know you can wait for a WM_MOUSEMOVE message and then capture the mouse, but as far as i know, windows doesn't have a WM_MOUSEOVER message to tell you when your window has the mouse over it, and then a pair to tell you when you lose that. If you can get what i mean there? thnx This message was edited by George, on 3/3/2001 5:35:57 PM
Under W98+ or NT4, there is a _TrackMouseEvent function that gives you WM_MOUSEHOVER and WM_MOUSELEAVE messages. Actually, same messages work on W95 if *something* has been installed. I forget which dll, something from MSIE I believe, but it's something you cannot legally re-distrubute. Personally, I wouldn;t use it for this compatability reason, but your mileage may vary.
I'm not sure if it's going to work but you can try the WM_MOUSEMOVE message. (quoted text from API) "The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse. WM_MOUSEMOVE fwKeys = wParam; // key flags xPos = LOWORD(lParam); // horizontal position of cursor yPos = HIWORD(lParam); // vertical position of cursor" If the coordinates of the mouse are within the area of the window/button/whatever... then do the changes to the window. Not sure whether/how this function will work but nevertheless here it is: "The SetWindowLong function changes an attribute of the specified window. The function also sets a 32-bit (long) value at the specified offset into the extra window memory of a window. LONG SetWindowLong( HWND hwnd, // handle of window int nIndex, // offset of value to set LONG lNewLong // new value ); There must be a simple way of doing what you have in mind. If I come up with/across something I'll let you know. Regards
Well i have an idea, it may take a little bit of coding though, but i dont have the time to write the example right now, mabe tomorrow, but you could trap the WM_MOUSEMOVE message and call GetWindowRect for your window coordinates, and then if you knew exactley where the button was you could write code to fill in a new RECT structure for the button, now then after that you could test each WM_MOUSEMOVE message with a ClipCursor call, and test weather the value ClipCursor returns TRUE(its in the rect) or FALSE(its not in the rect) and then call the button code. its just a thought. -brad
After retrieveing the rect, you could also use the api function "PtInRect", that's what i would use anyways :)
I have just the code example you need, the code is small, there is no other stuff in the code, so you don't have to wade thru alot of source code to see how it is working. the examble demo I wrote is called Pop Out Buttons you can get it from my webpage at:
I hope this what your looking for.