As to catch return of oActiveX:Do

As to catch return of oActiveX:Do

Postby vilian » Fri Jul 27, 2007 7:39 pm

hi,

I need to catch the return of the following command:

oActiveX:Do("TerSearchReplace2","rich","",SRCH_SEARCH,N,0)

According to documentation of the TerSearchReplace2 component would have to return a numerical value.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Fri Jul 27, 2007 8:25 pm

Vilian,

Try:

MsgInfo( oActiveX:Do("TerSearchReplace2","rich","",SRCH_SEARCH,N,0) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Fri Jul 27, 2007 8:29 pm

Antonio,

Already I tried thus and is returning NIL.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » Mon Jul 30, 2007 6:45 pm

Antonio,

Studying activex.prg with the aid of the Gilmer, we perceive that the Do() method treats only 4(four) parameters. But necessary TerSearchReplace2 of 5(five). We try to make thus:

nPos := ActXInvoke( ActXPdisp( oActiveX:hActiveX ),"TerSearchReplace2","rich","",SRCH_SEARCH,N,0)

But also it did not function. You can help me?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Jul 31, 2007 7:43 am

Vilian,

Are you using Harbour or xHarbour ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Tue Jul 31, 2007 11:18 am

Antonio,

I use xHarbour.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Jul 31, 2007 12:01 pm

Vilian,

Please do this: tlib fivehc.lib - ole.obj

then add these functions to your app:
Code: Select all  Expand view
function OleGetProperty( hObj, cPropName )

   local o := TOleAuto()
   local uRet

   o:hObj = hObj
   uRet = __ObjSendMsg( o, cPropName )
   o:hObj = nil

return uRet

function OleSetProperty( hObj, cPropName, uValue )

   local o := TOleAuto()
   local uRet

   o:hObj = hObj
   uRet = __ObjSendMsg( o, "_" + cPropName, uValue )
   o:hObj = nil

return uRet

function OleInvoke( hObj, cMethName, ... )

   local o := TOleAuto()
   local uRet

   o:hObj = hObj
   uRet = o:Invoke( cMethName, ... )
   o:hObj = nil

return uRet
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Tue Jul 31, 2007 12:32 pm

Antonio,

Later that I made what you asked for started to occur the following error:

Code: Select all  Expand view
Application
===========
   Path and name: F:\FWH\SAMPLES\pdf.exe (32 bits)
   Size: 1,306,624 bytes
   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 07/31/07, 09:38:02
   Error description: Error /16389  E_FAIL: TERCOMMAND
   Args:
     [   1] = N   680
     [   2] = U   
     [   3] = U   
     [   4] = U   
     [   5] = U   

Stack Calls
===========
   Called from: win32ole.prg => TOLEAUTO:TERCOMMAND(0)
   Called from:  => HB_EXECFROMARRAY(0)
   Called from: win32ole.prg => TOLEAUTO:INVOKE(397)
   Called from:  => ACTXINVOKE(67)
   Called from: ACTIVEX.PRG => TACTIVEX:DO(0)
   Called from: pdf.prg => MAIN(16)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » Tue Jul 31, 2007 12:51 pm

Antonio,

I changed OleInvoke for the following one:

Code: Select all  Expand view
function OleInvoke( hObj, cMethName, uPar1, uPar2, uPar3, uPar4, uPar5 )

   local o := TOleAuto()
   local uRet

   o:hObj = hObj
   IF uPar2 # NIL
      uRet = o:Invoke( cMethName, uPar1, uPar2, uPar3, uPar4, uPar5 )
   ELSE
      uRet = o:Invoke( cMethName, uPar1 )
   ENDIF
   o:hObj = nil

return uRet


The error message stopped to happen, but I continue not receiving the return correct. I tried the following one:

Code: Select all  Expand view
STATIC FUNCTION EventInfo(event, aParams,oActiveX,oWnd,nKey,nx,ny)
LOCAL nSt,text:=Space(100),font:="",n

    IF Upper(event) $ "KEYPRESS"
       ? oActiveX:Do("TerSearchReplace2","rich","",SRCH_SEARCH,N,0)
    ENDIF

RETURN NIL


It did not function, then I made as a test(see bellow), but also it did not function.

Code: Select all  Expand view
STATIC FUNCTION EventInfo(event, aParams,oActiveX,oWnd,nKey,nx,ny)
LOCAL nSt,text:=Space(100),font:="",n

    IF Upper(event) $ "KEYPRESS"
       ? OleInvoke(oActivex:hWnd,"TerSearchReplace2","rich","",SRCH_SEARCH,N,0)
    ENDIF

RETURN NIL
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Jul 31, 2007 1:39 pm

Vilian,

> ? OleInvoke(oActivex:hWnd, ...

That is not correct, as the first parameter is NOT the hWnd.

It has to be OleInvoke( ActXPdisp( oActivex:hActiveX ), ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Tue Jul 31, 2007 1:59 pm

Antonio,

Very grateful. Now he was ok.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » Thu Aug 02, 2007 8:37 pm

Antonio,

Now necessary to implement keyboard key accelerator(Sample: CTRL+P to print). I made thus:

Code: Select all  Expand view
oActiveX:bOnEvent := { | event, nKey | EventInfo( event, nKey ) }

STATIC FUNCTION EventInfo(event, nKey)

   IF Upper(event) $ "KEYPRESS,KEYDOWN"

        IF nKey = 80
              .....
        ENDIF

   ENDIF

RETURN NIL


event is ok, But nKey is returning NULL!
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Thu Aug 02, 2007 9:46 pm

have you tried with two params ?

oActiveX:bOnEvent := { | event, nKey1, nKey2 | EventInfo( event, nKey1, nKey2 ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Fri Aug 03, 2007 1:14 am

Antonio,

Yes, i tried with four params.

oActiveX:bOnEvent := { | event, nKey1, nKey2, nKey3, nKey4 | EventInfo( event, nKey1, nKey2, nKey3, nKey4 ) }

The return is:

nKey1 = array empty
nKey2 = 1242696 ever(constant)
nKey3 = NIL
nKey4 = NIL
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Fri Aug 03, 2007 6:53 am

Vilian,

Analize the value 1242696 according to WM_KEYDOWN docs:
http://msdn2.microsoft.com/en-us/library/ms646280.aspx
unless that activex provides different parameters
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests