Results 1 to 4 of 4

Thread: ActiveX exe object question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    BC, Canada
    Posts
    142
    I made a simple ActiveX exe to do a time consuming task, ie printing.

    I made an ActiveX exe class MyClass with a function called LongtimeTask(). The ActiveX Object is set for Multiusers.

    In my client code, I have following code

    Code:
     Private MyObj As Object
     
     Private Sub Form_Click()
    
          Set MyObj = CreateObject("MyProject.MyClass")
          MyObj.LongtimeTask  'takes long time!!!
          Print MyObj.MyString
       End Sub
    When I run the code, only after "MyObj.LongtimeTask" function is finished, the next line code "Print MyObj.Mystring" is executed. It performs like a single thread process. What could be wrong? What I want is to start LongtimeTask and immediately return to client code to execute next line code.

    This is my first try making ActiveX exe, Thanks for your help!



  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    I didn't think it worked like that.

    I went through all the coffeepot / coffee monitor examples in MSDN and it seemed to work by making your activex exe look after the longtime job by calling it from another app (which you can do at design time by referencing the project) the activex Exe starts up when it's object is created and runs as a separate process.

    if you created it 'WithEvents' then you can design the activex exe to inform you when it's finished by raing an even.

    It's basically an object server and whether it startes up as a new process each time or runs them together depends out how it's set up. single use means it'll start a new instance each time it's called rather than pass objects to multi users.

    It's been a while since I read it but if you go through all the async comunication section of the coffe monitor example it's all explained in hideous detail



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    BC, Canada
    Posts
    142

    OLE question or multi-threading question?

    Thanks Paul282 for your help. I just downloaded Coffee sample from MSDN and will have a look.

    As stated in my previous question, my intention is to make a seperate process( to do time consuming thing) from the client program (no return msg necessary). It is exactly a OLE call and immediately do something else without waiting for callback. How can I do it? thanks again

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    BC, Canada
    Posts
    142

    problem solved

    I found the answer, Asynchronous processing
    Thanks

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