Page 1 of 2
TActiveX:SetProp()
Posted: Tue Jul 24, 2007 8:33 pm
by reinaldocrespo
Hi.
I'm having a problem setting one specific property to an ocx I'm using. All else works just fine.
From the OCX guide, the property data type is described as:
VARIANT=> Variant type (C/C++ type OLEVARIANT, Delphi type OleVariant, VB
type Variant (default type))
...And can be assigned to the .AcmFormat property directly, e.g.:
ocx.AcmFormat = "31000100401f0000590600004100000002004001"
On my fwh code I'm assigning this way:
Code: Select all
cAcmString := "55000100c05d0000b80b0000010000000c00010002000000480001007105"
::oActiveX:SetProp( "AcmFormat", cAcmString )
But it does not seem to work. After the property has been set (with the code above), when quering it I get back Nil which is the default value before it is set.
Can anyone help with this one?
Reinaldo.
Posted: Tue Jul 24, 2007 10:23 pm
by Antonio Linares
Reinaldo,
have you tried to assign a shorter string, just for a test ?
::oActiveX:SetProp( "AcmFormat", "123" )
Posted: Tue Jul 24, 2007 10:56 pm
by reinaldocrespo
Antonio;
Yes, I have. Nothing gets assigned. I think it has to do with the Variant data type that is expected.
Reinaldo.
Posted: Wed Jul 25, 2007 11:17 am
by Antonio Linares
Reinaldo,
Are you using harbour or xharbour ?
Posted: Wed Jul 25, 2007 12:45 pm
by reinaldocrespo
xharbour.
Posted: Wed Jul 25, 2007 1:22 pm
by Antonio Linares
Reinaldo,
Please do this: tlib fivehc.lib - ole.obj
and try it again
Posted: Wed Jul 25, 2007 1:42 pm
by reinaldocrespo
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_OLEGETPROPERTY' referenced from F:\FWH_2.7\LIB\FIVEHC.LIB|ACTX
Error: Unresolved external '_HB_FUN_OLESETPROPERTY' referenced from F:\FWH_2.7\LIB\FIVEHC.LIB|ACTX
Error: Unresolved external '_HB_FUN_OLEINVOKE' referenced from F:\FWH_2.7\LIB\FIVEHC.LIB|ACTX
Reinaldo.
Posted: Wed Jul 25, 2007 2:00 pm
by Antonio Linares
Reinaldo,
Please try this:
Code: Select all
function OleGetProperty( hObj, cPropName )
local o := TOleAuto()
o:hObj = hObj
return __ObjSendMsg( o, cPropName )
function OleSetProperty( hObj, cPropName, uValue )
local o := TOleAuto()
o:hObj = hObj
return __ObjSendMsg( o, "_" + cPropName, uValue )
function OleInvoke()
MsgInfo( "not implemented yet" )
return nil
Posted: Wed Jul 25, 2007 2:20 pm
by reinaldocrespo
I see what you are trying to do. But I'm using fwh Tactivex class. Now this piece of code fails.
Code: Select all
TRY
::oActiveX := TActiveX():New( ::oWnd, "MSSR300.MSSR300Ctrl.1" )
END
I get the msginfo "not implemented yet".
Reinaldo.
Posted: Wed Jul 25, 2007 2:49 pm
by Antonio Linares
Reinaldo,
Please make this change to force an error and see where OleInvoke() is called from, thanks
Code: Select all
function OleInvoke()
x++
return nil
Posted: Wed Jul 25, 2007 3:13 pm
by reinaldocrespo
I did this instead:
Code: Select all
function OleInvoke()
local x
x++
return nil
Got this:
Application
===========
Path and name: F:\mp\PathLabs.exe (32 bits)
Size: 3,274,752 bytes
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 07/25/2007, 11:11:18
Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = U
[ 2] = N 1
Stack Calls
===========
Called from: => ACTXINVOKE(795)
Called from: ACTIVEX.PRG => TACTIVEX:DO(0)
Reinaldo.
Posted: Wed Jul 25, 2007 3:17 pm
by Antonio Linares
Reinaldo,
Don't you get more calls previous to ?
Called from: ACTIVEX.PRG => TACTIVEX:DO(0)
Posted: Wed Jul 25, 2007 3:22 pm
by reinaldocrespo
No. That's an actual cut and paste from the error.log file.
Here is the complete list:
Application
===========
Path and name: F:\mp\PathLabs.exe (32 bits)
Size: 3,274,752 bytes
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 07/25/2007, 11:11:18
Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = U
[ 2] = N 1
Stack Calls
===========
Called from: => ACTXINVOKE(795)
Called from: ACTIVEX.PRG => TACTIVEX:DO(0)
Called from: tVoiceRec.prg => TMSSR300:INIT(57)
Called from: tVoiceRec.prg => TVOICEREC:NEW(163)
Called from: => DOACCNTSBRWSER(1154)
Called from: pathlogn.prg => ACCNTSBRWSER(1075)
Called from: main.prg => (b)FRAMEBAR(377)
Called from: tsbutton.prg => TSBUTTON:CLICK(804)
Called from: CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: tsbutton.prg => TSBUTTON:HANDLEEVENT(1308)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: main.prg => START(80)
Nothing else.
Reinaldo.
Posted: Wed Jul 25, 2007 3:48 pm
by Antonio Linares
Reinaldo,
What source code do you have here ?
tVoiceRec.prg => TMSSR300:INIT(57)
Try to comment it out, if possible
Posted: Wed Jul 25, 2007 3:59 pm
by reinaldocrespo
Antonio,
Application
===========
Path and name: F:\mp\PathLabs.exe (32 bits)
Size: 3,274,752 bytes
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 07/25/2007, 11:53:28
Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = U
[ 2] = N 1
Stack Calls
===========
Called from: => ACTXINVOKE(789)
Called from: ACTIVEX.PRG => TACTIVEX:DO(0)
Called from: tVoiceRec.prg => TMSSR300:INIT(57)
Called from: tVoiceRec.prg => TVOICEREC:NEW(164)
Called from: => DOACCNTSBRWSER(1154)
Line 57 is:
But remember that I included:
Code: Select all
function OleInvoke()
local x
x++ //<== this is line 789
return nil
Please allow me to send you the ocx with its documentation and sample code for your testing. I can create a very small .prg sample code.
Reinaldo.