PDA

Click to See Complete Forum and Search --> : Set Timer API


wolfofthenorth
Mar 1st, 2001, 06:17 PM
Hi,

Is there a problem using the SetTimer API in an NT4.0 environment? I have some code that works fine on ME, but when try it on NT I get an memory error. Is there some "tweek" I can do to it to make it work?

Thanks

wolf

crispin
Mar 2nd, 2001, 04:32 AM
Post some code, SetTimer should work fine under NT4....

wolfofthenorth
Mar 2nd, 2001, 01:42 PM
Hi,

Thanks for trying to help me. This exact code will run in the VB IDE under ME, but not under NT. I get a VB6.exe application error that says, The instruction at 0x0012fe99 referenced memory at 0x0fc00fdc. The memory could not be written. This doesn’t mean much to me; maybe you will have a better idea about its interpretation.

Another note: It appears to blow up at the settimer line in the BackGround Sub.

This is in a standard module in an active X exe

Option Explicit

Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private lTimer As Long
Private cCollator As Collator

Public Sub CallBackClass(lpCollator As Collator)
If lpCollator Is Nothing Then Exit Sub
Set cCollator = lpCollator
End Sub

Public Sub BackGround()
lTimer = SetTimer(0, 0, 100, AddressOf BackOperation)
End Sub

Public Sub BackOperation()
Call KillTimer(0, lTimer)
lTimer = 0
cCollator.CommenceJob
Set cCollator = Nothing
End Sub


Do you think limited access rights maybe effecting this?

Thanks for your help!!!

wolfofthenorth
Mar 4th, 2001, 12:57 AM
I got around the problem by using a timer, but the API just wouldn't work. Does anyone have any ideas as to why? I'm just lookin for a push in the right direction. My experience on NT is limited.

Thanks

Mar 4th, 2001, 01:12 AM
HI

Funnily I also get the same error message. But the memory addresses are different and I am using Win 2000

This is the message I get.

The instruction at "0x0fc00f1e" referenced memory at "0x00000010". The memory could not be "written".

wolfofthenorth
Mar 4th, 2001, 11:16 AM
Thanks for the responce. At least I know I'm not the only one with this problem. Unless, you were just helping me test the code I posted. Anyway, I got around the problem; I was just curious about whether the API worked on NT or not.

Thanks for the help.