And here an example of use:
__axRegisterHandler( o:__hObj, {| ... | MsgInfo( ... ) } )
And here an example of use:
__axRegisterHandler( o:__hObj, {| ... | MsgInfo( ... ) } )
Antonio,
The topic was posted sometime in 2008. ![]()
Sounds great that it is there, but I'm getting a link error
.
What is the library file and where to get the MyInclude.ch?
BTW I used it this way: oOle:=OleWEvent():New(cProgId)
Regards, Saludos
Jose
Jose,
As I have explained, it seems as you don't need that library at all ![]()
Simply try to use this:
__axRegisterHandler( o:__hObj, {| ... | MsgInfo( ... ) } )
Antonio,
I didn't notice the info on the second page. I tried to follow the code in the prg sample.
But my application terminated after the Alert("here")
Error -2147220992 WINOLE/1014 Failed to obtain connection point: __AXREGISTERHANDLER Args: (P:0x484EA9C) (B:{|| ... })
Thanks,
Jose
Method Instantiate_Device(cProgID) class OPOSHardwareInterface
local oOle:='',n
::lDeviceInstantiated:=.f.
oOle:=CreateObject(cProgID)
if valtype(oOle)='O'
::lDeviceInstantiated:=.t.
alert('Here')
__axRegisterHandler( oOle:__hObj, {| a,b,c | MsgInfo( 'Test') }) && What are the parameters of the codeblock?
aadd(::aoDevices,oOle)
* aadd(::aoDevices,oOle:oOleAuto)
endif
return oOle
Please check this value:
MsgInfo( oOle:__hObj )
and let me know it
The valtype (oOle:__hObj) is P
The value differs as shown below.
OS Error -2147220992 WINOLE/1014 Failed to obtain connection point: __AXREGISTERHANDLER Args: (P:0x2CDAD04)
OS Error -2147220992 WINOLE/1014 Failed to obtain connection point: __AXREGISTERHANDLER Args: (P:0x30DA6CC)
What are the parameters of the codeblock?
Antonio,
What is cIID?
If cIID is the ole program ID (cProgID in my code) then I tried that and my up terminated.
error: WINOLE/1014 Failed to obtain connection point: __AXREGISTERHANDLER Args: (P:0x473A43C) (B:{|| ... }) (C:OPOS.POSPrinter)
Thanks,
Jose
Jose,
have you started the cIID with '{' ?
It must start with '{' and end with "}"
Hi Antonio,
What is {cIID}? A new syntax? Looks like an array..
Anyway I tried both as shown below and still resulted to the same error
Thanks,
Jose
Method Instantiate_Device(cProgID) class OPOSHardwareInterface
local oOle:='',n,cIID
::lDeviceInstantiated:=.f.
oOle:=CreateObject(cProgID)
if valtype(oOle)='O'
::lDeviceInstantiated:=.t.
alert(valtype(oOle:__hObj))
alert('Here')
*__axRegisterHandler( oOle:__hObj, {| ...| MsgInfo( 'Test') },{cProgID}) && What are the parameters of the codeblock?
__axRegisterHandler( oOle:__hObj, {| ...| MsgInfo( 'Test') },{cIID}) && What are the parameters of the codeblock?
alert('Done')
aadd(::aoDevices,oOle)
* aadd(::aoDevices,oOle:oOleAuto)
endif
return oOle
Antonio,
Do I need to include the oleWEvents0.c and oLeWEvents.prg to my App?
Thanks,
Jose
cIID
Specifies the Interface ID GUID of cCLSID | cPROGID when you create an early bound instance of the class. If you pass an empty string as cIID Visual FoxPro attempts to access the default interface (IID) of cCLSID | cPROGID.
Example
x = CREATEOBJECTEX("excel.application","",;
"{000208D5-0000-0000-C000-000000000046}")
Method Instantiate_Device(cProgID) class OPOSHardwareInterface
local oOle:='',n
local ciid:='{B196B284-BAB4-101A-B69C-00AA00341D07}' Â && <-- IconnectionPointContainer
::lDeviceInstantiated:=.f.
oOle:=CreateObject(cProgID)
if valtype(oOle)='O'
  ::lDeviceInstantiated:=.t.
if cprogid='OPOS.POSPrinter'
alert(ciid)
__axRegisterHandler( oOle:__hObj, {| ...| MsgInfo( 'Test') },ciid) && <-- IconnectionPointContainer
alert('Handler registered')
endif
  aadd(::aoDevices,oOle)
endif
return oOleAntonio,
I agree, this might be beyond Harbour as Carlos was successful using this function with a different OLE service.
Or may be it's just the version of my compiler.
I am still using Harbour 2.1. I checked the logs and there was many changes related to axcore.c to date. I hope one of these changes fixed this issue..
Thank you for your support. I appreciate it.
Saludos,
Jose