CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2000
    Location
    Belgium, Bruges
    Posts
    146

    Waiting untill a function ends

    hi,

    i have a program in which i have to send several mails. so i have a for loop with the function "send". Now i would like to say that the loop has to wait untill the previous send has finished. Can i do this.

    In other words is there an opposit function to DoEvents?

    Thanx


  2. #2
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163

    Re: Waiting untill a function ends

    Try the following API's:

    private Declare Function OpenProcess Lib "kernel32" (byval dwDesiredAccess as Long, byval bInheritHandle as Long, byval dwProcessId as Long) as Long
    private Declare Function WaitForSingleObject Lib "kernel32" (byval hHandle as Long, byval dwMilliseconds as Long) as Long
    private Const SYNCHRONIZE = &H100000
    private Const INFINITE = &HFFFF





  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Waiting untill a function ends

    Function MyFunc()
    Dim myObject As Object
    Dim RetVal As Variant

    Set myObject = CreateObject("WScript.Shell")
    RetVal = myObject.Run("c:\windows\notepad.exe", 1, True)
    MsgBox "Notepad is closed"

    End Function


    'TRue - wait until proc is over
    'False don't wait

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [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