|
-
Sep 20th, 2005, 06:32 AM
#1
Thread Starter
Fanatic Member
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?
-
Sep 20th, 2005, 06:52 AM
#2
Re: CreateObject events?
Err, not really. It would be fairly complex I think. What information about the class do you have?
-
Sep 20th, 2005, 06:54 AM
#3
Thread Starter
Fanatic Member
Re: CreateObject events?
Won't compile because of "User-defined type not defined". This is because the dll is not registered.
-
Sep 20th, 2005, 07:04 AM
#4
Re: CreateObject events?
 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?
-
Sep 20th, 2005, 07:06 AM
#5
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.
-
Sep 20th, 2005, 07:13 AM
#6
Thread Starter
Fanatic Member
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.
-
Sep 20th, 2005, 07:23 AM
#7
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.
-
Sep 20th, 2005, 07:30 AM
#8
Thread Starter
Fanatic Member
Re: CreateObject events?
Mmm...
Callbacks can be an option. It's not simple. I will take some books from shelf and study.
-
Sep 20th, 2005, 07:33 AM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|