Results 1 to 2 of 2

Thread: Multi Threading in vb6

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    1

    Multi Threading in vb6

    Hi All,

    Was wondering if anyone could help me with this, I have an activeX Exe that was called from one standard exe. In standard Exe i instantiated that activex exe two times by using new keyword.

    In that activex exe i used a loop that will take 7 seconds. while running the standard exe i observed that the two activex exe are not running simultaneously. how can i run the two activex exe simultaneously.

    below i am giving the vb code.

    standard exe:

    VB Code:
    1. Private WithEvents objEx As ex.clsMain
    2. Private WithEvents objEx2 As ex.clsMain
    3.  
    4. Private Sub Form_Load()
    5.     Set objEx = New ex.clsMain
    6.     Set objEx2 = New ex.clsMain
    7.    
    8.     objEx.doProcess
    9.     objEx2.doProcess
    10.    
    11.     Set objEx = Nothing
    12.     Set objEx2 = Nothing
    13. End Sub

    Active X Exe:

    VB Code:
    1. option explicit
    2. Public Sub doProcess()
    3.     Dim objFile As FileSystemObject
    4.     Dim stext As TextStream
    5.     Dim i, j As Long
    6.     i = 0
    7.     j = 0
    8.    
    9.     Set objFile = New Scripting.FileSystemObject
    10.     Set stext = objFile.OpenTextFile("D:\log.txt", ForAppending, True, TristateUseDefault)
    11.     stext.WriteLine "------------------------------"
    12.     stext.WriteLine " this is for testing "
    13.     stext.WriteLine "------------------------------"
    14.     stext.WriteLine "Start Time : " & Time
    15.     While i < 90000000
    16.         While j < 9000000
    17.         j = j + 1
    18.         Wend
    19.         i = i + 1
    20.     Wend
    21.     stext.WriteLine "End Time : " & Time
    22.     stext.Close
    23.     Set stext = Nothing
    24.     Set objFile = Nothing
    25.    End Sub

    Regards,
    Naveen

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Multi Threading in vb6

    A CPU cannot run 2 processeses at the same time. It's not really clear what you need to do.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

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