Click here to Skip to main content
15,900,108 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: interface in background Pin
Johpoke13-Nov-06 8:51
Johpoke13-Nov-06 8:51 
GeneralRe: interface in background Pin
Johpoke13-Nov-06 8:52
Johpoke13-Nov-06 8:52 
GeneralRe: interface in background Pin
Mike_V13-Nov-06 12:20
Mike_V13-Nov-06 12:20 
GeneralRe: interface in background Pin
Johpoke14-Nov-06 6:21
Johpoke14-Nov-06 6:21 
GeneralRe: interface in background Pin
Johpoke14-Nov-06 9:09
Johpoke14-Nov-06 9:09 
Questionhow to generate key for using in AES algo Pin
sharad puttar12-Nov-06 0:22
sharad puttar12-Nov-06 0:22 
AnswerRe: how to generate key for using in AES algo Pin
Mark Salsbery12-Nov-06 8:02
Mark Salsbery12-Nov-06 8:02 
QuestionDetecting mouse buttons Pin
Waldermort11-Nov-06 23:55
Waldermort11-Nov-06 23:55 
Detecting mouse buttons itself is quite easy, but there an equaly easy way to detect if the mouse button is being held down for a period of time?

My method is to launch my own message loop, but if an error occurs it would kinda mess up the whole program. Please take a look at my code and if you see any potential probems, please point them out.

do
{
    if ( ! ::GetMessage( &msg, 0, 0, 0 ) )
        break;
    if ( ::CallMsgFilter( &msg, MSGF_SCROLLBAR ) )
        continue;
    pt = msg.pt;
    ::ScreenToClient(m_hWnd,&pt);
    if (msg.message == WM_LBUTTONUP)
        HandleMouseUp(pt);
    else if (msg.message == WM_MOUSEMOVE)
        HandleMouseMove(pt);
    else if (msg.message == WM_TIMER)
    {
        if ( bFirstRun )
        {
            // prevent a single click acting like a hold
            bFirstRun = false;
            // cause a 500ms pause before acting on mouse hold
            for ( int i=0; i<50; i++ )
            {
                ::Sleep(10);
                MSG peek;
                if ( PeekMessage(&peek,m_hWnd,WM_LBUTTONUP,WM_LBUTTONUP,FALSE) )
                    break;
            }
            continue;
        }
        HandleMouseDown(pt);
    }
    else
    {
        ::TranslateMessage( &msg );
        ::DispatchMessageW( &msg );
    }
} while ( msg.message != WM_LBUTTONUP );

AnswerRe: Detecting mouse buttons Pin
Mike_V12-Nov-06 15:23
Mike_V12-Nov-06 15:23 
QuestionWant help,please. Pin
toeh11-Nov-06 23:04
toeh11-Nov-06 23:04 
AnswerRe: Want help,please. Pin
Hamid_RT11-Nov-06 23:13
Hamid_RT11-Nov-06 23:13 
GeneralRe: Want help,please. Pin
toeh11-Nov-06 23:38
toeh11-Nov-06 23:38 
GeneralRe: Want help,please. Pin
Hamid_RT12-Nov-06 0:13
Hamid_RT12-Nov-06 0:13 
GeneralRe: Want help,please. Pin
toeh12-Nov-06 0:19
toeh12-Nov-06 0:19 
GeneralRe: Want help,please. Pin
Hamid_RT12-Nov-06 0:49
Hamid_RT12-Nov-06 0:49 
GeneralRe: Want help,please. Pin
toeh12-Nov-06 0:55
toeh12-Nov-06 0:55 
GeneralRe: Want help,please. Pin
toeh12-Nov-06 1:30
toeh12-Nov-06 1:30 
GeneralRe: Want help,please. Pin
Waldermort12-Nov-06 2:24
Waldermort12-Nov-06 2:24 
AnswerRe: Want help,please. Pin
David Crow6-Dec-06 3:40
David Crow6-Dec-06 3:40 
QuestionGet titlebar height Pin
Toubou11-Nov-06 20:47
Toubou11-Nov-06 20:47 
AnswerRe: Get titlebar height Pin
Hadi Dayvary11-Nov-06 20:51
professionalHadi Dayvary11-Nov-06 20:51 
Questionfunction signature Pin
amaneet11-Nov-06 20:47
amaneet11-Nov-06 20:47 
AnswerRe: function signature Pin
Christian Graus11-Nov-06 20:53
protectorChristian Graus11-Nov-06 20:53 
AnswerRe: function signature Pin
Hamid_RT11-Nov-06 23:06
Hamid_RT11-Nov-06 23:06 
AnswerRe: function signature Pin
vijay_aroli12-Nov-06 23:46
vijay_aroli12-Nov-06 23:46 

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.