Jump to content

Error allocating memory with _Timer_SetTimer


bile
 Share

Recommended Posts

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "biledde\DDEML.au3"
#include "biledde\DDEMLClient.au3"
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Include <Timers.au3>
#include <Math.au3>


Opt("GUIonEventMode",1)
opt("GUIEventOptions",0)
AutoItSetOption("MustDeclareVars",1)

Global $main,$timer

$main=GUICreate("Test Timer",500,400,-1,-1,$WS_SIZEBOX)
$timer=_Timer_SetTimer($main,1000,"timeout")

GUISetState()

while 1
sleep(2000)
wend


Func timeout()
    consolewrite("timeout!!!!!!!!!!!!!!!!!!!!!!!!")
EndFunc

Hello, I have a problem with my script using _Timer_setTimer

every time the timer elapses, I get an "Error Allocating Memory" and the script crashes.

As My script works fine without the timer, I tried to use it in a simple script, but I get the same result. What's wrong with it?? Could someone please help ?

Link to comment
Share on other sites

Function parameters and #forceref has to be added. But with the enhancement to use more then one AdlibRegister() I would switch to that.

#include <WindowsConstants.au3>
#include <Timers.au3>

$main = GUICreate("Test Timer", 500, 400, -1, -1, $WS_SIZEBOX)
$timer = _Timer_SetTimer($main, 1000, "timeout")
GUISetState()

While 1
    Sleep(2000)
WEnd

Func timeout($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    ConsoleWrite("timeout!!!!!!!!!!!!!!!!!!!!!!!!" & @crlf)
EndFunc   ;==>timeout
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...