Results 1 to 9 of 9

Thread: CreateObject events?

  1. #1

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    CreateObject events?

    If I have an ActiveX dll which is NOT registered, I can dynamically register it with GetProcAddress, CreateTread etc.

    In the form I declare:
    Private MynDll as Object

    Set MynDll=CreateObject(class)

    Is there a simple solution to handle events from this dll?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: CreateObject events?

    Err, not really. It would be fairly complex I think. What information about the class do you have?

  3. #3

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: CreateObject events?

    Won't compile because of "User-defined type not defined". This is because the dll is not registered.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: CreateObject events?

    Quote Originally Posted by namrekka
    Won't compile because of "User-defined type not defined". This is because the dll is not registered.
    This maybe a silly question, but why don't you just register it?

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: CreateObject events?

    I don't think there is a simple way to do it no. You would probably have to use the COM API's.

  6. #6

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: CreateObject events?

    I want to use plugins in myn applications. Every plugin is a machine connected to myn application. The dll's I made meself and contains a communication protocoll. The application reads a plugin folder. The user can make a choise of a machine. The advantage of not registering is that you can add machines (plugins) dynamically. It works now without events so I have to use polling if the machines have data.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: CreateObject events?

    For that purpose I would use message callbacks instead (which is basically what COM events are anyway). It should work fine since the objects are loaded into your thread. Have a predefined set of messages that you can send, including some messages that enable the plugin to register more messages for plugin-specific capability

    You would need a MsgProc or something in a standard module, like a WinAPI callback, and pass the address of that to your object when you create it, so it knows where to send the message. You can use CallWindowProc from the plugin (if it is VB without function pointers) to call it, and then it needs to have 4 parameters to match the CallWindowProc declaration.

  8. #8

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: CreateObject events?

    Mmm...

    Callbacks can be an option. It's not simple. I will take some books from shelf and study.

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: CreateObject events?

    It is simpler than using API's to get COM interfaces etc.

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