Results 1 to 7 of 7

Thread: threaded Programming

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    46

    Question threaded Programming

    Is it possible to do thread programming in vb as we do in java.

    Actully I have to generate doc document as a report. but it is taking very long time for which application get halted.

    only if i can run this process as back ground process. user cab be able to do some thing else.

    also is there any way user can halt this on going process in between .

    thanks in advance

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    True Multithreading in VB6 is a pain.. although i tried a lot of APIs for doing this.. but cudn't succeed.. there is an api named createThread but it doesn't seem to work...
    to prevent halting u can use DoEvents keyword in the code where u are generating document. Also u can have a global variable.. whose value u will change when user clicks on CANCEL button.. and in the generation code u check it's value if it's changed cancel the process...
    This is a workaround only..

  3. #3
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    put the code of generating the document in the timer control event.
    The first line shd disable the timer so that it does not occur again
    also the globla variable can exit the procedure

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    46
    and how can we handle interupts

  5. #5
    Hyperactive Member FATBOYPEE's Avatar
    Join Date
    May 2001
    Location
    Charleville (Ireland) Still. ANYONE GOT A JOB I CAN HAVE ? GIZA JOB. I CAN DO THAT....
    Posts
    463
    VB can do multithreadding. Not well, but it can do it using ActiveX EXE's.

    Peeman.

    Best Bar.....

  6. #6
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    For interrupts( if u want to cancel the report before its completed)
    Make a property of the form ( which is got the timer)

    and maybe in another form where u have the cancel button or maybe on the same form (in which u neednt make a property)

    Well, keep a form level variable say blnCancel, keep this false and on click of the cancel then make it true....in the code which u r running just keep checking for the value of this variable and exit the sub if its true

  7. #7
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    Originally posted by veryjonny
    put the code of generating the document in the timer control event.
    Timer control doesn't provide multithreading.. check it....

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