CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 1999
    Location
    Mumbai, India
    Posts
    207

    Problem with Timer Control

    Hi Codegurus,

    I am facing a weird problem with the timer
    control of VB.

    I have a VB form which has the timer in it. The
    timer is set to 5 seconds interval. When this
    5 sec expires, the Timer() method is called by
    the VB framework automatically.

    The Timer() method has a COM server method call
    in it. So every 5 seconds the server method call
    should take place.

    If I run the application in the debug mode (by
    pressing F5 button from the VB Design menu),
    there is no problem; but if I compile the EXE
    and run it from the desktop, the timer function
    fires only once. The entire Form freezes after
    this and there is no response on the Form.

    Just for information:
    - The COM object is instantiated using
    CreateObject()

    - I am running this application on
    Windows 2000

    - The server side code is written in VC 6.0.
    I have used the ATL COM wizard for building
    the class and the interface (i.e. the skeleton
    code)

    What could be the reason for this? If this is a
    VB bug, please suggest a workaround. This is
    really URGENT!!!!!

    Thanks in advance,

    With best regards,
    Sayan

    Sayan Mukherjee
    Calcutta (INDIA)
    Email: [email protected]
    Thank you.
    Sayan
    ====================

    Sayan Mukherjee
    [Email: [email protected]]

  2. #2
    Join Date
    Jun 2000
    Location
    Nepal
    Posts
    108

    Re: Problem with Timer Control

    Maybe a DoEvents within the Timer() event handler works for you.


  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Problem with Timer Control

    I wouldn't advise that - what happens if the timer fires whilst it is still processing the last firing and gets to the doevents()? Probably "out of stack space".

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  4. #4
    Join Date
    Oct 1999
    Location
    Mumbai, India
    Posts
    207

    Re: Problem with Timer Control

    The timer function should not fire before it
    has finished processing the last firing. The
    time count down starts all over only after
    the TimerName.Timer() method returns.

    So if the timer is enabled, there has to be at
    least a finite time gap between two successive
    calls to the TimerName.Timer() method.

    However I found a work around to my problem.
    I registered my server dll again and everything
    was fine! I don't know what went wrong. I am
    still apprehensive that the code can give
    problems when it runs in the MTS.

    Please throw some light on the problem. I would
    like to be preventive rather than be sorry later!

    With best regards,

    Sayan

    Sayan Mukherjee
    Calcutta (INDIA)
    Email: [email protected]
    Thank you.
    Sayan
    ====================

    Sayan Mukherjee
    [Email: [email protected]]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured