Warning SetTimer

Windows specific questions.
Post Reply
Wilko
Posts: 23
Joined: Oct 26, 2016 7:57

Warning SetTimer

Post by Wilko »

Hi, in a program I use the Windows timer. Everything works fine, I just get a compiler warning that I do not understand. So apparently I am doing something wrong. I start the timer using:

Code: Select all

hMyTimer = SetTimer(hWndMainForm, IDMyTimer, 100, cast(TIMERPROC, @My_TimerProc))
and the procedure starts as follows:

Code: Select all

SUB My_TimerProc(byval hwnd as HWND, byval uMsg as UINT, byval TimerID as UINT_PTR, byval dwTime as DWORD)
The warning I get is
warning 4(1): Suspicious pointer assignment
What should I change in my code to do it properly?

Any help is appreciated,
Wilko
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Warning SetTimer

Post by fxm »

How is declared hMyTimer ?

SetTimer() returns an UINT.

Code: Select all

Dim As UINT MyTimer
MyTimer = SetTimer(hWndMainForm, IDMyTimer, 100, @My_TimerProc)
Wilko
Posts: 23
Joined: Oct 26, 2016 7:57

Re: Warning SetTimer

Post by Wilko »

Thanks, of course, I had declared it as HWND. I thought the problem was in the TimerProc and could not think of anything else...
Post Reply