Click here to Skip to main content
15,917,176 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Loading a BMP to FullScreen & disabling keys Pin
Jason Teagle12-Jun-01 4:45
Jason Teagle12-Jun-01 4:45 
GeneralRe: Loading a BMP to FullScreen & disabling keys Pin
Adeel Shamsi13-Jun-01 23:44
Adeel Shamsi13-Jun-01 23:44 
GeneralRe: Loading a BMP to FullScreen & disabling keys Pin
Jason Teagle13-Jun-01 23:48
Jason Teagle13-Jun-01 23:48 
Generalvisual c++ 7 Pin
11-Jun-01 23:52
suss11-Jun-01 23:52 
GeneralRe: visual c++ 7 Pin
Michael P Butler12-Jun-01 0:04
Michael P Butler12-Jun-01 0:04 
GeneralRe: visual c++ 7 Pin
Derek Lakin12-Jun-01 0:05
Derek Lakin12-Jun-01 0:05 
GeneralTrackMouseEvent question Pin
11-Jun-01 21:44
suss11-Jun-01 21:44 
General2 Pin
11-Jun-01 21:44
suss11-Jun-01 21:44 
I am atempting to create a bitmap button that reacts to the WM_MOUSEHOVER & WM_MOUSELEAVE messages...
Here is the important stuff from the WindowProc:

// m_hDCClick, m_hDCOver, & m_hDCNoFocus are all HDCs that contain different images
// clicking on the button causes it to change the image properly
// but the mouse over events don't seem to work?
// however, the WM_MOUSELEAVE event does seem to work because the button does change back to
// normal when i click (holding down the left button) and leave the button area?
// my initial reaction is to think that the button window is not active... or on top?
// and that clicking on it brings it to the top and that is why the WM_MOUSELEAVE is working?
// but i'm not sure if that is the case, nor would i know how to fix such a problem?

bool _left_button_down = false;
bool _mouse_over = false;
.
.
.
case WM_PAINT:
{
PAINTSTRUCT ps;
::BeginPaint(hWnd, &ps);

if (_left_button_down) // if the left button is down draw the clicked image
::BitBlt( ps.hdc, 0, 0, m_Width, m_Height, m_hDCClick, 0, 0, SRCCOPY );
else if (_mouse_over) // if the mouse is over draw the over image
::BitBlt( ps.hdc, 0, 0, m_Width, m_Height, m_hDCOver, 0, 0, SRCCOPY );
else // else draw the idle image
::BitBlt( ps.hdc, 0, 0, m_Width, m_Height, m_hDCNoFocus, 0, 0, SRCCOPY );

::EndPaint(hWnd, &ps);
}
return FALSE;

case WM_LBUTTONDOWN:
_left_button_down = true;
::InvalidateRect( hWnd, NULL, false );
return FALSE;

case WM_LBUTTONUP:
_left_button_down = false;
::InvalidateRect( hWnd, NULL, false );
return FALSE;

case WM_MOUSEMOVE:
{
TRACKMOUSEEVENT lpEventTrack;

lpEventTrack.cbSize = sizeof( TRACKMOUSEEVENT );
lpEventTrack.dwFlags = TME_HOVER | TME_LEAVE;
lpEventTrack.dwHoverTime = 1;
lpEventTrack.hwndTrack = hWnd;

if(!::_TrackMouseEvent(&lpEventTrack))
{
MessageBox(m_hWndParent, "TrackMouseEvent Failed", "Error", MB_OK);
}
if( wParam != MK_LBUTTON )
{
_left_button_down = false;
_mouse_over = true;
::InvalidateRect( hWnd, NULL, false );
}
return FALSE;

case WM_MOUSEHOVER:
{
if( wParam == MK_LBUTTON )
{
_left_button_down = true;
_mouse_over = false;
} else {
_mouse_over = true;
_left_button_down = false;
}
::InvalidateRect( hWnd, NULL, false );
}
return FALSE;

case WM_MOUSELEAVE:
{
_mouse_over = false;
_left_button_down = false;
::InvalidateRect( hWnd, NULL, false );
}
return FALSE;
.
.
.

Thank You,
John
QuestionSetting wide message system hook? Pin
11-Jun-01 21:13
suss11-Jun-01 21:13 
AnswerRe: Setting wide message system hook? Pin
Igor Sukhov12-Jun-01 3:14
Igor Sukhov12-Jun-01 3:14 
AnswerRe: Setting wide message system hook? Pin
Jason Teagle12-Jun-01 4:56
Jason Teagle12-Jun-01 4:56 
GeneralDon't include header files. Pin
hahyojin11-Jun-01 19:17
hahyojin11-Jun-01 19:17 
Generalplease translate ;) Re: Don't include header files. Pin
Igor Sukhov11-Jun-01 23:02
Igor Sukhov11-Jun-01 23:02 
Generalwe all <i><b>love</b></i> an inheritance question! Pin
Nick Blumhardt11-Jun-01 17:37
Nick Blumhardt11-Jun-01 17:37 
GeneralRe: we all <i><b>love</b></i> an inheritance question! Pin
Gerald Schwab11-Jun-01 17:58
Gerald Schwab11-Jun-01 17:58 
GeneralRe: we all <i><b>love</b></i> an inheritance question! Pin
Nick Blumhardt11-Jun-01 19:06
Nick Blumhardt11-Jun-01 19:06 
GeneralRe: we all <i><b>love</b></i> an inheritance question! Pin
Ben Burnett11-Jun-01 19:21
Ben Burnett11-Jun-01 19:21 
GeneralRe: we all <i><b>love</b></i> an inheritance question! Pin
Gert Boddaert11-Jun-01 21:38
Gert Boddaert11-Jun-01 21:38 
GeneralRe: we all <i><b>love</b></i> an inheritance question! Pin
Nick Blumhardt12-Jun-01 13:21
Nick Blumhardt12-Jun-01 13:21 
GeneralRe: we all <i><b>love</b></i> an inheritance question! Pin
Gerald Schwab12-Jun-01 15:02
Gerald Schwab12-Jun-01 15:02 
Generalusing unicode symbols in embedded VC++ Pin
bo11-Jun-01 17:01
bo11-Jun-01 17:01 
GeneralProgram crashes when I try to assign values to a CListBox in a dialog window created from my main dialog window Pin
11-Jun-01 16:06
suss11-Jun-01 16:06 
GeneralRe: Program crashes when I try to assign values to a CListBox in a dialog window created from my main dialog window Pin
11-Jun-01 18:14
suss11-Jun-01 18:14 
GeneralNope Pin
11-Jun-01 23:44
suss11-Jun-01 23:44 
GeneralRe: Program crashes when I try to assign values to a CListBox in a dialog window created from my main dialog window Pin
Ben Burnett11-Jun-01 19:27
Ben Burnett11-Jun-01 19:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.