Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
Visual Basic 6 Problem
Old
  (#1)
Darren Brook
Guest
 
Posts: n/a
Default Visual Basic 6 Problem - 06-04-2007, 10:32 AM

Does anyone know how to create an ActiveX EXE Server that raises events
which can be captured by muliple clients?

So, I have two applications that are both clients. I need to p*** data via
the activex exe from one application to the other. The messages will be
"captured" as in the event handler, the code will check one of the
paramaters that contains a simple string that represents the recipients
"address" (these strings could be just "App1" and "App2".

I've tried to do this but it only raises the event in the application that
is sending the message. I need the event to be raised in both applications.

I have the ActiveX EXE properties set to "MultiUse" and using a Thread Pool
of 1.

Any help or advice would be very welcome as this is really causing me some
problems.

Many thanks,
Darren

--
Darren Brook
email: EMAIL REMOVED








   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Visual Basic 6 Problem
Old
  (#2)
Dikkie Dik
Guest
 
Posts: n/a
Default Re: Visual Basic 6 Problem - 06-04-2007, 10:32 AM

Because of the troubles with "built-in" events, I switched to using
java-style events: The server defines an interface that standardizes the
sending and/or receiving of the messages. The clients then have objects
that implement that interface, which are handed to the server. The
server now communicates through those objects.

Best regards

Darren Brook wrote:
> Does anyone know how to create an ActiveX EXE Server that raises events
> which can be captured by muliple clients?
>
> So, I have two applications that are both clients. I need to p*** data via
> the activex exe from one application to the other. The messages will be
> "captured" as in the event handler, the code will check one of the
> paramaters that contains a simple string that represents the recipients
> "address" (these strings could be just "App1" and "App2".
>
> I've tried to do this but it only raises the event in the application that
> is sending the message. I need the event to be raised in both applications.
>
> I have the ActiveX EXE properties set to "MultiUse" and using a Thread Pool
> of 1.
>
> Any help or advice would be very welcome as this is really causing me some
> problems.
>
> Many thanks,
> Darren
>

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Visual Basic 6 Problem
Old
  (#3)
Darren Brook
Guest
 
Posts: n/a
Default Re: Visual Basic 6 Problem - 06-04-2007, 10:33 AM

When you said "troubles with built-in events", what did you mean?

Thanks,
Darren

"Dikkie Dik" <EMAIL REMOVED> wrote in message
news:4579b32f$0$8902$EMAIL REMOVED...
> Because of the troubles with "built-in" events, I switched to using
> java-style events: The server defines an interface that standardizes the
> sending and/or receiving of the messages. The clients then have objects
> that implement that interface, which are handed to the server. The server
> now communicates through those objects.
>
> Best regards
>
> Darren Brook wrote:
>> Does anyone know how to create an ActiveX EXE Server that raises events
>> which can be captured by muliple clients?
>>
>> So, I have two applications that are both clients. I need to p*** data
>> via
>> the activex exe from one application to the other. The messages will be
>> "captured" as in the event handler, the code will check one of the
>> paramaters that contains a simple string that represents the recipients
>> "address" (these strings could be just "App1" and "App2".
>>
>> I've tried to do this but it only raises the event in the application
>> that
>> is sending the message. I need the event to be raised in both
>> applications.
>>
>> I have the ActiveX EXE properties set to "MultiUse" and using a Thread
>> Pool
>> of 1.
>>
>> Any help or advice would be very welcome as this is really causing me
>> some
>> problems.
>>
>> Many thanks,
>> Darren
>>



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Visual Basic 6 Problem
Old
  (#4)
Steve Gerrard
Guest
 
Posts: n/a
Default Re: Visual Basic 6 Problem - 06-04-2007, 10:33 AM


"Darren Brook" <EMAIL REMOVED> wrote in message
news:EMAIL REMOVED...
> Does anyone know how to create an ActiveX EXE Server that raises events
> which can be captured by muliple clients?
>


I could post the sample code, but you might as well look at the article
yourself.
This is a link to Sharing the CoffeeMonitor, which is step 7 in the VB tutorial
on Creating an Activex Exe Component.

http://msdn.microsoft.com/library/en...feemonitor.asp

In summary, it says:

For two apps to both receive the events, they must get a reference to a shared
object, not each create their own new object.

To do this, you create a Connector cl***. Each app creates its own Connector
object, and the connector has a method for getting a reference to the one shared
RealCl*** object (the CoffeeMonitor in the example).

The real object is created when the first connector is created, and terminated
when the last connector is terminated. It is set to PublicNotCreatable, so that
each app is forced to use the Connector to get to it.

In each app, the code looks something like

Dim WithEvents RealObj As RealCl***
Dim Conn As Connector
Set Conn = New Connector
Set RealObj = Conn.RealObject



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Visual Basic 6 Problem
Old
  (#5)
Ralph
Guest
 
Posts: n/a
Default Re: Visual Basic 6 Problem - 06-04-2007, 10:33 AM


"Darren Brook" <EMAIL REMOVED> wrote in message
news:EMAIL REMOVED...
> Does anyone know how to create an ActiveX EXE Server that raises events
> which can be captured by muliple clients?
>
> So, I have two applications that are both clients. I need to p*** data

via
> the activex exe from one application to the other. The messages will be
> "captured" as in the event handler, the code will check one of the
> paramaters that contains a simple string that represents the recipients
> "address" (these strings could be just "App1" and "App2".
>
> I've tried to do this but it only raises the event in the application that
> is sending the message. I need the event to be raised in both

applications.
>
> I have the ActiveX EXE properties set to "MultiUse" and using a Thread

Pool
> of 1.
>
> Any help or advice would be very welcome as this is really causing me some
> problems.
>
> Many thanks,
> Darren
>


Well there is always DDE. It is somewhat out of favor, but is built into VB
and very simple to implement.

-ralph


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Visual Basic 6 Problem
Old
  (#6)
Dikkie Dik
Guest
 
Posts: n/a
Default Re: Visual Basic 6 Problem - 06-04-2007, 10:33 AM

> When you said "troubles with built-in events", what did you mean?

Sometimes, they just don't fire. When single stepping through the code,
the RaiseEvent command is executed and there is a WithEvents variable
containing an object that should catch it, but nothing is caught. I
could not extract a pattern in when it does work, or when it doesn't.
Mind you, this only happens (so far) when trying to catch events from
objects from another project.


Best regards
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top