You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Scott Turchin
MCSE, MCP+I http://www.tngbbs.com
---------------------- True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Timer works fine in DLL (if there is message loop somewhere - for example, in Exe).
Start a timer by hTimer = SetTimer (%HWND_DESKTOP, ..., ..., CodePtr(TimerProc)) and process events in
Code:
Function TimerProc(ByVal hwnd As Long, ByVal wMsg As Long, idEvent As Dword Ptr, ByVal dwTime As Dword) As Long
...
Function = %True
End Function
Here's my functions, question is what type of events am I looking for in this TimerProc, same as any other dialog message pump???
Will my modification work? (Very hard to test this right now)
Code:
Function InitializeCCSDLL() Export As Long
g_hTimer = SetTimer(%HWND_DESKTOP, %IDT_TIMER1, 30000, ByVal CodePtr(TimerProc))
Function = %TRUE
End Function
'------------------------------------------------------------------------------------------------------------------------
Function TimerProc(ByVal hwnd As Long, ByVal wMsg As Long,ByVal wParam As Long, ByVal lParam As Long) As Long
'Function TimerProc(ByVal hwnd As Long, ByVal wMsg As Long, idEvent As Dword Ptr, ByVal dwTime As Dword) As Long
Select Case wMsg
Case %WM_TIMER
Select Case Wparam
Case %IDT_TIMER1
' Check for Time here, must be 2 or 3 am, if sendmail fails set timer again
' SendMail
KillTimer %HWND_DESKTOP, %IDT_TIMER1
End Select
End Select
End Function
Now this is how I normally use a timer, same thing?
Scott
Case %WM_TIMER
Select Case CbWparam
Case %IDT_TIMER1
MousePtr 0
Dialog End sDlg, 1
End Select
[This message has been edited by Scott Turchin (edited December 13, 2000).]
Scott Turchin
MCSE, MCP+I http://www.tngbbs.com
---------------------- True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Also, this timer may solve another issue, can someone confirm this?
If an EXE runs a DLL Function called Init, etc, and that function starts a timer, the EXE doesn't need a message pump or a WaitForSingleObject does it?
Seems that on my machine the timer is holding the instance of the DLL open so to speak (PB/DLL says Destination Write File Error so I assume so)..
Scott Turchin
MCSE, MCP+I http://www.tngbbs.com
---------------------- True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
..or by specifying a TimerProc callback function when creating the timer.
When you specify a TimerProc callback function, the default window procedure
calls the callback function when it processes WM_TIMER.
Therefore, you need to dispatch messages in the calling thread,
even when you use TimerProc instead of processing WM_TIMER.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment