Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menu/Toolbar dlg in exe
#4
Sorry to kick this topic up, but I do not understand something.

The settimer line:

Code:
Copy      Help
SetTimer hDlg 1 100 0

The "gTimer SendMessage" line

Code:
Copy      Help
SendMessage hDlg WM_TIMER 1 0


If I disable the "gTimer SendMessage" line, the function seems to work exactly the same as with the "gTimer SendMessage" line enabled.

From:
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

Code:
Copy      Help
UINT_PTR WINAPI SetTimer(
  _In_opt_  HWND hWnd,
  _In_      UINT_PTR nIDEvent,
  _In_      UINT uElapse,
  _In_opt_  TIMERPROC lpTimerFunc
);

nIDEvent [in]
Type: UINT_PTR
A nonzero timer identifier. If the hWnd parameter is NULL, and the nIDEvent does not match an existing timer then it is ignored and a new timer ID is generated. If the hWnd parameter is not NULL and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value elapses, but the previously set time-out value is ignored. If the call is not intended to replace an existing timer, nIDEvent should be 0 if the hWnd is NULL.


The timer identifier has already been set in:
Code:
Copy      Help
SetTimer hDlg 1 100 0

So the below code always catches the timer id "1"

Code:
Copy      Help
    case WM_TIMER
    sel wParam
        case 1 goto gTimer

QUESTION:
Am I correct that I can safely remove the "gTimer SendMessage" line: SendMessage hDlg WM_TIMER 1 0 ?


Messages In This Thread

Forum Jump:


Users browsing this thread: 10 Guest(s)