Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #5092 > unrolled thread
| Started by | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| First post | 2013-04-19 08:14 +0000 |
| Last post | 2013-04-19 12:39 -0400 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
COM components and events "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2013-04-19 08:14 +0000
Re: COM components and events Carlos Rocha <carlos.rocha@doossier.com.removethis> - 2013-04-19 14:22 +0100
Re: COM components and events "Dirk Herijgers" <dirk.at.@triviant.dot.be> - 2013-06-10 19:49 +0000
Re: COM components and events Carlos Rocha <jazzda1307@gmail.com> - 2013-06-10 15:20 -0700
Re: COM components and events "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2013-06-11 11:27 +0000
Re: COM components and events Carlos Rocha <jazzda1307@gmail.com> - 2013-06-11 09:48 -0700
Re: COM components and events "Jamal" <jamal@examples.net> - 2013-04-19 12:39 -0400
| From | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| Date | 2013-04-19 08:14 +0000 |
| Subject | COM components and events |
| Message-ID | <kkque0$542$1@dont-email.me> |
Hi All, Does anyone knows how to get events from a com-object ? I hope the question is clear... Dirk, Belgium --
[toc] | [next] | [standalone]
| From | Carlos Rocha <carlos.rocha@doossier.com.removethis> |
|---|---|
| Date | 2013-04-19 14:22 +0100 |
| Message-ID | <kkrgeu$aib$1@speranza.aioe.org> |
| In reply to | #5092 |
On Friday, April 19, 2013 9:14:56 AM UTC+1, Dirk (Belgium) wrote:
>
> Does anyone knows how to get events from a com-object ?
> I hope the question is clear...
I use VB6 for that:
1. Create an new ActiveX project (named MyComServer or whatever)
2. Create a new UserControl (named MyObject or whatever)
3. Write something like this in the UserControl code:
'---------------------------------------------------------------
Option Explicit
'----------------------- Declare the events you need as public
Public Event MyEvent(ByVal s as String, ByRef b as Boolean)
'------------------------ Declare the COM object as private
Private WithEvents oComObject as ComServer.ComObject '//Word.Application
´-------------------------- Function to initialize the object
'-------------------------- create with VO
Public Function SetComObject(oObject as ComServer.ComObject)
Set oComObject = oObject
End Function
'-------------------------------- ComServer.ComObject Events
Private Sub oComObject_SomeEvent(ByVal s as String, ByRef b as Boolean)
RaiseEvent MyEvent(s, b) '// Delegate the event to VO
End Sub
´------------------------------------ That's all
--
Carlos Rocha
[toc] | [prev] | [next] | [standalone]
| From | "Dirk Herijgers" <dirk.at.@triviant.dot.be> |
|---|---|
| Date | 2013-06-10 19:49 +0000 |
| Message-ID | <kp5al5$kpa$1@dont-email.me> |
| In reply to | #5093 |
Carlos, I don't understand how any event is comming into VO ? Could you explain this a little more ? Dirk ================================================ Carlos Rocha wrote: > On Friday, April 19, 2013 9:14:56 AM UTC+1, Dirk (Belgium) wrote: > > > > Does anyone knows how to get events from a com-object ? > > I hope the question is clear... > > I use VB6 for that: > > 1. Create an new ActiveX project (named MyComServer or whatever) > 2. Create a new UserControl (named MyObject or whatever) > 3. Write something like this in the UserControl code: > > '--------------------------------------------------------------- > Option Explicit > > '----------------------- Declare the events you need as public > Public Event MyEvent(ByVal s as String, ByRef b as Boolean) > > '------------------------ Declare the COM object as private > Private WithEvents oComObject as ComServer.ComObject > '//Word.Application > > ´-------------------------- Function to initialize the object > '-------------------------- create with VO Public Function > SetComObject(oObject as ComServer.ComObject) Set oComObject = > oObject End Function > > '-------------------------------- ComServer.ComObject Events > Private Sub oComObject_SomeEvent(ByVal s as String, ByRef b as > Boolean) RaiseEvent MyEvent(s, b) '// Delegate the event to VO > End Sub > > ´------------------------------------ That's all --
[toc] | [prev] | [next] | [standalone]
| From | Carlos Rocha <jazzda1307@gmail.com> |
|---|---|
| Date | 2013-06-10 15:20 -0700 |
| Message-ID | <c643cd05-33c3-4f9e-91dc-9dc0a389105f@googlegroups.com> |
| In reply to | #5345 |
On Monday, June 10, 2013 8:49:57 PM UTC+1, Dirk Herijgers wrote:
> I don't understand how any event is comming into VO ?
> Could you explain this a little more ?
I I understood you well, you have an Automation Object, not an ActiveX Control (ocx), and VO can't receive events from Automation Objects, is this right?
If so, one way to receive these events is to create an ActiveX Control (ocx) in VB6 that holds your object and delegate their events to VO. From VO side it works like any other ocx.
Let's say you generate your Com Object class using VO "Automation Server..." wizard and named it ComObject.
now you should generate the VB6 control using "Setup OLE Control...". Let's say you name it OcxObject.
//----------------------------------------------
method Init(oOwner) class MyWindow
local oComObject as ComObject // the Automation object
local oOcxObject as OcxObject // the ActiveX control
oComObject := ComObject{}
oOcxObject := OcxObject{self, -1}
oOcxObject:HyperLabel{#OcxObject, null_string, null_string, null_string}
oOcxObject:CreateEmbedding("MyComServer.MyObject")
// pass the ComObject to the VB6 control
oOcxObject:SetComObject(oComObject)
return self
//-----------------------------------------------
From now on you will receive the event "SomeEvent" in the corresponding method:
// -----------------------------------------------
method OcxObjectSomeEvent(s, b) class MyWindow
// do whatever you need here
return nil
//------------------------------------------------
Note the VO event naming convention: the symbol passed to Hyperlabel call (#OcxObject) plus the event name (SomeEvent)
I hope it's clear enough
__
Carlos
[toc] | [prev] | [next] | [standalone]
| From | "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> |
|---|---|
| Date | 2013-06-11 11:27 +0000 |
| Message-ID | <kp71iv$mk4$1@dont-email.me> |
| In reply to | #5347 |
Carlos,
Where did you find this ?
Is there a place in the SDK where you can find the combined OCX+EVent ?
Is there some more help about this ?
Dirk
===================
Carlos Rocha wrote:
> On Monday, June 10, 2013 8:49:57 PM UTC+1, Dirk Herijgers wrote:
>
> > I don't understand how any event is comming into VO ?
> > Could you explain this a little more ?
>
> I I understood you well, you have an Automation Object, not an
> ActiveX Control (ocx), and VO can't receive events from Automation
> Objects, is this right?
>
> If so, one way to receive these events is to create an ActiveX
> Control (ocx) in VB6 that holds your object and delegate their events
> to VO. From VO side it works like any other ocx.
>
> Let's say you generate your Com Object class using VO "Automation
> Server..." wizard and named it ComObject.
>
> now you should generate the VB6 control using "Setup OLE Control...".
> Let's say you name it OcxObject.
>
> //----------------------------------------------
> method Init(oOwner) class MyWindow
> local oComObject as ComObject // the Automation object
> local oOcxObject as OcxObject // the ActiveX control
>
> oComObject := ComObject{}
>
> oOcxObject := OcxObject{self, -1}
> oOcxObject:HyperLabel{#OcxObject, null_string, null_string,
> null_string} oOcxObject:CreateEmbedding("MyComServer.MyObject")
>
> // pass the ComObject to the VB6 control
> oOcxObject:SetComObject(oComObject)
>
> return self
> //-----------------------------------------------
>
> From now on you will receive the event "SomeEvent" in the
> corresponding method:
>
> // -----------------------------------------------
> method OcxObjectSomeEvent(s, b) class MyWindow
> // do whatever you need here
> return nil
> //------------------------------------------------
>
> Note the VO event naming convention: the symbol passed to Hyperlabel
> call (#OcxObject) plus the event name (SomeEvent)
>
> I hope it's clear enough
>
> __
> Carlos
--
[toc] | [prev] | [next] | [standalone]
| From | Carlos Rocha <jazzda1307@gmail.com> |
|---|---|
| Date | 2013-06-11 09:48 -0700 |
| Message-ID | <420f8da5-751e-4dab-a905-eac780b71a3f@googlegroups.com> |
| In reply to | #5349 |
On Tuesday, June 11, 2013 12:27:27 PM UTC+1, Dirk (Belgium) wrote: > Where did you find this ? > Is there a place in the SDK where you can find the combined OCX+EVent ? > Is there some more help about this ? Now that you said that...I have no idea. Maybe if you put an Ocx Control in the window designer you are able to generate events code, but I never tried that. -- Carlos
[toc] | [prev] | [next] | [standalone]
| From | "Jamal" <jamal@examples.net> |
|---|---|
| Date | 2013-04-19 12:39 -0400 |
| Message-ID | <kkrs0l$dno$1@speranza.aioe.org> |
| In reply to | #5092 |
Hi Dirk, Please clarify further. Is this for an Ole Object (ActiveX) you inserted on a Window and you want to the events to fire up when doing various operations with Ole Control? You must of course know the event name as per the com object (ActiveX) as per its documentation. If so, I can help and it is easy. If not, I am not sure. Jamal "Dirk (Belgium)" wrote in message news:kkque0$542$1@dont-email.me... Hi All, Does anyone knows how to get events from a com-object ? I hope the question is clear... Dirk, Belgium --
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web