Results 1 to 3 of 3

Thread: AddressOf Problem In VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    4

    Red face

    I am writing a program that passes an AddressOf to a dll. The dll interfaces between my program and some attached hardware. When the hardware issues an event the AddressOf function is called. When I try to access any other function or variable the program crashes. Microsoft has stated that the cause of the crash is due to an access violation. The calling dll creates a new thread and then calls the AddressOf function ergo the access violation. Article ID Q198607 explains it. Now I have contacted the manufacturer and they say its Microsoft's problem. It use to work in VB5 but no longer in VB6. I for one think it should work in VB6 but until that comes to pass I'm stuck.

    Has anyone come across this problem and solved it? I don't want to write the system in C++.

    I need a response in a hurry.

    Many Thanks!

    Jerry

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Where is your Function, Is it Definatly Public in a standard module, also check that all your parameters are declared correctly byVal or ByRef.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    4

    Where is your Function, Is it Definatly Public in a standard module, also check that all your parameters are declared correctly byVal or ByRef.
    I did everything correct. VB6 supports only Apartment threads and Microsoft has probably tightened this area up and therefor the access violation. I was told it works in VB5.

    I need a workaround. For example Microsoft says put all the external calls the Callback makes in a Type Library. However, the say this is a prossible fix. I'm not sure what they mean. They also suggest compiling th eproject to P-Code which I tried with no success.

    So I need to know if anyone has come across this problem and did they develop a workaround.

    Basically VB6 does AddressOf but you had better not call it from another thread. So if soemone developed a dll and it uses callbacks then they cannot use threads.

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