Results 1 to 4 of 4

Thread: Background Task

  1. #1

    Thread Starter
    Hyperactive Member Bananafish's Avatar
    Join Date
    Jan 2001
    Posts
    394

    Question Background Task

    I have a DLL where I want one of it's functions to process in the background. When it has finished processing it will raise an event so that the requesting program can then see if it failed or succeeded.

    ok - I know how to raise events - what I am not sure of is how to code it so that the program calling it can call the function and continue immediately.

    If the DLL had a form then I guess I could do something with a timer - ie something like this.

    Public Sub BackgroundTask()

    timer1.enabled

    End Sub

    where all the background code is in the timer event.

    However - the DLL doesn't have an associated form - and surely there must be a better way of doing this?

    Thanks in advance

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Could you do something like this ...
    Code:
    Public Sub Modules_BackgroundTask() as boolean
      Modules_BackgroundTask = false
    
      'do something here
    
      Modules_BackgroundTask = true
    End  Sub
    
    
    Public Sub WhaDaYaMaCallit()
    
       Call Modules_BackgroundTask
    
       Do while not Modules_BackgroundTask = true
       'time wasting loop here
       loop

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Hyperactive Member Bananafish's Avatar
    Join Date
    Jan 2001
    Posts
    394
    Thanks for the reply, but I think I must be missing something.

    Surely that code would just process module_backgroundTask twice - all the way through. and not in the background.

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    you're right, sorry I mis-read the question.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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